[cdo] 38/84: Upstream 1.6.2

Alastair McKinstry mckinstry at moszumanska.debian.org
Sat Jun 13 16:48:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch master
in repository cdo.

commit 1400be783bcec11b9fbdfd026b653318ba4ab948
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Fri Nov 15 10:24:45 2013 +0000

    Upstream 1.6.2
---
 ChangeLog                                          |   136 +-
 Makefile.am                                        |     2 +-
 Makefile.in                                        |     4 +-
 NEWS                                               |    10 +
 OPERATORS                                          |     5 +-
 cdo.spec                                           |     2 +-
 config/default                                     |    31 +-
 configure                                          |   225 +-
 configure.ac                                       |     6 +-
 contrib/Makefile.in                                |     2 +
 contrib/cdoCompletion.bash                         |     3 +
 contrib/cdoCompletion.tcsh                         |     3 +
 contrib/cdoCompletion.zsh                          |     3 +
 contrib/python/cdo.py                              |    83 +-
 doc/cdo.pdf                                        |   Bin 1426651 -> 1424406 bytes
 doc/cdo_refcard.pdf                                |   Bin 95763 -> 96567 bytes
 libcdi/ChangeLog                                   |    82 +
 libcdi/Makefile.in                                 |    18 +
 libcdi/NEWS                                        |    14 +
 libcdi/aclocal.m4                                  |   158 +
 libcdi/app/Makefile.in                             |    18 +
 libcdi/app/cdi.c                                   |    30 +-
 libcdi/app/printinfo.h                             |    49 +-
 libcdi/config/default                              |     4 +-
 libcdi/configure                                   |   554 +-
 libcdi/configure.ac                                |   136 +-
 libcdi/doc/cdi_cman.pdf                            |   Bin 437006 -> 450726 bytes
 libcdi/doc/cdi_fman.pdf                            |   Bin 477310 -> 491954 bytes
 libcdi/examples/Makefile.am                        |    42 +-
 libcdi/examples/Makefile.in                        |    30 +-
 libcdi/examples/pio/Makefile.am                    |     7 +-
 libcdi/examples/pio/Makefile.in                    |    25 +-
 libcdi/examples/pio/collectData.c                  |   122 +-
 libcdi/examples/pio/collectData2003.F90            |   140 +-
 libcdi/examples/pio/collectDataNStreams.c          |   147 +-
 libcdi/examples/pio/compareResourcesArray.c        |    64 +-
 libcdi/interfaces/Makefile.in                      |    18 +
 libcdi/interfaces/python/CdiObj.py                 |   702 +-
 libcdi/interfaces/python/cdiobj_wrap.cpp           | 18134 +++++++++----------
 libcdi/m4/acx_options.m4                           |    23 +-
 libcdi/m4/acx_sl_fc_mod_path_flag.m4               |     2 +-
 libcdi/src/Makefile.am                             |    29 +-
 libcdi/src/Makefile.in                             |    87 +-
 libcdi/src/cdf_int.c                               |    22 +-
 libcdi/src/cdf_int.h                               |    15 +-
 libcdi/src/cdi.h                                   |   161 +-
 libcdi/src/cdi.inc                                 |   135 +-
 libcdi/src/cdiFortran.c                            |    49 +-
 libcdi/src/cdi_int.c                               |   163 +-
 libcdi/src/cdi_int.h                               |    34 +-
 libcdi/src/cdilib.c                                |  8403 +++++----
 libcdi/src/cfortran.h                              |    68 +-
 libcdi/src/cgribex.h                               |    37 +-
 libcdi/src/cgribexlib.c                            |   685 +-
 libcdi/src/config.h.in                             |    12 +
 libcdi/src/error.c                                 |    45 +-
 libcdi/src/error.h                                 |    30 +
 libcdi/src/file.c                                  |    84 +-
 libcdi/src/file.h                                  |     2 +
 libcdi/src/gribapi.h                               |    35 +-
 libcdi/src/grid.c                                  |  1194 +-
 libcdi/src/institution.c                           |   139 +-
 libcdi/src/institution.h                           |     4 +-
 libcdi/src/mo_cdi.f90                              |   664 +-
 libcdi/src/model.c                                 |   150 +-
 libcdi/src/model.h                                 |     4 +-
 libcdi/src/namespace.c                             |   195 +-
 libcdi/src/namespace.h                             |    54 +-
 libcdi/src/pio.c                                   |    17 +-
 libcdi/src/pio.h                                   |    10 +-
 libcdi/src/pio_c_temp.h                            |    25 -
 libcdi/src/pio_cdf_int.c                           |    75 +
 libcdi/src/pio_cdf_int.h                           |    15 +
 libcdi/src/pio_client.c                            |   256 +
 libcdi/src/pio_client.h                            |     7 +
 libcdi/src/pio_comm.c                              |   210 +-
 libcdi/src/pio_interface.c                         |   617 +-
 libcdi/src/pio_interface.h                         |    13 +-
 libcdi/src/pio_list_set.c                          |     3 +-
 libcdi/src/pio_mpinonb.c                           |     6 +-
 libcdi/src/pio_posixasynch.c                       |     1 +
 libcdi/src/pio_posixfpguardsendrecv.c              |    43 +-
 libcdi/src/pio_posixnonb.c                         |     1 +
 libcdi/src/pio_record_send.c                       |    19 +-
 libcdi/src/pio_rpc.c                               |   140 -
 libcdi/src/pio_rpc.h                               |    94 +-
 libcdi/src/pio_serialize.c                         |   115 +
 libcdi/src/pio_serialize.h                         |    14 +
 libcdi/src/pio_server.c                            |   958 +-
 libcdi/src/pio_util.c                              |   202 +-
 libcdi/src/pio_util.h                              |   121 +-
 libcdi/src/resource_handle.c                       |   516 +-
 libcdi/src/resource_handle.h                       |    39 +-
 libcdi/src/resource_unpack.c                       |   108 +
 libcdi/src/resource_unpack.h                       |    26 +
 libcdi/src/serialize.c                             |    88 +
 libcdi/src/serialize.h                             |    32 +
 libcdi/src/stream.c                                |   826 +-
 libcdi/src/stream_cdf.c                            |   465 +-
 libcdi/src/stream_cdf.h                            |     3 +
 libcdi/src/stream_cgribex.c                        |     7 +-
 libcdi/src/stream_ext.c                            |     2 +-
 libcdi/src/stream_grb.c                            |   158 +-
 libcdi/src/stream_grb.h                            |     3 +
 libcdi/src/stream_gribapi.c                        |   357 +-
 libcdi/src/stream_record.c                         |    36 +
 libcdi/src/stream_srv.c                            |     6 +-
 libcdi/src/table.c                                 |     3 +
 libcdi/src/taxis.c                                 |   264 +-
 libcdi/src/taxis.h                                 |     9 +
 libcdi/src/varscan.c                               |    84 +-
 libcdi/src/varscan.h                               |     3 +
 libcdi/src/vlist.c                                 |   132 +-
 libcdi/src/vlist.h                                 |    22 +-
 libcdi/src/vlist_att.c                             |   120 +-
 libcdi/src/vlist_att.h                             |    13 +-
 libcdi/src/vlist_var.c                             |   280 +-
 libcdi/src/vlist_var.h                             |    12 +-
 libcdi/src/zaxis.c                                 |   495 +-
 libcdi/tests/Makefile.am                           |    16 +-
 libcdi/tests/Makefile.in                           |   110 +-
 libcdi/tests/cksum_verify                          |   Bin 0 -> 13808 bytes
 libcdi/tests/cksum_verify.c                        |    58 +
 libcdi/tests/cksum_write.c                         |    96 +-
 libcdi/tests/cksum_write_chunk.c                   |     2 +
 libcdi/tests/pio_cksum_cdf                         |    10 +
 libcdi/tests/pio_cksum_cdf.in                      |    10 +
 libcdi/tests/pio_write.c                           |   105 +-
 libcdi/tests/pio_write_run                         |     7 +-
 libcdi/tests/pio_write_run.in                      |     7 +-
 libcdi/tests/{test_cksum_nc => test_chunk_cksum}   |     8 +-
 .../tests/{test_cksum_nc => test_chunk_cksum.in}   |     6 +-
 libcdi/tests/test_cksum_nc                         |     2 +-
 libcdi/tests/test_cksum_nc2                        |     2 +-
 libcdi/tests/test_cksum_nc4                        |     2 +-
 libcdi/tests/test_resource_copy                    |   Bin 0 -> 8984 bytes
 .../test_resource_copy.c}                          |    76 +-
 libcdi/util/sunf95preproc-wrapper                  |    54 +-
 libcdi/util/sxpreproc-wrapper                      |    52 +-
 libcdi/util/xlfpreproc-wrapper                     |    37 +
 m4/acx_options.m4                                  |    32 +-
 m4/ax_pthread.m4                                   |     2 +-
 src/Adisit.c                                       |   122 +-
 src/Arith.c                                        |     2 +
 src/Arithc.c                                       |     1 +
 src/Arithdays.c                                    |     1 +
 src/CdoMagicsMapper.c                              |     4 +-
 src/Consecstat.c                                   |    80 +-
 src/Derivepar.c                                    |    16 +-
 src/Detrend.c                                      |    29 +-
 src/Diff.c                                         |    12 +-
 src/Duplicate.c                                    |    33 +-
 src/EOFs.c                                         |    12 +-
 src/EcaIndices.c                                   |     2 +
 src/Echam5ini.c                                    |    20 +-
 src/Ensstat.c                                      |    11 +-
 src/Ensstat3.c                                     |    13 +-
 src/Ensval.c                                       |     8 +-
 src/Eof3d.c                                        |    14 +-
 src/Eofcoeff.c                                     |     4 +-
 src/Eofcoeff3d.c                                   |     4 +-
 src/Fillmiss.c                                     |   174 +-
 src/Filter.c                                       |    41 +-
 src/Fldrms.c                                       |     4 +
 src/Fldstat.c                                      |     2 +
 src/Fourier.c                                      |    29 +-
 src/Gather.c                                       |     2 +-
 src/Gradsdes.c                                     |     4 +-
 src/Gridboxstat.c                                  |    25 +-
 src/Harmonic.c                                     |     4 +-
 src/Hi.c                                           |     6 +-
 src/Importbinary.c                                 |     2 +-
 src/Importcmsaf.c                                  |    10 +-
 src/Info.c                                         |     6 +-
 src/Intgrid.c                                      |     9 +-
 src/Intgridtraj.c                                  |     3 +
 src/Intlevel.c                                     |     2 +-
 src/Intyear.c                                      |     4 +-
 src/Isosurface.c                                   |     2 +
 src/Maggraph.c                                     |    20 +-
 src/Magplot.c                                      |     2 +-
 src/Magvector.c                                    |     4 +-
 src/Makefile.am                                    |     4 +
 src/Makefile.in                                    |   149 +-
 src/Mastrfu.c                                      |    46 +-
 src/Merge.c                                        |    17 +
 src/Mergetime.c                                    |    90 +-
 src/Merstat.c                                      |     3 +
 src/Monarith.c                                     |     3 +
 src/Output.c                                       |    10 +-
 src/Outputgmt.c                                    |     4 +-
 src/Pack.c                                         |    25 +-
 src/Regres.c                                       |    40 +-
 src/Remap.c                                        |     5 +-
 src/Rhopot.c                                       |     3 +
 src/Runpctl.c                                      |    29 +-
 src/Runstat.c                                      |    12 +-
 src/Scatter.c                                      |     4 +-
 src/Seascount.c                                    |    49 +-
 src/Seasstat.c                                     |    62 +-
 src/Selbox.c                                       |     8 +-
 src/Select.c                                       |    70 +-
 src/Seltime.c                                      |    28 +-
 src/Setgrid.c                                      |    41 +-
 src/Setmiss.c                                      |     8 +-
 src/Setpartab.c                                    |    24 +-
 src/Sinfo.c                                        |    30 +-
 src/Sort.c                                         |   192 +-
 src/Sorttimestamp.c                                |    28 +-
 src/Spectral.c                                     |    23 +-
 src/Spectrum.c                                     |    64 +-
 src/Split.c                                        |     6 +-
 src/Splitrec.c                                     |     4 +-
 src/Splitsel.c                                     |    16 +-
 src/Splittime.c                                    |    48 +-
 src/Splityear.c                                    |     4 +-
 src/Subtrend.c                                     |    47 +-
 src/Timcount.c                                     |    46 +-
 src/Timpctl.c                                      |    25 +-
 src/Timselpctl.c                                   |    25 +-
 src/Timselstat.c                                   |     1 +
 src/Timsort.c                                      |    30 +-
 src/Timstat.c                                      |    23 +-
 src/Timstat3.c                                     |    15 +-
 src/Trend.c                                        |    41 +-
 src/Trms.c                                         |     4 +
 src/Tstepcount.c                                   |     9 +-
 src/Vargen.c                                       |     8 +-
 src/Varrms.c                                       |     4 +
 src/Vertint.c                                      |    50 +-
 src/Vertstat.c                                     |     4 +
 src/Wct.c                                          |     3 +
 src/YAR.c                                          |    60 +-
 src/Ydayarith.c                                    |     2 +
 src/Ydaypctl.c                                     |    24 +-
 src/Ydaystat.c                                     |     1 +
 src/Ydrunpctl.c                                    |    44 +-
 src/Ydrunstat.c                                    |   113 +-
 src/Yearmonstat.c                                  |     3 +-
 src/Yhourarith.c                                   |     2 +
 src/Yhourstat.c                                    |     1 +
 src/Ymonarith.c                                    |     2 +
 src/Ymonpctl.c                                     |    24 +-
 src/Ymonstat.c                                     |     1 +
 src/Yseaspctl.c                                    |    24 +-
 src/Yseasstat.c                                    |    60 +-
 src/Zonstat.c                                      |     2 +
 src/cdo.c                                          |   225 +-
 src/cdo.h                                          |     4 +-
 src/cdo_int.h                                      |     8 +-
 src/cdo_pthread.c                                  |    14 +-
 src/cdo_vlist.c                                    |    12 +
 src/config.h.in                                    |     9 +
 src/dtypes.h                                       |     4 +-
 src/ecacore.c                                      |    56 +-
 src/ecautil.c                                      |    16 +-
 src/expr.c                                         |    10 +
 src/expr_lex.c                                     |     6 +-
 src/features.c                                     |   114 +
 src/field.c                                        |     2 +-
 src/field.h                                        |     3 +
 src/field2.c                                       |   138 +-
 src/fieldc.c                                       |     7 +-
 src/fieldmem.c                                     |    20 +-
 src/fouriertrans.c                                 |   112 +-
 src/grid.c                                         |   622 +-
 src/grid_area.c                                    |   410 +
 src/griddes.c                                      |    39 +-
 src/griddes.h                                      |     2 +-
 src/griddes_h5.c                                   |    10 +-
 src/griddes_nc.c                                   |    12 +-
 src/gridreference.c                                |   290 +
 src/hetaeta.c                                      |    22 +-
 src/interpol.c                                     |    95 +-
 src/job.c                                          |    20 +-
 src/legendre.c                                     |    26 +-
 src/magics_template_parser.c                       |     2 +-
 src/merge_sort2.c                                  |     8 +-
 src/merge_sort2.h                                  |     2 +-
 src/modules.c                                      |    32 +-
 src/namelist.c                                     |     2 +-
 src/operator_help.h                                |   382 +-
 src/par_io.c                                       |    10 +-
 src/par_io.h                                       |     6 +-
 src/pipe.c                                         |     6 +-
 src/pipe.h                                         |     8 +-
 src/printinfo.h                                    |    49 +-
 src/process.c                                      |    34 +-
 src/pstream.c                                      |   120 +-
 src/pthread_debug.c                                |    16 +-
 src/realtime.c                                     |    12 +-
 src/remap.h                                        |     4 +-
 src/remap_scrip_io.c                               |   762 +
 src/remaplib.c                                     |  1059 +-
 src/remapsort.c                                    |    18 +-
 src/specspace.c                                    |    14 +-
 src/statistic.c                                    |     6 +-
 src/template_parser.h                              |     2 +-
 src/timer.c                                        |     8 +-
 src/userlog.c                                      |    24 +-
 src/util.c                                         |     4 +-
 src/vinterp.c                                      |    18 +-
 test/Makefile.am                                   |    11 +-
 test/Makefile.in                                   |    27 +-
 test/data/Makefile.am                              |     8 +
 {contrib => test/data}/Makefile.in                 |    59 +-
 test/data/bathy4.grb                               |   Bin 0 -> 6008 bytes
 test/data/gp2sp_ref                                |   Bin 0 -> 4064 bytes
 test/data/gp2spl_ref                               |   Bin 0 -> 6256 bytes
 test/data/hl_l19.grb                               |   Bin 0 -> 4888 bytes
 test/data/ml2pl_ref                                |   Bin 0 -> 312 bytes
 test/data/n16_bic_ref                              |   Bin 0 -> 8240 bytes
 test/data/n16_bil_ref                              |   Bin 0 -> 8240 bytes
 test/data/n16_con_ref                              |   Bin 0 -> 8240 bytes
 test/data/n16_laf_ref                              |   Bin 0 -> 8240 bytes
 test/data/n16_nn_ref                               |   Bin 0 -> 8240 bytes
 test/data/n32_bic_ref                              |   Bin 0 -> 32816 bytes
 test/data/n32_bil_ref                              |   Bin 0 -> 32816 bytes
 test/data/n32_con_ref                              |   Bin 0 -> 32816 bytes
 test/data/n32_laf_ref                              |   Bin 0 -> 32816 bytes
 test/data/n32_nn_ref                               |   Bin 0 -> 32816 bytes
 test/data/sp2gp_ref                                |   Bin 0 -> 8368 bytes
 test/data/sp2gpl_ref                               |   Bin 0 -> 8368 bytes
 test/data/t21_geosp_tsurf.grb                      |   Bin 0 -> 8368 bytes
 test/data/timavg_ref                               |   Bin 0 -> 52 bytes
 test/data/timmax_ref                               |   Bin 0 -> 52 bytes
 test/data/timmean_ref                              |   Bin 0 -> 52 bytes
 test/data/timmin_ref                               |   Bin 0 -> 52 bytes
 test/data/timstd1_ref                              |   Bin 0 -> 52 bytes
 test/data/timstd_ref                               |   Bin 0 -> 52 bytes
 test/data/timsum_ref                               |   Bin 0 -> 52 bytes
 test/data/timvar1_ref                              |   Bin 0 -> 52 bytes
 test/data/timvar_ref                               |   Bin 0 -> 52 bytes
 test/data/ts_mm_5years                             |   Bin 0 -> 3120 bytes
 test/test_Gridarea.sh                              |    27 +
 test/test_Remap.sh                                 |    43 +
 test/test_Spectral.sh                              |    65 +
 test/test_Timstat.sh                               |    32 +
 test/test_Vertint.sh                               |    30 +
 test/test_info.py                                  |    37 -
 340 files changed, 27791 insertions(+), 21353 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f465cd4..9e20556 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,73 @@
+2013-11-12  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* using CDI library version 1.6.2
+	* Version 1.6.2 released
+
+2013-11-06  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* Added test/test_Remap.sh
+
+2013-10-25  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* eca_gsl: start date of growing season is wrong if the length of growing season is zero (bug fix) 
+
+2013-10-21  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* splitmon: added optional parameter to set the format string for the month [Feature #4131]
+	* Sort: added support for multi level variables (bug fix) [report: Irina Fast]
+
+2013-10-18  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* gridarea: replace cell_area_tri() by huiliers_area()
+	* outputf: make second parameter (nelem) optional
+
+2013-10-06  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* gridarea: numeric inaccuracy for triangles located directly on the pole (bug fix)
+
+2013-09-02  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* Consecstat: init vars with 0 (bug fix)
+	* Seascount: added support for complex numbers
+	* Timcount: added support for complex numbers
+
+2013-08-26  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* Timstat: added support for complex numbers
+
+2013-08-09  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* setgridtype: parameter regular: added support for reduced grids on sub area
+
+2013-08-07  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* mastrfu: added missing value support
+
+2013-08-05  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* select: added support for key >timestep_of_year<
+
+2013-08-02  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* selyear: fixed wrong result for negative years [Bug #3836]
+
+2013-08-01  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* added support of ASCII grid description for GRID_LAEA
+
+2013-07-29  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* gridGenArea: added warning message if grid cell corner not available
+	* gp2sp: added warning message if gp data not found
+
+2013-07-08  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* split*: use filename extension from input file
+
+2013-06-28  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* gridCurvilinearToRegular: set tolerance to 1.e-6
+
 2013-06-28  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* using CDI library version 1.6.1
@@ -767,7 +837,7 @@ w.de>
 2010-09-27  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* Fldstat2: replaced macros FDIV and FSQRT by function calls DIV and SQRT
-	
+
 2010-09-20  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* New module: Ydayarith (ydayadd, ydaysub, ydaymul, ydaydiv)
@@ -782,12 +852,12 @@ w.de>
 	* using libtool for linking (rpath)
 	* include libcdi as subproject
 	* eca_gsl: adjust implementation to fit definition by ECA [report: Stefan Fronzek]
-	* eca_gsl: make useable in pipes (bug fix) [report: Stefan Fronzek]
+	* eca_gsl: make usable in pipes (bug fix) [report: Stefan Fronzek]
 
 2010-08-26  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* sellevel: copy zaxis meta data name and units (bug fix) [report: Don Murray]
-	
+
 2010-08-20  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
         * pstreamDefTimestep: removed call to streamSync (very slow on GPFS)
@@ -795,19 +865,19 @@ w.de>
 2010-08-05  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* changed percentile parameter type from integer to float [request: Nikolaus Groll]
-	
+
 2010-08-03  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* changed predefined gaussian grid names from t<RES>grid to n<N>
-	
+
 2010-08-02  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* added grid mask support
-	
+
 2010-07-30  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* sellonlatbox: fix rounding error of the last lon index [report: Flore Mounier]
-	
+
 2010-07-22  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* Module Expr: added missing value support [request: Marco van Hulten]
@@ -871,7 +941,7 @@ w.de>
 2010-04-09  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* Added support for time units 3hours and 6hours [request: Jaison-Thomas Ambadan]
-	
+
 2010-04-07  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* Remap: bypass variables with gridtype generic and only one gridpoint
@@ -884,7 +954,7 @@ w.de>
 2010-04-01  Martin Claus  <mclaus at ifm-geomar.de>
 
 	* vertwind: added missing value support
-	
+
 2010-03-25  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* standard deviation (bug fix): change the result from missval to zero, if variance is zero [report: Jaison-Thomas Ambadan]
@@ -906,7 +976,7 @@ w.de>
 
 	* pstreamWriteRecord: check pstreamptr->varlist (bug fix) [report: Kevin Sieck]
 	* added operator fldcor to correlate two fields
-	
+
 2010-03-12  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* added predefined grid t<RES>zon
@@ -939,15 +1009,15 @@ w.de>
 	* using CDI library version 1.4.2
 	* Added new module Gridboxstat (testversion)
 	* Version 1.4.2 released
-	
+
 2010-02-02  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* netCDF+packed data: check that all values are inside the valid range
-	
+
 2010-02-01  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* remove netCDF offset/scalefactor if option -b 32 is set
-	
+
 2010-01-28  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* Ensstat: don't overwrite existing files
@@ -964,11 +1034,11 @@ w.de>
 2010-01-12  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* replace: added support for time constant fields [request: Wei Wei]
-	
+
 2010-01-10  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* Genweights: use netCDF2 (64bit) for large remap weights files [request: Daniel Goll]
-	
+
 2010-01-01  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* added module Fourier
@@ -1041,7 +1111,7 @@ w.de>
 	* IEG format: bug fix for identification of lonlat grids
 	* GRIB format: bug fix for decoding of missing values (scalar version only)
 	* Version 1.4.0.1 released
-	
+
 2009-10-07  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* cdotest:eca_gsl: bug fix [report: Harald Anlauf]
@@ -1136,7 +1206,7 @@ w.de>
 	* Settime: added "seconds" support to "settunits", "settaxis" and "shifttime"
 
 2009-01-15  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
-	
+
 	* using CDI library version 1.3.0
 	* New operator: remapcon2 - Second order conservative remapping
 	* New operator: remaplaf - Largest area fraction remapping
@@ -1165,7 +1235,7 @@ w.de>
 	* Version 1.3.0 released
 
 2008-11-13  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
-	
+
 	* using CDI library version 1.2.1
 	* New operator: import_cmsaf - import CM-SAF files
 	* New operator: gengrid - generate grid [request: Michael Boettinger]
@@ -1215,7 +1285,7 @@ w.de>
 	* ntime: bug fix for datasets with time constant parameter only [report: David Wang]
 	  (also affected: ndate, nmon, nyear, showdate, showtime, showmon, showyear)
 	* Version 1.2.0 released
-	
+
 2008-04-08  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* using CDI library version 1.1.1
@@ -1262,7 +1332,7 @@ w.de>
 	* gradsdes: bug fix for monthly mean data with start day > 28 [report: Renate Brokopf]
 	* expr: change exponent precedence from left to right (bug fix)[report: Claas Teichmann]
 	* Version 1.0.9.1 released
-	
+
 2007-10-22  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* using CDI library version 1.0.8
@@ -1327,13 +1397,13 @@ w.de>
 2007-05-30  Ralf Quast  <ralf.quast at brockmann-consult.de>
 
 	* New operator: timcount, hourcount, daycount, moncount, yearcount, seascount
-	* Renamed eca_fdns, eca_strwin, eca_strbre, eca_strgal, eca_hurr   
+	* Renamed eca_fdns, eca_strwin, eca_strbre, eca_strgal, eca_hurr
 	       to fdns, strwin, strbre, strgal, hurr
-	
+
 2007-04-18  Cedrick Ansorge  <Cedrick.Ansorge at zmaw.de>
 
 	* New operator: maskregion
-	
+
 2007-03-08  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* using CDI library version 1.0.6
@@ -1388,14 +1458,14 @@ w.de>
 	* New module: Tchill (tchill)
 	* New module: Hi (hi)
 	* New module: ECA Indices of Daily Temperature and Precipitation Extremes
-	              (eca_cfd, eca_csu, eca_cwdi, eca_cwfi, eca_etr, eca_fd, 
-	               eca_gsl, eca_hd, eca_hwdi, eca_hwfi, eca_id, eca_su,       
-                       eca_tg10p, eca_tg90p, eca_tn10p, eca_tn90p,    
-                       eca_tr, eca_tx10p, eca_tx90p,    
-                       eca_cdd, eca_cwd, eca_r10mm, eca_r20mm,    
-                       eca_r75p, eca_r75ptot, eca_r90p, eca_r90ptot,  
-                       eca_r95p, eca_r95ptot, eca_r99p, eca_r99ptot,  
-                       eca_rr1, eca_sdii, eca_fdns, eca_strwind)  
+	              (eca_cfd, eca_csu, eca_cwdi, eca_cwfi, eca_etr, eca_fd,
+	               eca_gsl, eca_hd, eca_hwdi, eca_hwfi, eca_id, eca_su,
+                       eca_tg10p, eca_tg90p, eca_tn10p, eca_tn90p,
+                       eca_tr, eca_tx10p, eca_tx90p,
+                       eca_cdd, eca_cwd, eca_r10mm, eca_r20mm,
+                       eca_r75p, eca_r75ptot, eca_r90p, eca_r90ptot,
+                       eca_r95p, eca_r95ptot, eca_r99p, eca_r99ptot,
+                       eca_rr1, eca_sdii, eca_fdns, eca_strwind)
 
 2006-11-06  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
@@ -1417,8 +1487,8 @@ w.de>
 	* New operator: enspctl (Ensstat)
 	* New operator: fldpctl (Fldstat)
 	* New operator: zonpctl (Zonstat)
-	* New operator: merpctl (Merstat)	
-	
+	* New operator: merpctl (Merstat)
+
 2006-11-02  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* using CDI library version 1.0.3
diff --git a/Makefile.am b/Makefile.am
index aa417ff..77c6908 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
 # Process this file with automake to produce Makefile.in
-SUBDIRS = libcdi src contrib test
+SUBDIRS = libcdi src contrib test/data test
 #
 EXTRA_DIST=config/default OPERATORS doc/cdo.pdf doc/cdo_refcard.pdf cdo.spec README
 #
diff --git a/Makefile.in b/Makefile.in
index 0813dcd..016018d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -148,6 +148,8 @@ CLDFLAGS = @CLDFLAGS@
 CLIBS = @CLIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CURL_INCLUDE = @CURL_INCLUDE@
+CURL_LDFLAGS = @CURL_LDFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -296,7 +298,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 # Process this file with automake to produce Makefile.in
-SUBDIRS = libcdi src contrib test
+SUBDIRS = libcdi src contrib test/data test
 #
 EXTRA_DIST = config/default OPERATORS doc/cdo.pdf doc/cdo_refcard.pdf cdo.spec README
 #
diff --git a/NEWS b/NEWS
index a61a967..079339b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,16 @@
 CDO NEWS
 --------
 
+Version 1.6.2 (12 November 2013):
+
+   New features:
+     * select: added support for key >timestep_of_year<
+     * mastrfu: added missing value support
+     * splitmon: added optional parameter to set the format string for the month
+   Fixed bugs:
+     * selyear: wrong result for negative years [Bug #3836]
+     * eca_gsl: start date of growing season is wrong if the length of growing season is zero
+
 Version 1.6.1 (27 June 2013):
 
    New features:
diff --git a/OPERATORS b/OPERATORS
index b030428..edfb0da 100644
--- a/OPERATORS
+++ b/OPERATORS
@@ -54,9 +54,9 @@ Operator catalog:
    Split         splittabnum     Split parameter table numbers
    Splittime     splithour       Split hours
    Splittime     splitday        Split days
-   Splittime     splitmon        Split months
    Splittime     splitseas       Split seasons
    Splittime     splityear       Split years
+   Splittime     splitmon        Split months
    Splitsel      splitsel        Split time selection
 -------------------------------------------------------------
    Selection
@@ -490,6 +490,7 @@ Operator catalog:
    Rotuv         rotuvb          Backward rotation
    Mastrfu       mastrfu         Mass stream function
    Adisit        adisit          Potential temperature to in-situ temperature
+   Adisit        adipot          In-situ temperature to potential temperature
    Rhopot        rhopot          Calculates potential density
    Histogram     histcount       Histogram count
    Histogram     histsum         Histogram sum
@@ -502,6 +503,8 @@ Operator catalog:
    Strbre        strbre          Strong breeze days index per time period
    Strgal        strgal          Strong gale days index per time period
    Hurr          hurr            Hurricane days index per time period
+   Fillmiss      fillmiss        Fill missing values
+   Fillmiss      fillmiss2       Fill missing values
 -------------------------------------------------------------
    Climate indices
 -------------------------------------------------------------
diff --git a/cdo.spec b/cdo.spec
index 92e0240..055f14a 100644
--- a/cdo.spec
+++ b/cdo.spec
@@ -4,7 +4,7 @@
 
 Name:           cdo
 #BuildRequires:  
-Version:        1.6.1
+Version:        1.6.2
 Release:        1
 Summary:        Climate Data Operators
 License:        GNU GENERAL PUBLIC LICENSE Version 2, June 1991
diff --git a/config/default b/config/default
index 49d808b..8ce0ba8 100755
--- a/config/default
+++ b/config/default
@@ -26,7 +26,7 @@ case "${HOSTNAME}" in
                     --with-hdf5=$HOME/local \
                     --with-szlib=$HOME/local \
                     --with-proj=/opt/local \
-	            CC=icc CFLAGS="-g  -D_REENTRANT -Wall -W -O3 -openmp" \
+	            CC=icc CFLAGS="-g  -D_REENTRANT -Wall -W -O3 -march=native -openmp" \
                     LIBS="-L/opt/local/lib -lopenjpeg"
 #                    --with-libxml2=/usr \
 #                    --with-magics=/Users/m214003/local/magics-2.14.9 \
@@ -42,6 +42,7 @@ case "${HOSTNAME}" in
                     --with-szlib=$HOME/local \
                     --with-udunits2=$HOME/local/udunits-2.1.24 \
                     --with-proj=/opt/local \
+                    --with-curl=/opt/local \
                     --with-libxml2=/usr \
                     --with-magics=/Users/m214003/local/magics-2.14.9 \
 	            CC=gcc CFLAGS="-g -pipe -D_REENTRANT -Wall -W -Wfloat-equal -pedantic -O3 -march=native -fopenmp -DHAVE_LIBYAC -I/Users/m214003/cdt/work/YAC/src" \
@@ -57,6 +58,7 @@ case "${HOSTNAME}" in
                     --with-netcdf=/opt/local \
                     --with-szlib=$HOME/local \
                     --with-proj=/opt/local \
+                    --with-curl=/opt/local \
                     --with-libxml2=/usr \
                     --with-magics=/Users/m214003/local/Magics-2.18.14nio \
 	            CC=gcc CFLAGS="-g -pipe -D_REENTRANT -Wall -W -Wfloat-equal -pedantic -O3 -march=native -fopenmp -DHAVE_LIBYAC -I/Users/m214003/cdt/work/YAC/src" \
@@ -115,12 +117,12 @@ case "${HOSTNAME}" in
  	${CONFPATH}configure --prefix=$HOME/local \
                     --program-suffix=-dev \
                     --enable-maintainer-mode \
-	            --with-netcdf=$HOME/builds/libs4cdo-0.0.11 \
-	              --with-hdf5=$HOME/builds/libs4cdo-0.0.11 \
-                     --with-szlib=$HOME/builds/libs4cdo-0.0.11 \
-                  --with-grib_api=$HOME/builds/libs4cdo-0.0.11 \
-                    --with-jasper=$HOME/builds/libs4cdo-0.0.11 \
-                    --with-magics=$HOME/builds/libs4cdo-0.0.11 \
+	            --with-netcdf=$HOME/src/cdo/branches/libs4cdo/build-dev \
+	              --with-hdf5=$HOME/src/cdo/branches/libs4cdo/build-dev \
+                     --with-szlib=$HOME/src/cdo/branches/libs4cdo/build-dev \
+                  --with-grib_api=$HOME/src/cdo/branches/libs4cdo/build-dev \
+                    --with-jasper=$HOME/src/cdo/branches/libs4cdo/build-dev \
+                    --with-magics=$HOME/src/cdo/branches/libs4cdo/build-dev \
                     --with-libxml2=/usr \
                       --with-pic \
                       CC=gcc CFLAGS="-g -Wall -O2 -fopenmp -DWITH_DATA" \
@@ -186,17 +188,16 @@ case "${HOSTNAME}" in
                     CFLAGS="-O -Onooverlap,restrict=all -pvctl,fullmsg,noassume,loopcnt=1000000"
 	;;
 # x86_64-unknown-linux-gnu (rhel55)
-    lizard*)
+    wizard*)
         LDFLAGS="-lpng"
         export LDFLAGS
-	${CONFPATH}configure --prefix=$HOME/local/rhel55-x64 \
-                    --with-jasper=/sw/rhel55-x64/jasper-1.900.1 \
-                    --with-grib_api=/sw/rhel55-x64/grib_api-1.9.0 \
-                    --with-netcdf=/sw/rhel55-x64/netcdf-4.2 \
-                    --with-hdf5=/sw/rhel55-x64/hdf5-1.8.8-threadsafe \
-                    --with-szlib=/sw/rhel55-x64/szip-2.1 \
+	${CONFPATH}configure --prefix=$HOME/local/centos58-x64 \
+                    --with-jasper=/sw/centos58-x64/jasper-1.900.1 \
+                    --with-grib_api=/sw/centos58-x64/grib_api-1.9.0-static \
+                    --with-netcdf=/sw/centos58-x64/netcdf-4.2.1.1 \
+                    --with-szlib=/sw/centos58-x64/szip-2.1 \
                     --with-zlib=/usr \
-	            CC=gcc44 CFLAGS="-g -Wall -O2 -fopenmp"
+	            CC=gcc44 CFLAGS="-g -Wall -O3 -fopenmp"
 	;;
 # powerpc-ibm-aix5.2.0.0
     ecga*)
diff --git a/configure b/configure
index 08e83ed..850ec04 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for cdo 1.6.1.
+# Generated by GNU Autoconf 2.68 for cdo 1.6.2.
 #
 # Report bugs to <http://code.zmaw.de/projects/cdo>.
 #
@@ -570,8 +570,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='cdo'
 PACKAGE_TARNAME='cdo'
-PACKAGE_VERSION='1.6.1'
-PACKAGE_STRING='cdo 1.6.1'
+PACKAGE_VERSION='1.6.2'
+PACKAGE_STRING='cdo 1.6.2'
 PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdo'
 PACKAGE_URL=''
 
@@ -635,6 +635,8 @@ MAGICS_ROOT
 MAGICS_LIBS
 UDUNITS_INCLUDE
 UDUNITS_LDFLAGS
+CURL_INCLUDE
+CURL_LDFLAGS
 PROJ_INCLUDE
 PROJ_LDFLAGS
 ENABLE_IEG
@@ -810,6 +812,7 @@ enable_extra
 enable_ieg
 with_fftw3
 with_proj
+with_curl
 with_udunits2
 with_magics
 with_libxml2
@@ -1371,7 +1374,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cdo 1.6.1 to adapt to many kinds of systems.
+\`configure' configures cdo 1.6.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1441,7 +1444,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cdo 1.6.1:";;
+     short | recursive ) echo "Configuration of cdo 1.6.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1499,6 +1502,7 @@ Optional Packages:
   --without-fftw3         disable support for fftw3
   --with-proj=<directory> Specify location of PROJ library for cartographic
                           projections.
+  --with-curl=<directory> Specify location of CURL library.
   --with-udunits2=<directory>
                           Specify location of UDUNITS2 library.
   --with-magics=<yes|no|directory>
@@ -1586,7 +1590,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cdo configure 1.6.1
+cdo configure 1.6.2
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2179,7 +2183,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cdo $as_me 1.6.1, which was
+It was created by cdo $as_me 1.6.2, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -3073,7 +3077,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='cdo'
- VERSION='1.6.1'
+ VERSION='1.6.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16232,7 +16236,7 @@ case "$CC" in
   clang*) COMP_VERSION=`$CC --version | head -n 1`;;
   sxc*)   COMP_VERSION=`$CC -V 2>&1   | tail -n 1`;;
   xlc*)   COMP_VERSION=`$CC -qversion 2>&1   | head -n 1`;;
-  *)      COMP_VERSION=`$CC -V 2>&1   | head -n 1`;;
+  *)      COMP_VERSION=`$CC -V 2>&1   | head -n 1` | grep -v error;;
 esac
 
 if test -z "$COMP_VERSION" ; then COMP_VERSION="unknown"; fi;
@@ -16656,7 +16660,7 @@ $as_echo "${flag}" >&6; }
         CFLAGS="$save_CFLAGS"
 
         # More AIX lossage: must compile with xlc_r or cc_r
-	if test x"$GCC" != xyes; then
+	if test x"$GCC" != xyes -a \( x"$CC" = xxlc -o x"$CC" = cc \) ; then
           for ac_prog in xlc_r cc_r
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -18606,6 +18610,188 @@ $as_echo "suppressed" >&6; }
 fi
 
 #  ----------------------------------------------------------------------
+#  Checks for CURL library
+
+# Check whether --with-curl was given.
+if test "${with_curl+set}" = set; then :
+  withval=$with_curl; case "$with_curl" in #(
+  no) :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl library" >&5
+$as_echo_n "checking for curl library... " >&6; }
+                           { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
+$as_echo "suppressed" >&6; } ;; #(
+  yes) :
+    for ac_header in curl/curl.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default"
+if test "x$ac_cv_header_curl_curl_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_CURL_CURL_H 1
+_ACEOF
+
+fi
+
+done
+
+                            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing curl_global_init" >&5
+$as_echo_n "checking for library containing curl_global_init... " >&6; }
+if ${ac_cv_search_curl_global_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char curl_global_init ();
+int
+main ()
+{
+return curl_global_init ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' curl; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_curl_global_init=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_curl_global_init+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_curl_global_init+:} false; then :
+
+else
+  ac_cv_search_curl_global_init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_curl_global_init" >&5
+$as_echo "$ac_cv_search_curl_global_init" >&6; }
+ac_res=$ac_cv_search_curl_global_init
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h
+
+else
+  as_fn_error $? "Could not link to CURL library!" "$LINENO" 5
+fi
+
+                            CURL_LDFLAGS=" -lcurl"
+
+                            CURL_INCLUDE=""
+ ;; #(
+  *) :
+    CURL_ROOT=$with_curl
+                          if test -d "$CURL_ROOT"; then :
+  LDFLAGS="-L$CURL_ROOT/lib $LDFLAGS"
+                                 CPPFLAGS="-I$CURL_ROOT/include $CPPFLAGS"
+                                 for ac_header in curl/curl.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default"
+if test "x$ac_cv_header_curl_curl_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_CURL_CURL_H 1
+_ACEOF
+
+fi
+
+done
+
+                                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing curl_global_init" >&5
+$as_echo_n "checking for library containing curl_global_init... " >&6; }
+if ${ac_cv_search_curl_global_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char curl_global_init ();
+int
+main ()
+{
+return curl_global_init ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' curl; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_curl_global_init=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_curl_global_init+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_curl_global_init+:} false; then :
+
+else
+  ac_cv_search_curl_global_init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_curl_global_init" >&5
+$as_echo "$ac_cv_search_curl_global_init" >&6; }
+ac_res=$ac_cv_search_curl_global_init
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h
+
+else
+  as_fn_error $? "Could not link to CURL library!" "$LINENO" 5
+fi
+
+                                 CURL_LDFLAGS=" -L$CURL_ROOT/lib -lcurl"
+
+                                 CURL_INCLUDE=" -I$CURL_ROOT/include"
+
+else
+  as_fn_error $? "$CURL_ROOT is not a directory! CURL suppressed" "$LINENO" 5
+fi ;; #(
+  *) :
+     ;;
+esac
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the CURL library" >&5
+$as_echo_n "checking for the CURL library... " >&6; }
+             { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
+$as_echo "suppressed" >&6; }
+fi
+
+#  ----------------------------------------------------------------------
 #  Link application with UDUNITS2 library
 
 # Check whether --with-udunits2 was given.
@@ -18710,6 +18896,18 @@ fi
 
 done
 
+                                 for ac_header in udunits2/udunits2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "udunits2/udunits2.h" "ac_cv_header_udunits2_udunits2_h" "$ac_includes_default"
+if test "x$ac_cv_header_udunits2_udunits2_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UDUNITS2_UDUNITS2_H 1
+_ACEOF
+
+fi
+
+done
+
                                  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
 $as_echo_n "checking for library containing ut_parse... " >&6; }
 if ${ac_cv_search_ut_parse+:} false; then :
@@ -19270,7 +19468,7 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-ac_config_files="$ac_config_files Makefile src/Makefile contrib/Makefile test/Makefile cdo.spec cdo.settings"
+ac_config_files="$ac_config_files Makefile src/Makefile contrib/Makefile test/Makefile test/data/Makefile cdo.spec cdo.settings"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -19826,7 +20024,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cdo $as_me 1.6.1, which was
+This file was extended by cdo $as_me 1.6.2, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -19892,7 +20090,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-cdo config.status 1.6.1
+cdo config.status 1.6.2
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
@@ -20388,6 +20586,7 @@ do
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "contrib/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;;
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+    "test/data/Makefile") CONFIG_FILES="$CONFIG_FILES test/data/Makefile" ;;
     "cdo.spec") CONFIG_FILES="$CONFIG_FILES cdo.spec" ;;
     "cdo.settings") CONFIG_FILES="$CONFIG_FILES cdo.settings" ;;
 
diff --git a/configure.ac b/configure.ac
index 8bb8f32..0728d92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([cdo], [1.6.1], [http://code.zmaw.de/projects/cdo])
+AC_INIT([cdo], [1.6.2], [http://code.zmaw.de/projects/cdo])
 
 CONFIG_ABORT=yes
 AC_CONFIG_AUX_DIR(config)
@@ -71,7 +71,7 @@ case "$CC" in
   clang*) COMP_VERSION=`$CC --version | head -n 1`;;
   sxc*)   COMP_VERSION=`$CC -V 2>&1   | tail -n 1`;;
   xlc*)   COMP_VERSION=`$CC -qversion 2>&1   | head -n 1`;;
-  *)      COMP_VERSION=`$CC -V 2>&1   | head -n 1`;;
+  *)      COMP_VERSION=`$CC -V 2>&1   | head -n 1` | grep -v error;;
 esac
 
 if test -z "$COMP_VERSION" ; then COMP_VERSION="unknown"; fi;
@@ -124,7 +124,7 @@ AC_SUBST([AR])
 COMPILER="$CC $CFLAGS"
 AC_DEFINE_UNQUOTED(COMPILER, ["$COMPILER"], [Compiler])
 
-AC_OUTPUT(Makefile src/Makefile contrib/Makefile test/Makefile cdo.spec cdo.settings)
+AC_OUTPUT(Makefile src/Makefile contrib/Makefile test/Makefile test/data/Makefile cdo.spec cdo.settings)
 
 #  ----------------------------------------------------------------------
 #  Show configuration
diff --git a/contrib/Makefile.in b/contrib/Makefile.in
index 0ef17c3..2c4b44a 100644
--- a/contrib/Makefile.in
+++ b/contrib/Makefile.in
@@ -88,6 +88,8 @@ CLDFLAGS = @CLDFLAGS@
 CLIBS = @CLIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CURL_INCLUDE = @CURL_INCLUDE@
+CURL_LDFLAGS = @CURL_LDFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
diff --git a/contrib/cdoCompletion.bash b/contrib/cdoCompletion.bash
index 5731c48..1b0a0c4 100644
--- a/contrib/cdoCompletion.bash
+++ b/contrib/cdoCompletion.bash
@@ -24,6 +24,7 @@ abs -abs \
 acos -acos \
 add -add \
 addc -addc \
+adipot -adipot \
 adisit -adisit \
 aexpr -aexpr \
 aexprf -aexprf \
@@ -181,6 +182,7 @@ fc2sp -fc2sp \
 fdns -fdns \
 filedes -filedes \
 fillmiss -fillmiss \
+fillmiss2 -fillmiss2 \
 fisher -fisher \
 fldavg -fldavg \
 fldcor -fldcor \
@@ -502,6 +504,7 @@ setgridarea -setgridarea \
 setgridmask -setgridmask \
 setgridnumber -setgridnumber \
 setgridtype -setgridtype \
+setgriduri -setgriduri \
 sethalo -sethalo \
 setlevel -setlevel \
 setltype -setltype \
diff --git a/contrib/cdoCompletion.tcsh b/contrib/cdoCompletion.tcsh
index cb4c76f..c9e5785 100644
--- a/contrib/cdoCompletion.tcsh
+++ b/contrib/cdoCompletion.tcsh
@@ -24,6 +24,7 @@ abs \
 acos \
 add \
 addc \
+adipot \
 adisit \
 aexpr \
 aexprf \
@@ -181,6 +182,7 @@ fc2sp \
 fdns \
 filedes \
 fillmiss \
+fillmiss2 \
 fisher \
 fldavg \
 fldcor \
@@ -502,6 +504,7 @@ setgridarea \
 setgridmask \
 setgridnumber \
 setgridtype \
+setgriduri \
 sethalo \
 setlevel \
 setltype \
diff --git a/contrib/cdoCompletion.zsh b/contrib/cdoCompletion.zsh
index 626cbfc..c3a22ae 100644
--- a/contrib/cdoCompletion.zsh
+++ b/contrib/cdoCompletion.zsh
@@ -24,6 +24,7 @@ abs -abs \
 acos -acos \
 add -add \
 addc -addc \
+adipot -adipot \
 adisit -adisit \
 aexpr -aexpr \
 aexprf -aexprf \
@@ -181,6 +182,7 @@ fc2sp -fc2sp \
 fdns -fdns \
 filedes -filedes \
 fillmiss -fillmiss \
+fillmiss2 -fillmiss2 \
 fisher -fisher \
 fldavg -fldavg \
 fldcor -fldcor \
@@ -502,6 +504,7 @@ setgridarea -setgridarea \
 setgridmask -setgridmask \
 setgridnumber -setgridnumber \
 setgridtype -setgridtype \
+setgriduri -setgriduri \
 sethalo -sethalo \
 setlevel -setlevel \
 setltype -setltype \
diff --git a/contrib/python/cdo.py b/contrib/python/cdo.py
index 88bcc41..710ed36 100644
--- a/contrib/python/cdo.py
+++ b/contrib/python/cdo.py
@@ -33,7 +33,7 @@ class CDOException(Exception):
 
 class Cdo(object):
 
-  def __init__(self):
+  def __init__(self,returnCdf=False,returnNoneOnError=False,forceOutput=True,cdfMod='scipy',debug=False):
     # Since cdo-1.5.4 undocumented operators are given with the -h option. For
     # earlier version, they have to be provided manually
     self.undocumentedOperators = ['anomaly','beta','boxavg','change_e5lsm','change_e5mask',
@@ -63,14 +63,15 @@ class Cdo(object):
     else:
       self.CDO = 'cdo'
 
-    self.operators   = self.getOperators()
-    self.returnCdf   = False
-    self.tempfile    = MyTempfile()
-    self.forceOutput = True
-    self.debug       = False
+    self.operators              = self.getOperators()
+    self.returnCdf              = returnCdf
+    self.returnNoneOnError      = returnNoneOnError
+    self.tempfile               = MyTempfile()
+    self.forceOutput            = forceOutput
+    self.cdfMod                 = cdfMod
+    self.debug                  = debug
     self.outputOperatorsPattern = '(diff|info|output|griddes|zaxisdes|show|ncode|ndate|nlevel|nmon|nvar|nyear|ntime|npar|gradsdes|pardes)'
 
-    self.cdfMod      = ''
     self.libs        = self.getSupportedLibs()
 
   def __dir__(self):
@@ -78,16 +79,20 @@ class Cdo(object):
     res.extend(self.operators)
     return res
 
-  def call(self,cmd):
+  def call(self,cmd,environment=None):
     if self.debug:
       print '# DEBUG ====================================================================='
+      if None != environment:
+        for k,v in environment.items():
+          print "ENV: " + k + " = " + v
       print 'CALL:'+' '.join(cmd)
       print '# DEBUG ====================================================================='
 
     proc = subprocess.Popen(' '.join(cmd),
-        shell  = True,
-        stderr = subprocess.PIPE,
-        stdout = subprocess.PIPE)
+                            shell  = True,
+                            stderr = subprocess.PIPE,
+                            stdout = subprocess.PIPE,
+                            env    = environment)
     retvals = proc.communicate()
     return {"stdout"     : retvals[0]
            ,"stderr"     : retvals[1]
@@ -140,7 +145,10 @@ class Cdo(object):
           r = map(string.strip,retvals["stdout"].split(os.linesep))
           return r[:len(r)-1]
         else:
-          raise CDOException(**retvals)
+          if self.returnNoneOnError:
+            return None
+          else:
+            raise CDOException(**retvals)
       else:
         if kwargs["force"] or \
            (kwargs.__contains__("output") and not os.path.isfile(kwargs["output"])):
@@ -148,9 +156,16 @@ class Cdo(object):
             kwargs["output"] = self.tempfile.path()
 
           cmd.append(kwargs["output"])
+          if kwargs.__contains__("env"):
+            environment = kwargs["env"]
+          else:
+            environment = None
 
-          retvals = self.call(cmd)
+          retvals = self.call(cmd,environment=environment)
           if self.hasError(method_name,cmd,retvals):
+            if self.returnNoneOnError:
+              return None
+            else:
               raise CDOException(**retvals)
         else:
           if self.debug:
@@ -181,7 +196,7 @@ class Cdo(object):
       # If the method isn't in our dictionary, act normal.
       print("#=====================================================")
       print("Cannot find method:" + method_name)
-      raise AttributeError, method_name
+      raise AttributeError, "Unknown method '" + method_name +"'!"
 
   def getOperators(self):
     import os
@@ -195,26 +210,29 @@ class Cdo(object):
     return list(set(s.split(" ") + self.undocumentedOperators))
 
   def loadCdf(self):
-    try:
-      import scipy.io.netcdf as cdf
-      self.cdf    = cdf
-      self.cdfMod = "scipy"
-    except:
+    if self.cdfMod == "scipy":
+      try:
+        import scipy.io.netcdf as cdf
+        self.cdf    = cdf
+      except:
+        print "Could not load scipy.io.netcdf - try to load nercdf4"
+        self.cdfMod = "netcdf4" 
+
+    if self.cdfMod == "netcdf4":
       try:
         import netCDF4 as cdf
         self.cdf    = cdf
-        self.cdfMod = "netcdf4"
       except:
         raise ImportError,"scipy or python-netcdf4 module is required to return numpy arrays."
 
   def getSupportedLibs(self,force=False):
-    proc = subprocess.Popen('cdo -V',
+    proc = subprocess.Popen(self.CDO + ' -V',
         shell  = True,
         stderr = subprocess.PIPE,
         stdout = subprocess.PIPE)
     retvals = proc.communicate()
 
-    withs     = re.findall('with: (.*)',retvals[1])[0].split(' ')
+    withs     = list(re.findall('(with|Features): (.*)',retvals[1])[0])[1].split(' ')
     libs      = re.findall('(\w+) library version : (\d+\.\d+\.\d+)',retvals[1])
     libraries = dict({})
     for w in withs:
@@ -278,7 +296,7 @@ class Cdo(object):
   # Addional operators:
   #------------------------------------------------------------------
   def module_version(self):
-    '1.2.1'
+    '1.2.3'
 
   def version(self):
     # return CDO's version
@@ -323,7 +341,24 @@ class Cdo(object):
       raise ImportError,"Could not import data from file '" + iFile + "'"
 
     retval = fileObj
-    fileObj.close()
+    return retval
+
+  def openCdf(self,iFile):
+    """Return a cdf handle created by the available cdf library. python-netcdf4 and scipy suported (default:scipy)"""
+    if not self.returnCdf:
+      self.loadCdf()
+
+    if ( "scipy" == self.cdfMod):
+      #making it compatible to older scipy versions
+      print("Use scipy")
+      fileObj =  self.cdf.netcdf_file(iFile, mode='r+')
+    elif ( "netcdf4" == self.cdfMod ):
+      print("Use netcdf4")
+      fileObj = self.cdf.Dataset(iFile,'r+')
+    else:
+      raise ImportError,"Could not import data from file '" + iFile + "'"
+
+    retval = fileObj
     return retval
 
   def readArray(self,iFile,varname):
diff --git a/doc/cdo.pdf b/doc/cdo.pdf
index a3b78db..3ef95fc 100644
Binary files a/doc/cdo.pdf and b/doc/cdo.pdf differ
diff --git a/doc/cdo_refcard.pdf b/doc/cdo_refcard.pdf
index e6be4c8..ff6f016 100644
Binary files a/doc/cdo_refcard.pdf and b/doc/cdo_refcard.pdf differ
diff --git a/libcdi/ChangeLog b/libcdi/ChangeLog
index 7dcfe4c..182d064 100644
--- a/libcdi/ChangeLog
+++ b/libcdi/ChangeLog
@@ -1,6 +1,88 @@
+2013-11-12  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* Version 1.6.2 released
+	* using CGRIBEX library version 1.6.2
+
+2013-11-05  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* Added CDI function zaxisDefNlevRef() and zaxisInqNlevRef() [Feature #4117]
+
+2013-11-04  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* merged branch cdi-pio to trunk cdi
+
+2013-10-22  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* Added support for netCDF CF time attribute: climatology [Feature #4092]
+
+2013-10-17  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* stream_cdf::isLatAxis() and isLonAxis(): added support for stdname latitude and longitude
+
+2013-10-15  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* added support for GRIB2 key typeOfGeneratingProcess
+	* added interface function vlistDefVarTypeOfGeneratingProcess() and vlistInqVarTypeOfGeneratingProcess()
+
+2013-10-07  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* listSizeExtend: initialize ops, val and status (Bug #3994) 
+
+2013-10-07  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* stream_cdf::isLonAxis/isLatAxis: case sensitive units check
+
+2013-09-02  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* streamCopyRecord: allow mixed netCDF file types
+
+2013-08-26  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* gribapiDefLevel: Bug fix for ZAXIS_REFERENCE (Bug #3747)
+
+2013-08-16  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* netCDF: read reference of an unstructured grid
+	* netCDF: write reference of an unstructured grid
+
+2013-08-15  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* made gridtype GRID_REFERENCE part of GRID_UNSTRUCTED
+	* removed gridtype GRID_REFERENCE
+
+2013-08-12  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* GRIB2: added support for level type Lake Bottom (grib level type 162)
+        * GRIB2: added support for level type Bottom Of Sediment Layer (grib level type 163)
+        * GRIB2: added support for level type Bottom Of Thermally Active Sediment Layer (grib level type 164)
+        * GRIB2: added support for level type Bottom Of Sediment Layer Penetrated By Thermal Wave (grib level type 165)
+        * GRIB2: added support for level type Mixing Layer (grib level type 166)
+
+2013-08-09  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* gribapiGetValidityDateTime: check timeRangeIndicator for editionNumber =1 (bug fix)
+
+2013-07-16  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* netCDF: added support for zaxis attribute: positive
+
+2013-07-15  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* Version 1.6.1.1 released (merged branch cdi-pio to trunk cdi)
+
+2013-07-08  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* netCDF: wrong result if type  of data and type of attribute valid_range differ [Bug #3727]
+
+2013-07-04  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
+
+	* gribapiDefLevel::ZAXIS_DEPTH_BELOW_LAND: apply scalefactor to dlevel2 (bug fix) [report: Harald Anlauf]
+	* streamFilesuffix: changed default filename suffix for FILETYPE_NC2 to nc
+
 2013-06-28  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
 	* Version 1.6.1 released
+	* using CGRIBEX library version 1.6.1
 
 2013-06-27  Uwe Schulzweida  <Uwe.Schulzweida at zmaw.de>
 
diff --git a/libcdi/Makefile.in b/libcdi/Makefile.in
index 120a69b..c02f693 100644
--- a/libcdi/Makefile.in
+++ b/libcdi/Makefile.in
@@ -149,6 +149,13 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+BUILD_CXX = @BUILD_CXX@
+BUILD_F77 = @BUILD_F77@
+BUILD_FC = @BUILD_FC@
+BUILD_FCFLAGS = @BUILD_FCFLAGS@
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CDI_F90_INTERFACE_FCFLAGS = @CDI_F90_INTERFACE_FCFLAGS@
@@ -174,6 +181,9 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
 ENABLE_EXTRA = @ENABLE_EXTRA@
 ENABLE_GRIB = @ENABLE_GRIB@
 ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
+ENABLE_NETCDF = @ENABLE_NETCDF@
 ENABLE_PYTHON = @ENABLE_PYTHON@
 ENABLE_RUBY = @ENABLE_RUBY@
 ENABLE_SERVICE = @ENABLE_SERVICE@
@@ -194,6 +204,7 @@ FPP_INCOPT = @FPP_INCOPT@
 GREP = @GREP@
 GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
 GRIB_API_LIBS = @GRIB_API_LIBS@
+HAVE_PARALLEL_NC4 = @HAVE_PARALLEL_NC4@
 HDF5_INCLUDE = @HDF5_INCLUDE@
 HDF5_LIBS = @HDF5_LIBS@
 HDF5_ROOT = @HDF5_ROOT@
@@ -237,6 +248,11 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PPM_CORE_CFLAGS = @PPM_CORE_CFLAGS@
+PPM_CORE_LIBS = @PPM_CORE_LIBS@
 PTHREAD_CC = @PTHREAD_CC@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -256,6 +272,8 @@ THREADS_LIBS = @THREADS_LIBS@
 USER_NAME = @USER_NAME@
 USE_MPI = @USE_MPI@
 VERSION = @VERSION@
+YAXT_CFLAGS = @YAXT_CFLAGS@
+YAXT_LIBS = @YAXT_LIBS@
 ZLIB_INCLUDE = @ZLIB_INCLUDE@
 ZLIB_LIBS = @ZLIB_LIBS@
 abs_builddir = @abs_builddir@
diff --git a/libcdi/NEWS b/libcdi/NEWS
index c6825e7..8cebf1a 100644
--- a/libcdi/NEWS
+++ b/libcdi/NEWS
@@ -1,6 +1,20 @@
 CDI NEWS
 --------
 
+Version 1.6.2 (12 November 2013):
+
+   New features:
+     * Added support for netCDF CF time attribute: climatology [Feature #4092]
+     * Added CDI function zaxisDefNlevRef() and zaxisInqNlevRef() [Feature #4117]
+     * Made gridtype GRID_REFERENCE part of GRID_UNSTRUCTED
+     * GRIB2: added support for level type Lake Bottom (grib level type 162)
+     * GRIB2: added support for level type Bottom Of Sediment Layer (grib level type 163)
+     * GRIB2: added support for level type Bottom Of Thermally Active Sediment Layer (grib level type 164)
+     * GRIB2: added support for level type Bottom Of Sediment Layer Penetrated By Thermal Wave (grib level type 165)
+     * GRIB2: added support for level type Mixing Layer (grib level type 166)
+   Fixed bugs:
+     * netCDF: wrong result if type of data and type of attribute valid_range differ [Bug #3727]
+
 Version 1.6.1 (18 June 2013):
 
    New features:
diff --git a/libcdi/aclocal.m4 b/libcdi/aclocal.m4
index 302b7f6..5c27e11 100644
--- a/libcdi/aclocal.m4
+++ b/libcdi/aclocal.m4
@@ -20,6 +20,164 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+# 
+# Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_default([$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+		     [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+   	AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+        ])
+elif test $pkg_failed = untried; then
+     	AC_MSG_RESULT([no])
+	m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+        ])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	$3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
 # Foundation, Inc.
 #
diff --git a/libcdi/app/Makefile.in b/libcdi/app/Makefile.in
index d068af7..53aebcb 100644
--- a/libcdi/app/Makefile.in
+++ b/libcdi/app/Makefile.in
@@ -123,6 +123,13 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+BUILD_CXX = @BUILD_CXX@
+BUILD_F77 = @BUILD_F77@
+BUILD_FC = @BUILD_FC@
+BUILD_FCFLAGS = @BUILD_FCFLAGS@
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CDI_F90_INTERFACE_FCFLAGS = @CDI_F90_INTERFACE_FCFLAGS@
@@ -148,6 +155,9 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
 ENABLE_EXTRA = @ENABLE_EXTRA@
 ENABLE_GRIB = @ENABLE_GRIB@
 ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
+ENABLE_NETCDF = @ENABLE_NETCDF@
 ENABLE_PYTHON = @ENABLE_PYTHON@
 ENABLE_RUBY = @ENABLE_RUBY@
 ENABLE_SERVICE = @ENABLE_SERVICE@
@@ -168,6 +178,7 @@ FPP_INCOPT = @FPP_INCOPT@
 GREP = @GREP@
 GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
 GRIB_API_LIBS = @GRIB_API_LIBS@
+HAVE_PARALLEL_NC4 = @HAVE_PARALLEL_NC4@
 HDF5_INCLUDE = @HDF5_INCLUDE@
 HDF5_LIBS = @HDF5_LIBS@
 HDF5_ROOT = @HDF5_ROOT@
@@ -211,6 +222,11 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PPM_CORE_CFLAGS = @PPM_CORE_CFLAGS@
+PPM_CORE_LIBS = @PPM_CORE_LIBS@
 PTHREAD_CC = @PTHREAD_CC@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -230,6 +246,8 @@ THREADS_LIBS = @THREADS_LIBS@
 USER_NAME = @USER_NAME@
 USE_MPI = @USE_MPI@
 VERSION = @VERSION@
+YAXT_CFLAGS = @YAXT_CFLAGS@
+YAXT_LIBS = @YAXT_LIBS@
 ZLIB_INCLUDE = @ZLIB_INCLUDE@
 ZLIB_LIBS = @ZLIB_LIBS@
 abs_builddir = @abs_builddir@
diff --git a/libcdi/app/cdi.c b/libcdi/app/cdi.c
index 76c4a18..ded3b95 100644
--- a/libcdi/app/cdi.c
+++ b/libcdi/app/cdi.c
@@ -425,13 +425,13 @@ void printShortinfo(int streamID, int vlistID, int vardis)
 	  levelsize = zaxisInqSize(zaxisID);
 	  /* zaxisInqLongname(zaxisID, longname); */
 	  zaxisName(zaxistype, longname);
-	  longname[17] = 0;
+	  longname[18] = 0;
 	  zaxisInqUnits(zaxisID, units);
 	  units[12] = 0;
 	  if ( zaxistype == ZAXIS_GENERIC && ltype != 0 )
 	    nbyte0    = fprintf(stdout, "  %4d : %-11s  (ltype=%3d) : ", vlistZaxisIndex(vlistID, zaxisID)+1, longname, ltype);
 	  else
-	    nbyte0    = fprintf(stdout, "  %4d : %-17s  %5s : ", vlistZaxisIndex(vlistID, zaxisID)+1, longname, units);
+	    nbyte0    = fprintf(stdout, "  %4d : %-18s %5s : ", vlistZaxisIndex(vlistID, zaxisID)+1, longname, units);
 	  nbyte = nbyte0;
 	  for ( levelID = 0; levelID < levelsize; levelID++ )
 	    {
@@ -449,7 +449,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
 	    {
 	      double level1, level2;
 	      nbyte = nbyte0;
-	      nbyte0 = fprintf(stdout, "%33s : ", "bounds");
+	      fprintf(stdout, "%33s : ", "bounds");
 	      for ( levelID = 0; levelID < levelsize; levelID++ )
 		{
 		  if ( nbyte > MAXCHARS )
@@ -464,6 +464,30 @@ void printShortinfo(int streamID, int vlistID, int vardis)
 		}
 	      fprintf(stdout, "\n");
 	    }
+
+          if ( zaxistype == ZAXIS_REFERENCE )
+            {
+              int number   = zaxisInqNumber(zaxisID);
+
+              if ( number > 0 )
+                {
+                  fprintf(stdout, "%33s : ", "zaxis");
+                  fprintf(stdout, "number = %d\n", number);
+                }
+
+              char uuidOfVGrid[17];
+              zaxisInqUUID(zaxisID, uuidOfVGrid);
+              if ( uuidOfVGrid[0] != 0 )
+                {
+                  char uuidOfVGridStr[37];
+                  uuid2str(uuidOfVGrid, uuidOfVGridStr);
+                  if ( uuidOfVGridStr[0] != 0  && strlen(uuidOfVGridStr) == 36 )
+                    {
+                      fprintf(stdout, "%33s : ", "uuid");
+                      fprintf(stdout, "%s\n", uuidOfVGridStr);
+                    }
+                }
+            }
 	}
 
       taxisID = vlistInqTaxis(vlistID);
diff --git a/libcdi/app/printinfo.h b/libcdi/app/printinfo.h
index c7ab8e7..2ad9706 100644
--- a/libcdi/app/printinfo.h
+++ b/libcdi/app/printinfo.h
@@ -213,9 +213,7 @@ void printGridInfo(int vlistID)
 	      fprintf(stdout, "%*s", nbyte0, "");
 	      fprintf(stdout, "%-9s : first = %.9g", yname, yfirst);
 	      if ( ysize > 1 ) fprintf(stdout, "  last = %.9g", ylast);
-	      if ( IS_NOT_EQUAL(yinc, 0) &&
-		   (gridtype == GRID_LONLAT || gridtype == GRID_SINUSOIDAL ||
-		    gridtype == GRID_LCC2 || gridtype == GRID_LAEA) )
+	      if ( IS_NOT_EQUAL(yinc, 0) && gridtype != GRID_GAUSSIAN && gridtype != GRID_GAUSSIAN_REDUCED )
 		fprintf(stdout, "  inc = %.9g", yinc);
 	      fprintf(stdout, "  %s", yunits);
 	      fprintf(stdout, "\n");
@@ -278,28 +276,37 @@ void printGridInfo(int vlistID)
 	  nd = gridInqGMEnd(gridID);
 	  fprintf(stdout, "size      : dim = %d  nd = %d  ni = %d\n", gridsize, nd, ni);
 	}
-      else if ( gridtype == GRID_REFERENCE )
-	{
-	  int number, position;
-	  number   = gridInqNumber(gridID);
-	  position = gridInqPosition(gridID);
-	  fprintf(stdout, "size      : dim = %d\n", gridsize);
-	  fprintf(stdout, "%*s", nbyte0, "");
-	  fprintf(stdout, "grid      : number = %d  position = %d\n", number, position);
-	  if ( gridInqReference(gridID, NULL) )
-	    {
-	      char reference_link[8192];
-	      gridInqReference(gridID, reference_link);
-	      fprintf(stdout, "%*s", nbyte0, "");
-	      fprintf(stdout, "path      : %s\n", reference_link);
-	    }
-	}
       else if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED )
 	{
 	  if ( gridtype == GRID_CURVILINEAR )
-	    fprintf(stdout, "size      : dim = %d  nx = %d  ny = %d\n", gridsize, xsize, ysize);
+	    fprintf(stdout, "size      : dim = %d  nx = %d  ny = %d", gridsize, xsize, ysize);
 	  else
-	    fprintf(stdout, "size      : dim = %d  nvertex = %d\n", gridsize, gridInqNvertex(gridID));
+	    fprintf(stdout, "size      : dim = %d", gridsize);
+
+          if ( gridtype == GRID_UNSTRUCTURED && gridInqNvertex(gridID) > 0 )
+	    fprintf(stdout, "  nvertex = %d", gridInqNvertex(gridID));
+
+          fprintf(stdout, "\n");
+
+          if ( gridtype == GRID_UNSTRUCTURED )
+            {
+              int number   = gridInqNumber(gridID);
+              int position = gridInqPosition(gridID);
+
+              if ( number > 0 )
+                {
+                  fprintf(stdout, "%*s", nbyte0, "");
+                  fprintf(stdout, "grid      : number = %d  position = %d\n", number, position);
+                }
+
+              if ( gridInqReference(gridID, NULL) )
+                {
+                  char reference_link[8192];
+                  gridInqReference(gridID, reference_link);
+                  fprintf(stdout, "%*s", nbyte0, "");
+                  fprintf(stdout, "uri       : %s\n", reference_link);
+                }
+            }
 
 	  if ( gridInqXvals(gridID, NULL) && gridInqYvals(gridID, NULL) )
 	    {
diff --git a/libcdi/config/default b/libcdi/config/default
index d477177..977c973 100755
--- a/libcdi/config/default
+++ b/libcdi/config/default
@@ -15,6 +15,7 @@ case "${HOSTNAME}" in
     bailung*)
 	./configure --prefix=$HOME/local \
                     --enable-maintainer-mode \
+                    --enable-iso-c-interface \
                     --enable-swig \
                     --enable-python \
                     --with-jasper=/opt/local \
@@ -41,6 +42,7 @@ case "${HOSTNAME}" in
     hama*)
 	./configure --prefix=$HOME/local \
                     --enable-maintainer-mode \
+                    --enable-iso-c-interface \
                     --enable-swig \
                     --enable-python \
                     --with-jasper=/opt/local \
@@ -129,7 +131,7 @@ case "${HOSTNAME}" in
                     --with-zlib=/sw/aix61/zlib-1.2.6 \
                     --with-szlib=/sw/aix61/szip-2.1-threadsafe \
                     AR="ar -X 64" LDFLAGS="-brtl" FC=xlf2003_r CC=xlc_r \
-                    CFLAGS="-g -O3 -q64 -qhot -qstrict -qarch=pwr6 -qtune=balanced -qlistfmt=html=transforms -DHAVE_MMAP -Dextname" \
+                    CFLAGS="-g -O3 -qhot -q64 -qarch=auto -qtune=auto -qlistfmt=html=transforms -DHAVE_MMAP -Dextname" \
                     FCFLAGS="-qsuffix=cpp=f90" \
                     SHELL=/bin/bash
         ;;
diff --git a/libcdi/configure b/libcdi/configure
index c395507..bb3063b 100755
--- a/libcdi/configure
+++ b/libcdi/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for cdi 1.6.1.
+# Generated by GNU Autoconf 2.68 for cdi 1.6.2.
 #
 # Report bugs to <http://code.zmaw.de/projects/cdi>.
 #
@@ -570,8 +570,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='cdi'
 PACKAGE_TARNAME='cdi'
-PACKAGE_VERSION='1.6.1'
-PACKAGE_STRING='cdi 1.6.1'
+PACKAGE_VERSION='1.6.2'
+PACKAGE_STRING='cdi 1.6.2'
 PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdi'
 PACKAGE_URL=''
 
@@ -616,6 +616,13 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+BUILD_F77
+BUILD_FC
+BUILD_CXX
+BUILD_CC
+BUILD_LDFLAGS
+BUILD_FCFLAGS
+BUILD_CFLAGS
 USE_FC_FALSE
 USE_FC_TRUE
 CREATE_INTERFACES_FALSE
@@ -640,6 +647,14 @@ CREATE_ISOC_TRUE
 USE_MPI
 USE_MPI_FALSE
 USE_MPI_TRUE
+HAVE_PARALLEL_NC4
+PPM_CORE_LIBS
+PPM_CORE_CFLAGS
+YAXT_LIBS
+YAXT_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
 MPI_LAUNCH
 ENABLE_ALL_STATIC_FALSE
 ENABLE_ALL_STATIC_TRUE
@@ -660,6 +675,9 @@ JASPER_LIBS
 NETCDF_LIBS
 NETCDF_INCLUDE
 NETCDF_ROOT
+ENABLE_NC4
+ENABLE_NC2
+ENABLE_NETCDF
 NC_CONFIG
 HDF5_LIBS
 HDF5_INCLUDE
@@ -860,7 +878,21 @@ CXX
 CXXFLAGS
 CCC
 CXXCPP
-FCMODEXT'
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+YAXT_CFLAGS
+YAXT_LIBS
+PPM_CORE_CFLAGS
+PPM_CORE_LIBS
+FCMODEXT
+BUILD_CFLAGS
+BUILD_FCFLAGS
+BUILD_LDFLAGS
+BUILD_CC
+BUILD_CXX
+BUILD_FC
+BUILD_F77'
 
 
 # Initialize some variables set by options.
@@ -1403,7 +1435,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cdi 1.6.1 to adapt to many kinds of systems.
+\`configure' configures cdi 1.6.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1473,7 +1505,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cdi 1.6.1:";;
+     short | recursive ) echo "Configuration of cdi 1.6.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1562,7 +1594,32 @@ Some influential environment variables:
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   CXXCPP      C++ preprocessor
+  PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
+  YAXT_CFLAGS C compiler flags for YAXT, overriding pkg-config
+  YAXT_LIBS   linker flags for YAXT, overriding pkg-config
+  PPM_CORE_CFLAGS
+              C compiler flags for PPM_CORE, overriding pkg-config
+  PPM_CORE_LIBS
+              linker flags for PPM_CORE, overriding pkg-config
   FCMODEXT    file extension of compiled Fortran module files
+  BUILD_CFLAGS
+              append to CFLAGS during build but not in configure phase
+  BUILD_FCFLAGS
+              append to FCFLAGS during build but not in configure phase
+  BUILD_LDFLAGS
+              append to LDFLAGS during build but not in configure phase
+  BUILD_CC    replace CC with expansion of $BUILD_CC during build but not in
+              configure phase
+  BUILD_CXX   replace CXX with expansion of $BUILD_CXX during build but not in
+              configure phase
+  BUILD_FC    replace FC with expansion of $BUILD_FC during build but not in
+              configure phase
+  BUILD_F77   replace F77 with expansion of $BUILD_F77 during build but not in
+              configure phase
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1630,7 +1687,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cdi configure 1.6.1
+cdi configure 1.6.2
 generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2391,7 +2448,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cdi $as_me 1.6.1, which was
+It was created by cdi $as_me 1.6.2, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
@@ -3288,7 +3345,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='cdi'
- VERSION='1.6.1'
+ VERSION='1.6.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -25151,6 +25208,9 @@ fi
 NETCDF_ROOT=''
 NETCDF_INCLUDE=''
 NETCDF_LIBS=''
+ENABLE_NETCDF=no
+ENABLE_NC2=no
+ENABLE_NC4=no
 
 # Check whether --with-netcdf was given.
 if test "${with_netcdf+set}" = set; then :
@@ -25229,6 +25289,7 @@ if test "$ac_res" != no; then :
 
 $as_echo "#define HAVE_LIBNETCDF 1" >>confdefs.h
 
+                                            ENABLE_NETCDF=yes
 else
   as_fn_error $? "Could not link to netcdf library" "$LINENO" 5
 fi
@@ -25280,6 +25341,7 @@ $as_echo "#define HAVE_NETCDF2 1" >>confdefs.h
 
                                           { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+                                          ENABLE_NC2=yes
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -25290,6 +25352,7 @@ $as_echo_n "checking netcdf's nc4 support... " >&6; }
 
 $as_echo "#define HAVE_NETCDF4 1" >>confdefs.h
 
+                                    ENABLE_NC4=yes
                                     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
@@ -25372,6 +25435,7 @@ if test "$ac_res" != no; then :
 
 $as_echo "#define HAVE_LIBNETCDF 1" >>confdefs.h
 
+                                                 ENABLE_NETCDF=yes
 else
   as_fn_error $? "Could not link to netcdf library" "$LINENO" 5
 fi
@@ -25436,6 +25500,7 @@ $as_echo_n "checking netcdf's nc2 support... " >&6; }
 
 $as_echo "#define HAVE_NETCDF2 1" >>confdefs.h
 
+                                          ENABLE_NC2=yes
                                           { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
@@ -25448,6 +25513,7 @@ $as_echo_n "checking netcdf's nc4 support... " >&6; }
 
 $as_echo "#define HAVE_NETCDF4 1" >>confdefs.h
 
+                                          ENABLE_NC4=yes
                                           { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
@@ -25475,6 +25541,9 @@ fi
 
 
 
+
+
+
 #  ----------------------------------------------------------------------
 #  Link application with JASPER library (needed for GRIB2 compression)
 JASPER_LIBS=''
@@ -26335,6 +26404,126 @@ fi
 if test x"${enable_mpi}" = x"yes"; then :
   USE_MPI=yes
 fi
+HAVE_PARALLEL_NC4=0
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		PKG_CONFIG=""
+	fi
+fi
 if test x"$USE_MPI" = xyes; then :
 
 $as_echo "#define USE_MPI 1" >>confdefs.h
@@ -26345,20 +26534,22 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_MPI_LAUNCH+:} false; then :
+if ${ac_cv_path_MPI_LAUNCH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$MPI_LAUNCH"; then
-  ac_cv_prog_MPI_LAUNCH="$MPI_LAUNCH" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  case $MPI_LAUNCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MPI_LAUNCH="$MPI_LAUNCH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_MPI_LAUNCH="$ac_prog"
+    ac_cv_path_MPI_LAUNCH="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -26366,9 +26557,10 @@ done
   done
 IFS=$as_save_IFS
 
+  ;;
+esac
 fi
-fi
-MPI_LAUNCH=$ac_cv_prog_MPI_LAUNCH
+MPI_LAUNCH=$ac_cv_path_MPI_LAUNCH
 if test -n "$MPI_LAUNCH"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPI_LAUNCH" >&5
 $as_echo "$MPI_LAUNCH" >&6; }
@@ -26380,14 +26572,275 @@ fi
 
   test -n "$MPI_LAUNCH" && break
 done
+test -n "$MPI_LAUNCH" || MPI_LAUNCH="true"
+
+   if test x"$cross_compiling" = xno; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MPI_LAUNCH works" >&5
+$as_echo_n "checking if $MPI_LAUNCH works... " >&6; }
+      saved_CFLAGS=$CFLAGS
+      saved_LIBS=$LIBS
+      CFLAGS="$CFLAGS $MPI_C_INCLUDE"
+      LIBS="$LIBS $MPI_C_LIB"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <mpi.h>
+
+#define xmpi(ret)           \\
+  do {                      \\
+    if (ret != MPI_SUCCESS) \\
+      exit(EXIT_FAILURE);   \\
+  } while (0)
+
+int
+main(int argc, char **argv)
+{
+  xmpi(MPI_Init(&argc, &argv));
+  char *numarg = argv[1];
+  int cmdnum = atoi(numarg);
+  int procnum = 1;
+  xmpi(MPI_Allreduce(MPI_IN_PLACE, &procnum, 1, MPI_INT, MPI_SUM,
+                     MPI_COMM_WORLD));
+  xmpi(MPI_Finalize());
+  return (procnum == cmdnum)?EXIT_SUCCESS:EXIT_FAILURE;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if $MPI_LAUNCH -n 4 ./conftest$EXEEXT 4; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+             { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "mpirun doesn't work
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Cannot compile simple MPI program
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      CFLAGS=$saved_CFLAGS
+      LIBS=$saved_LIBS
+
+fi
+   if test "x$MPI_LAUNCH" = xtrue; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MPI launch command unavailable" >&5
+$as_echo "$as_me: WARNING: MPI launch command unavailable" >&2;}
+fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for YAXT" >&5
+$as_echo_n "checking for YAXT... " >&6; }
+
+if test -n "$YAXT_CFLAGS"; then
+    pkg_cv_YAXT_CFLAGS="$YAXT_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_YAXT_CFLAGS=`$PKG_CONFIG --cflags "yaxt" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$YAXT_LIBS"; then
+    pkg_cv_YAXT_LIBS="$YAXT_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yaxt\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "yaxt") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_YAXT_LIBS=`$PKG_CONFIG --libs "yaxt" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        YAXT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "yaxt" 2>&1`
+        else
+	        YAXT_PKG_ERRORS=`$PKG_CONFIG --print-errors "yaxt" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$YAXT_PKG_ERRORS" >&5
+
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Required yaxt library unavailable.
+See \`config.log' for more details" "$LINENO" 5; }
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Required yaxt library unavailable.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+	YAXT_CFLAGS=$pkg_cv_YAXT_CFLAGS
+	YAXT_LIBS=$pkg_cv_YAXT_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_YAXT /**/" >>confdefs.h
+
+fi
+   if test x"$ENABLE_NC4" = xyes; then :
+  for ac_header in netcdf_par.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "netcdf_par.h" "ac_cv_header_netcdf_par_h" "$ac_includes_default"
+if test "x$ac_cv_header_netcdf_par_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NETCDF_PAR_H 1
+_ACEOF
+ ac_fn_c_check_decl "$LINENO" "MPI_Bcast" "ac_cv_have_decl_MPI_Bcast" "$ac_includes_default
+#include <netcdf_par.h>
+"
+if test "x$ac_cv_have_decl_MPI_Bcast" = xyes; then :
+  HAVE_PARALLEL_NC4=1
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The supplied netCDF library does not support MPI parallel invocations" >&5
+$as_echo "$as_me: WARNING: The supplied netCDF library does not support MPI parallel invocations" >&2;}
+fi
+
+else
+  ac_fn_c_check_decl "$LINENO" "MPI_Bcast" "ac_cv_have_decl_MPI_Bcast" "$ac_includes_default
+#include <netcdf.h>
+"
+if test "x$ac_cv_have_decl_MPI_Bcast" = xyes; then :
+  HAVE_PARALLEL_NC4=1
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The supplied netCDF library does not support MPI parallel invocations" >&5
+$as_echo "$as_me: WARNING: The supplied netCDF library does not support MPI parallel invocations" >&2;}
+fi
+
+
+fi
+
+done
+
+                  if test $HAVE_PARALLEL_NC4 = 1; then :
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PPM_CORE" >&5
+$as_echo_n "checking for PPM_CORE... " >&6; }
+
+if test -n "$PPM_CORE_CFLAGS"; then
+    pkg_cv_PPM_CORE_CFLAGS="$PPM_CORE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"scales-ppm-core\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "scales-ppm-core") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PPM_CORE_CFLAGS=`$PKG_CONFIG --cflags "scales-ppm-core" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$PPM_CORE_LIBS"; then
+    pkg_cv_PPM_CORE_LIBS="$PPM_CORE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"scales-ppm-core\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "scales-ppm-core") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PPM_CORE_LIBS=`$PKG_CONFIG --libs "scales-ppm-core" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
 
-   if test x$MPI_LAUNCH = x; then :
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
 fi
+        if test $_pkg_short_errors_supported = yes; then
+	        PPM_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "scales-ppm-core" 2>&1`
+        else
+	        PPM_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors "scales-ppm-core" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$PPM_CORE_PKG_ERRORS" >&5
+
+	enable_ppm=no
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	enable_ppm=no
+else
+	PPM_CORE_CFLAGS=$pkg_cv_PPM_CORE_CFLAGS
+	PPM_CORE_LIBS=$pkg_cv_PPM_CORE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	enable_ppm=yes
+
+$as_echo "#define HAVE_PPM_CORE /**/" >>confdefs.h
+
+
+fi
+
+fi
+                  if test x$enable_ppm != xyes; then :
+  HAVE_PARALLEL_NC4=0
+fi
+
+fi
+
 else
   MPI_LAUNCH="`pwd`/util/serialrun"
 
 fi
+if test $HAVE_PARALLEL_NC4 -gt 0; then :
+
+$as_echo "#define HAVE_PARALLEL_NC4 1" >>confdefs.h
+
+fi
+
  if test x"$USE_MPI" = xyes; then
   USE_MPI_TRUE=
   USE_MPI_FALSE='#'
@@ -26432,7 +26885,7 @@ $as_echo_n "checking for flag to alter module search path... " >&6; }
 if ${acx_sl_cv_fc_mod_path_flag_fc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-       mkdir conftestdir
+  mkdir conftestdir
       cd conftestdir
       cat > conftest.$ac_ext <<_ACEOF
       module cnftst
@@ -26751,24 +27204,28 @@ $as_echo "no" >&6; }
 fi
 
 
-   PYTHON_INCLUDES="-I$($PYTHON -c 'from distutils import sysconfig;print sysconfig.get_python_lib(1,1)' | $SED 's/lib/include/')"
-   save_CPPFLAGS=$CPPFLAGS
-   CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
-   ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" "$ac_includes_default"
+   enable_python=no
+   for PYTHON_INCLUDES in \
+     "-I`$PYTHON -c 'from distutils import sysconfig;print sysconfig.get_python_inc()'`" \
+     "-I`$PYTHON -c 'from distutils import sysconfig;print sysconfig.get_python_lib(1,1)' | $SED 's/lib/include/'`"
+   do
+     save_CPPFLAGS=$CPPFLAGS
+     CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+     ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" "$ac_includes_default"
 if test "x$ac_cv_header_Python_h" = xyes; then :
-
-else
-  enable_python=no
-                                PYTHON=
-
+  enable_python=yes
+       break
 fi
 
 
-   CPPFLAGS=$save_CPPFLAGS
-   if test "x$PYTHON" != "x"; then :
+     CPPFLAGS=$save_CPPFLAGS
+   done
+   if test "x$enable_python" != "xno"; then :
   if test "x$SWIG" = "x"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: Python bindings: Swig is disabled, pregenerated files will be used. Use '--enable-swig' for swig usage" >&5
 $as_echo "$as_me: Python bindings: Swig is disabled, pregenerated files will be used. Use '--enable-swig' for swig usage" >&6;}
+else
+  PYTHON=
 fi
 else
   if test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0; then :
@@ -26862,6 +27319,22 @@ fi
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 # Checks for compiler
 COMPILER="$CC $CFLAGS"
 
@@ -26870,10 +27343,10 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-ac_config_files="$ac_config_files tests/test_cksum_grib tests/test_cksum_nc tests/test_cksum_nc2 tests/test_cksum_nc4 tests/test_cksum_extra tests/test_cksum_service tests/test_cksum_ieg tests/pio_write_run tests/pio_cksum_mpinonb tests/pio_cksum_fpguard tests/pio_cksum_asynch tests/pio_cksum_writer util/serialrun"
+ac_config_files="$ac_config_files tests/test_cksum_grib tests/test_cksum_nc tests/test_cksum_nc2 tests/test_cksum_nc4 tests/test_cksum_extra tests/test_cksum_service tests/test_cksum_ieg tests/test_chunk_cksum tests/pio_write_run tests/pio_cksum_mpinonb tests/pio_cksum_fpguard tests/pio_cksum_asynch tests/pio_cksum_writer tests/pio_cksum_cdf util/serialrun"
 
 
-ac_config_files="$ac_config_files Makefile src/Makefile interfaces/Makefile app/Makefile tests/Makefile examples/Makefile examples/pio/Makefile cdi.settings src/pkgconfig/cdi.pc"
+ac_config_files="$ac_config_files Makefile src/Makefile interfaces/Makefile app/Makefile tests/Makefile examples/Makefile cdi.settings examples/pio/Makefile src/pkgconfig/cdi.pc"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -27044,6 +27517,13 @@ if test -z "${USE_FC_TRUE}" && test -z "${USE_FC_FALSE}"; then
   as_fn_error $? "conditional \"USE_FC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+CFLAGS="$CFLAGS${BUILD_CFLAGS+ $BUILD_CFLAGS}"
+FCFLAGS="$FCFLAGS${BUILD_FCFLAGS+ $BUILD_FCFLAGS}"
+LDFLAGS="$LDFLAGS${BUILD_LDFLAGS+ $BUILD_LDFLAGS}"
+CC="${BUILD_CC-$CC}"
+CXX="${BUILD_CXX-$CXX}"
+FC="${BUILD_FC-$FC}"
+F77="${BUILD_F77-$F77}"
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
@@ -27453,7 +27933,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cdi $as_me 1.6.1, which was
+This file was extended by cdi $as_me 1.6.2, which was
 generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -27519,7 +27999,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-cdi config.status 1.6.1
+cdi config.status 1.6.2
 configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
@@ -28211,11 +28691,13 @@ do
     "tests/test_cksum_extra") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_extra" ;;
     "tests/test_cksum_service") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_service" ;;
     "tests/test_cksum_ieg") CONFIG_FILES="$CONFIG_FILES tests/test_cksum_ieg" ;;
+    "tests/test_chunk_cksum") CONFIG_FILES="$CONFIG_FILES tests/test_chunk_cksum" ;;
     "tests/pio_write_run") CONFIG_FILES="$CONFIG_FILES tests/pio_write_run" ;;
     "tests/pio_cksum_mpinonb") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_mpinonb" ;;
     "tests/pio_cksum_fpguard") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_fpguard" ;;
     "tests/pio_cksum_asynch") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_asynch" ;;
     "tests/pio_cksum_writer") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_writer" ;;
+    "tests/pio_cksum_cdf") CONFIG_FILES="$CONFIG_FILES tests/pio_cksum_cdf" ;;
     "util/serialrun") CONFIG_FILES="$CONFIG_FILES util/serialrun" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
@@ -28223,8 +28705,8 @@ do
     "app/Makefile") CONFIG_FILES="$CONFIG_FILES app/Makefile" ;;
     "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
     "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
-    "examples/pio/Makefile") CONFIG_FILES="$CONFIG_FILES examples/pio/Makefile" ;;
     "cdi.settings") CONFIG_FILES="$CONFIG_FILES cdi.settings" ;;
+    "examples/pio/Makefile") CONFIG_FILES="$CONFIG_FILES examples/pio/Makefile" ;;
     "src/pkgconfig/cdi.pc") CONFIG_FILES="$CONFIG_FILES src/pkgconfig/cdi.pc" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -30039,11 +30521,13 @@ _LT_EOF
     "tests/test_cksum_extra":F) chmod a+x "$ac_file" ;;
     "tests/test_cksum_service":F) chmod a+x "$ac_file" ;;
     "tests/test_cksum_ieg":F) chmod a+x "$ac_file" ;;
+    "tests/test_chunk_cksum":F) chmod a+x "$ac_file" ;;
     "tests/pio_write_run":F) chmod a+x "$ac_file" ;;
     "tests/pio_cksum_mpinonb":F) chmod a+x "$ac_file" ;;
     "tests/pio_cksum_fpguard":F) chmod a+x "$ac_file" ;;
     "tests/pio_cksum_asynch":F) chmod a+x "$ac_file" ;;
     "tests/pio_cksum_writer":F) chmod a+x "$ac_file" ;;
+    "tests/pio_cksum_cdf":F) chmod a+x "$ac_file" ;;
     "util/serialrun":F) chmod a+x "$ac_file" ;;
 
   esac
diff --git a/libcdi/configure.ac b/libcdi/configure.ac
index 572104a..172e342 100644
--- a/libcdi/configure.ac
+++ b/libcdi/configure.ac
@@ -1,6 +1,6 @@
 #  Process this file with autoconf to produce a configure script.
 
-AC_INIT([cdi], [1.6.1], [http://code.zmaw.de/projects/cdi])
+AC_INIT([cdi], [1.6.2], [http://code.zmaw.de/projects/cdi])
 
 echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
 
@@ -108,12 +108,90 @@ ACX_OPTIONS
 AC_ARG_ENABLE(mpi,AS_HELP_STRING([--enable-mpi],[Compile with MPI compiler [default=no]]),enable_mpi=yes,enable_mpi=no)
 AS_IF([test x"${enable_mpi}" = x"yes"],
       [USE_MPI=yes])
+HAVE_PARALLEL_NC4=0
 AS_IF([test x"$USE_MPI" = xyes],
   [AC_DEFINE([USE_MPI],[1],[parallel I/O requested and available])
-   AC_CHECK_PROGS([MPI_LAUNCH],[mpirun mpiexec],[])
-   AS_IF([test x$MPI_LAUNCH = x],[])],
+   AC_PATH_PROGS([MPI_LAUNCH],[mpirun mpiexec],[true])
+   AS_IF([test x"$cross_compiling" = xno],
+     [AC_MSG_CHECKING([if $MPI_LAUNCH works])
+      saved_CFLAGS=$CFLAGS
+      saved_LIBS=$LIBS
+      CFLAGS="$CFLAGS $MPI_C_INCLUDE"
+      LIBS="$LIBS $MPI_C_LIB"
+      AC_LINK_IFELSE([AC_LANG_SOURCE([
+@%:@include <stdio.h>
+@%:@include <stdlib.h>
+
+@%:@include <mpi.h>
+
+@%:@define xmpi(ret)           \\
+  do {                      \\
+    if (ret != MPI_SUCCESS) \\
+      exit(EXIT_FAILURE);   \\
+  } while (0)
+
+int
+main(int argc, char **argv)
+{
+  xmpi(MPI_Init(&argc, &argv));
+  char *numarg = argv@<:@1@:>@;
+  int cmdnum = atoi(numarg);
+  int procnum = 1;
+  xmpi(MPI_Allreduce(MPI_IN_PLACE, &procnum, 1, MPI_INT, MPI_SUM,
+                     MPI_COMM_WORLD));
+  xmpi(MPI_Finalize());
+  return (procnum == cmdnum)?EXIT_SUCCESS:EXIT_FAILURE;
+}
+])],
+         [AS_IF([$MPI_LAUNCH -n 4 ./conftest$EXEEXT 4],
+            [AC_MSG_RESULT([yes])],
+            [AC_MSG_RESULT([no])
+             AC_MSG_FAILURE([mpirun doesn't work])])],
+         [AC_MSG_FAILURE([Cannot compile simple MPI program])])
+      CFLAGS=$saved_CFLAGS
+      LIBS=$saved_LIBS
+     ])
+   AS_IF([test "x$MPI_LAUNCH" = xtrue],
+     [AC_MSG_WARN([MPI launch command unavailable])])
+
+   PKG_CHECK_MODULES([YAXT],[yaxt],
+     [AC_DEFINE([HAVE_YAXT],,[yaxt library is available])],
+     [AC_MSG_FAILURE([Required yaxt library unavailable.])])
+   AS_IF([test x"$ENABLE_NC4" = xyes],
+     [AC_CHECK_HEADERS([netcdf_par.h],
+        [AC_CHECK_DECL([MPI_Bcast],
+           [HAVE_PARALLEL_NC4=1],
+           [AC_MSG_WARN([The supplied netCDF library does not support MPI parallel invocations])],
+           [AC_INCLUDES_DEFAULT
+@%:@include <netcdf_par.h>])],
+        [AC_CHECK_DECL([MPI_Bcast],
+           [HAVE_PARALLEL_NC4=1],
+           [AC_MSG_WARN([The supplied netCDF library does not support MPI parallel invocations])],
+           [AC_INCLUDES_DEFAULT
+@%:@include <netcdf.h>])
+])
+      dnl parallel netCDF support still requires ScalES-PPM and YAXT to
+      dnl re-arrange the data when running with more than one collector
+      AS_IF([test $HAVE_PARALLEL_NC4 = 1],
+        [PKG_CHECK_MODULES([PPM_CORE],[scales-ppm-core],
+           [enable_ppm=yes
+            AC_DEFINE([HAVE_PPM_CORE],,
+              [ScalES PPM C core library is available])
+           ],
+           [enable_ppm=no])
+        ])
+      dnl if not both scales-ppm and yaxt are available, netcdf can only be
+      dnl used in serial mode
+      AS_IF([test x$enable_ppm != xyes],
+        [HAVE_PARALLEL_NC4=0])
+     ])
+  ],
   [MPI_LAUNCH="`pwd`/util/serialrun"
    AC_SUBST([MPI_LAUNCH])])
+AS_IF([test $HAVE_PARALLEL_NC4 -gt 0],
+  [AC_DEFINE([HAVE_PARALLEL_NC4],[1],
+             [netCDF library does support MPI parallel invocations])])
+AC_SUBST([HAVE_PARALLEL_NC4])
 AM_CONDITIONAL([USE_MPI],[test x"$USE_MPI" = xyes])
 AC_SUBST([USE_MPI])
 #  ----------------------------------------------------------------------
@@ -170,16 +248,21 @@ AS_IF([test "x$enable_ruby" != "xno"],[AC_SUBST([ENABLE_RUBY],[true])],[AC_SUBST
 AC_ARG_ENABLE(python,
   [AS_HELP_STRING([--enable-python],[python language bindings [default=no] (EXPERIMENTAL)])],
   [AC_CHECK_PROG(PYTHON,python,python)
-   PYTHON_INCLUDES="-I$($PYTHON -c 'from distutils import sysconfig;print sysconfig.get_python_lib(1,1)' | $SED 's/lib/include/')"
-   save_CPPFLAGS=$CPPFLAGS
-   CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
-   AC_CHECK_HEADER([Python.h],,[enable_python=no
-                                PYTHON=
-                               ])
-   CPPFLAGS=$save_CPPFLAGS
-   AS_IF([test "x$PYTHON" != "x"],
+   enable_python=no
+   for PYTHON_INCLUDES in \
+     "-I`$PYTHON -c 'from distutils import sysconfig;print sysconfig.get_python_inc()'`" \
+     "-I`$PYTHON -c 'from distutils import sysconfig;print sysconfig.get_python_lib(1,1)' | $SED 's/lib/include/'`"
+   do
+     save_CPPFLAGS=$CPPFLAGS
+     CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+     AC_CHECK_HEADER([Python.h],[enable_python=yes
+       break])
+     CPPFLAGS=$save_CPPFLAGS
+   done
+   AS_IF([test "x$enable_python" != "xno"],
          [AS_IF([test "x$SWIG" = "x"],
-                [AC_MSG_NOTICE([Python bindings: Swig is disabled, pregenerated files will be used. Use '--enable-swig' for swig usage])])],
+                [AC_MSG_NOTICE([Python bindings: Swig is disabled, pregenerated files will be used. Use '--enable-swig' for swig usage])],
+                [PYTHON=])],
                 [AS_IF([test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0],
                        [AC_MSG_NOTICE([No (swig does not support -python option)])
                         enable_python=no
@@ -196,6 +279,29 @@ AM_CONDITIONAL([USE_FC],[test -n "$FC" && test "X$FC" != "Xno" && test x$acx_cv_
 
 AC_SUBST([CPPFLAGS])
 
+AC_ARG_VAR([BUILD_CFLAGS],
+  [append to CFLAGS during build but not in configure phase])
+AC_CONFIG_COMMANDS_PRE([CFLAGS="$CFLAGS${BUILD_CFLAGS+ $BUILD_CFLAGS}"])
+AC_ARG_VAR([BUILD_FCFLAGS],
+  [append to FCFLAGS during build but not in configure phase])
+AC_CONFIG_COMMANDS_PRE([FCFLAGS="$FCFLAGS${BUILD_FCFLAGS+ $BUILD_FCFLAGS}"])
+AC_ARG_VAR([BUILD_LDFLAGS],
+  [append to LDFLAGS during build but not in configure phase])
+AC_CONFIG_COMMANDS_PRE([LDFLAGS="$LDFLAGS${BUILD_LDFLAGS+ $BUILD_LDFLAGS}"])
+AC_ARG_VAR([BUILD_CC],
+  [replace CC with expansion of $BUILD_CC during build but not in configure phase])
+AC_CONFIG_COMMANDS_PRE([CC="${BUILD_CC-$CC}"])
+AC_ARG_VAR([BUILD_CXX],
+  [replace CXX with expansion of $BUILD_CXX during build but not in configure phase])
+AC_CONFIG_COMMANDS_PRE([CXX="${BUILD_CXX-$CXX}"])
+AC_ARG_VAR([BUILD_FC],
+  [replace FC with expansion of $BUILD_FC during build but not in configure phase])
+AC_CONFIG_COMMANDS_PRE([FC="${BUILD_FC-$FC}"])
+AC_ARG_VAR([BUILD_F77],
+  [replace F77 with expansion of $BUILD_F77 during build but not in configure phase])
+AC_CONFIG_COMMANDS_PRE([F77="${BUILD_F77-$F77}"])
+
+
 # Checks for compiler
 COMPILER="$CC $CFLAGS"
 AC_DEFINE_UNQUOTED(COMPILER, ["$COMPILER"], [Compiler])
@@ -207,16 +313,18 @@ AC_CONFIG_FILES([tests/test_cksum_grib \
                  tests/test_cksum_extra \
                  tests/test_cksum_service \
                  tests/test_cksum_ieg \
+                 tests/test_chunk_cksum \
                  tests/pio_write_run \
                  tests/pio_cksum_mpinonb \
                  tests/pio_cksum_fpguard \
                  tests/pio_cksum_asynch \
                  tests/pio_cksum_writer \
+                 tests/pio_cksum_cdf \
                  util/serialrun],[chmod a+x "$ac_file"])
 
 AC_OUTPUT([Makefile src/Makefile interfaces/Makefile app/Makefile \
-	tests/Makefile examples/Makefile examples/pio/Makefile cdi.settings \
-        src/pkgconfig/cdi.pc])
+	tests/Makefile examples/Makefile cdi.settings \
+	examples/pio/Makefile src/pkgconfig/cdi.pc])
 
 #  ----------------------------------------------------------------------
 #  Show configuration
diff --git a/libcdi/doc/cdi_cman.pdf b/libcdi/doc/cdi_cman.pdf
index e576acd..90a0845 100644
Binary files a/libcdi/doc/cdi_cman.pdf and b/libcdi/doc/cdi_cman.pdf differ
diff --git a/libcdi/doc/cdi_fman.pdf b/libcdi/doc/cdi_fman.pdf
index fde69ee..5aa2586 100644
Binary files a/libcdi/doc/cdi_fman.pdf and b/libcdi/doc/cdi_fman.pdf differ
diff --git a/libcdi/examples/Makefile.am b/libcdi/examples/Makefile.am
index 4baab3a..30217b3 100644
--- a/libcdi/examples/Makefile.am
+++ b/libcdi/examples/Makefile.am
@@ -7,34 +7,42 @@ if CREATE_ISOC
   noinst_PROGRAMS += cdi_read_f2003 cdi_write_f2003
 endif
 #
-AM_CPPFLAGS             = -I$(top_srcdir)/src
-AM_FCFLAGS              = $(FPP_INCOPT)$(top_srcdir)/src $(FC_MOD_FLAG)../src
+AM_CPPFLAGS              = -I$(top_srcdir)/src
+AM_FCFLAGS               = $(FPP_INCOPT)$(top_srcdir)/src $(FC_MOD_FLAG)../src
 #
-cdi_write_SOURCES       = cdi_write.c
-cdi_write_LDADD         = $(top_builddir)/src/libcdi.la
+cdi_write_SOURCES        = cdi_write.c
+cdi_write_LDADD          = $(top_builddir)/src/libcdi.la
 #
-cdi_write_ens_SOURCES   = cdi_write_ens.c
-cdi_write_ens_LDADD     = $(top_builddir)/src/libcdi.la
+cdi_write_ens_SOURCES    = cdi_write_ens.c
+cdi_write_ens_LDADD      = $(top_builddir)/src/libcdi.la
 #
-cdi_write_hybrid_SOURCES   = cdi_write_hybrid.c
-cdi_write_hybrid_LDADD     = $(top_builddir)/src/libcdi.la
+cdi_write_hybrid_SOURCES = cdi_write_hybrid.c
+cdi_write_hybrid_LDADD   = $(top_builddir)/src/libcdi.la
 #
-cdi_read_SOURCES        = cdi_read.c
-cdi_read_LDADD          = $(top_builddir)/src/libcdi.la
+cdi_read_SOURCES         = cdi_read.c
+cdi_read_LDADD           = $(top_builddir)/src/libcdi.la
 #
-cdi_copy_SOURCES        = cdi_copy.c
-cdi_copy_LDADD          = $(top_builddir)/src/libcdi.la
+cdi_copy_SOURCES         = cdi_copy.c
+cdi_copy_LDADD           = $(top_builddir)/src/libcdi.la
+#
+cdi_read_f2003_SOURCES   = cdi_read_f2003.f90
+cdi_read_f2003_LDADD     = $(top_builddir)/src/libcdi.la $(top_builddir)/src/mo_cdi.o
+#
+cdi_write_f2003_SOURCES  = cdi_write_f2003.f90
+cdi_write_f2003_LDADD    = $(top_builddir)/src/libcdi.la $(top_builddir)/src/mo_cdi.o
 #
 if ENABLE_ALL_STATIC
-cdi_write_LDFLAGS       = -all-static
-cdi_read_LDFLAGS        = -all-static
-cdi_copy_LDFLAGS        = -all-static
+cdi_write_LDFLAGS        = -all-static
+cdi_read_LDFLAGS         = -all-static
+cdi_copy_LDFLAGS         = -all-static
+cdi_read_f2003_LDFLAGS   = -all-static
+cdi_write_f2003_LDFLAGS  = -all-static
+cdi_read_f2003_LDFLAGS  = -all-static
+cdi_write_f2003_LDFLAGS = -all-static
 endif
 cdi_read_f2003_SOURCES  = cdi_read_f2003.f90
 cdi_read_f2003_LDADD    = $(top_builddir)/src/libcdi.la $(top_builddir)/src/mo_cdi.o
-cdi_read_f2003_LDFLAGS  = -all-static
 
 cdi_write_f2003_SOURCES = cdi_write_f2003.f90
 cdi_write_f2003_LDADD   = $(top_builddir)/src/libcdi.la $(top_builddir)/src/mo_cdi.o
-cdi_write_f2003_LDFLAGS = -all-static
 
diff --git a/libcdi/examples/Makefile.in b/libcdi/examples/Makefile.in
index 31c5962..90281f3 100644
--- a/libcdi/examples/Makefile.in
+++ b/libcdi/examples/Makefile.in
@@ -161,6 +161,13 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+BUILD_CXX = @BUILD_CXX@
+BUILD_F77 = @BUILD_F77@
+BUILD_FC = @BUILD_FC@
+BUILD_FCFLAGS = @BUILD_FCFLAGS@
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CDI_F90_INTERFACE_FCFLAGS = @CDI_F90_INTERFACE_FCFLAGS@
@@ -186,6 +193,9 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
 ENABLE_EXTRA = @ENABLE_EXTRA@
 ENABLE_GRIB = @ENABLE_GRIB@
 ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
+ENABLE_NETCDF = @ENABLE_NETCDF@
 ENABLE_PYTHON = @ENABLE_PYTHON@
 ENABLE_RUBY = @ENABLE_RUBY@
 ENABLE_SERVICE = @ENABLE_SERVICE@
@@ -206,6 +216,7 @@ FPP_INCOPT = @FPP_INCOPT@
 GREP = @GREP@
 GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
 GRIB_API_LIBS = @GRIB_API_LIBS@
+HAVE_PARALLEL_NC4 = @HAVE_PARALLEL_NC4@
 HDF5_INCLUDE = @HDF5_INCLUDE@
 HDF5_LIBS = @HDF5_LIBS@
 HDF5_ROOT = @HDF5_ROOT@
@@ -249,6 +260,11 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PPM_CORE_CFLAGS = @PPM_CORE_CFLAGS@
+PPM_CORE_LIBS = @PPM_CORE_LIBS@
 PTHREAD_CC = @PTHREAD_CC@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -268,6 +284,8 @@ THREADS_LIBS = @THREADS_LIBS@
 USER_NAME = @USER_NAME@
 USE_MPI = @USE_MPI@
 VERSION = @VERSION@
+YAXT_CFLAGS = @YAXT_CFLAGS@
+YAXT_LIBS = @YAXT_LIBS@
 ZLIB_INCLUDE = @ZLIB_INCLUDE@
 ZLIB_LIBS = @ZLIB_LIBS@
 abs_builddir = @abs_builddir@
@@ -348,16 +366,16 @@ cdi_read_LDADD = $(top_builddir)/src/libcdi.la
 #
 cdi_copy_SOURCES = cdi_copy.c
 cdi_copy_LDADD = $(top_builddir)/src/libcdi.la
-#
- at ENABLE_ALL_STATIC_TRUE@cdi_write_LDFLAGS = -all-static
- at ENABLE_ALL_STATIC_TRUE@cdi_read_LDFLAGS = -all-static
- at ENABLE_ALL_STATIC_TRUE@cdi_copy_LDFLAGS = -all-static
 cdi_read_f2003_SOURCES = cdi_read_f2003.f90
 cdi_read_f2003_LDADD = $(top_builddir)/src/libcdi.la $(top_builddir)/src/mo_cdi.o
-cdi_read_f2003_LDFLAGS = -all-static
 cdi_write_f2003_SOURCES = cdi_write_f2003.f90
 cdi_write_f2003_LDADD = $(top_builddir)/src/libcdi.la $(top_builddir)/src/mo_cdi.o
-cdi_write_f2003_LDFLAGS = -all-static
+#
+ at ENABLE_ALL_STATIC_TRUE@cdi_write_LDFLAGS = -all-static
+ at ENABLE_ALL_STATIC_TRUE@cdi_read_LDFLAGS = -all-static
+ at ENABLE_ALL_STATIC_TRUE@cdi_copy_LDFLAGS = -all-static
+ at ENABLE_ALL_STATIC_TRUE@cdi_read_f2003_LDFLAGS = -all-static
+ at ENABLE_ALL_STATIC_TRUE@cdi_write_f2003_LDFLAGS = -all-static
 all: all-am
 
 .SUFFIXES:
diff --git a/libcdi/examples/pio/Makefile.am b/libcdi/examples/pio/Makefile.am
index f9c0a0a..b7f9222 100644
--- a/libcdi/examples/pio/Makefile.am
+++ b/libcdi/examples/pio/Makefile.am
@@ -1,16 +1,17 @@
 noinst_PROGRAMS=collectData collectDataNStreams
 
+AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_CFLAGS)
+AM_FCFLAGS  = $(FPP_INCOPT)$(top_srcdir)/src
+
 if USE_MPI
 noinst_PROGRAMS+=compareResourcesArray
+AM_FCFLAGS += $(FPP_DEFOPT)USE_MPI
 endif
 
 if USE_FC
  noinst_PROGRAMS+=collectData2003
 endif
 
-AM_CPPFLAGS = -I$(top_srcdir)/src
-AM_FCFLAGS  = $(FPP_INCOPT)$(top_srcdir)/src
-
 collectData_SOURCES=collectData.c
 
 collectData_LDADD=$(top_builddir)/src/libcdi.la
diff --git a/libcdi/examples/pio/Makefile.in b/libcdi/examples/pio/Makefile.in
index 7af7aa2..b6e4c57 100644
--- a/libcdi/examples/pio/Makefile.in
+++ b/libcdi/examples/pio/Makefile.in
@@ -54,7 +54,8 @@ host_triplet = @host@
 noinst_PROGRAMS = collectData$(EXEEXT) collectDataNStreams$(EXEEXT) \
 	$(am__EXEEXT_1) $(am__EXEEXT_2)
 @USE_MPI_TRUE at am__append_1 = compareResourcesArray
- at USE_FC_TRUE@am__append_2 = collectData2003
+ at USE_MPI_TRUE@am__append_2 = $(FPP_DEFOPT)USE_MPI
+ at USE_FC_TRUE@am__append_3 = collectData2003
 subdir = examples/pio
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -135,6 +136,13 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+BUILD_CXX = @BUILD_CXX@
+BUILD_F77 = @BUILD_F77@
+BUILD_FC = @BUILD_FC@
+BUILD_FCFLAGS = @BUILD_FCFLAGS@
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CDI_F90_INTERFACE_FCFLAGS = @CDI_F90_INTERFACE_FCFLAGS@
@@ -160,6 +168,9 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
 ENABLE_EXTRA = @ENABLE_EXTRA@
 ENABLE_GRIB = @ENABLE_GRIB@
 ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
+ENABLE_NETCDF = @ENABLE_NETCDF@
 ENABLE_PYTHON = @ENABLE_PYTHON@
 ENABLE_RUBY = @ENABLE_RUBY@
 ENABLE_SERVICE = @ENABLE_SERVICE@
@@ -180,6 +191,7 @@ FPP_INCOPT = @FPP_INCOPT@
 GREP = @GREP@
 GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
 GRIB_API_LIBS = @GRIB_API_LIBS@
+HAVE_PARALLEL_NC4 = @HAVE_PARALLEL_NC4@
 HDF5_INCLUDE = @HDF5_INCLUDE@
 HDF5_LIBS = @HDF5_LIBS@
 HDF5_ROOT = @HDF5_ROOT@
@@ -223,6 +235,11 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PPM_CORE_CFLAGS = @PPM_CORE_CFLAGS@
+PPM_CORE_LIBS = @PPM_CORE_LIBS@
 PTHREAD_CC = @PTHREAD_CC@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -242,6 +259,8 @@ THREADS_LIBS = @THREADS_LIBS@
 USER_NAME = @USER_NAME@
 USE_MPI = @USE_MPI@
 VERSION = @VERSION@
+YAXT_CFLAGS = @YAXT_CFLAGS@
+YAXT_LIBS = @YAXT_LIBS@
 ZLIB_INCLUDE = @ZLIB_INCLUDE@
 ZLIB_LIBS = @ZLIB_LIBS@
 abs_builddir = @abs_builddir@
@@ -301,8 +320,8 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src
-AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src
+AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_CFLAGS)
+AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src $(am__append_2)
 collectData_SOURCES = collectData.c
 collectData_LDADD = $(top_builddir)/src/libcdi.la
 collectData2003_SOURCES = collectData2003.F90
diff --git a/libcdi/examples/pio/collectData.c b/libcdi/examples/pio/collectData.c
index 187c1dc..faddca7 100644
--- a/libcdi/examples/pio/collectData.c
+++ b/libcdi/examples/pio/collectData.c
@@ -2,17 +2,26 @@
 #  include "config.h"
 #endif
 
+#include <stdlib.h>
+
 #ifdef USE_MPI
 #include <unistd.h>
 #include <mpi.h>
-#include "pio_c_temp.h"
+#include <yaxt.h>
+#else
+typedef int MPI_Comm;
+#define MPI_COMM_NULL 0
 #endif
 
 #include "cdi.h"
 #include "pio_util.h"
 
+#ifdef USE_MPI
+static int
+uniform_partition_start(int set_interval[2], int nparts, int part_idx);
+#endif
 
-void modelRun ()
+static void modelRun(MPI_Comm commModel)
 {
   enum {
     filetype    = FILETYPE_GRB,
@@ -28,14 +37,21 @@ void modelRun ()
 
   int gridID, zaxisID[nVars], taxisID;
   int vlistID, varID[nVars], streamID, tsID, tfID = 0;
-  int i, j, nmiss = 0, rank;
+  int i, j, nmiss = 0;
   double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
   double lats[nlat] = {-75, -45, -15, 15, 45, 75};
   double levs[maxlev] = {101300, 92500, 85000, 50000, 20000};
   double var[nlon*nlat*maxlev];
   int vdate = 19850101, vtime = 120000;
-  int start = CDI_UNDEFID, chunk = CDI_UNDEFID, stop = CDI_UNDEFID;
   char filename[1024];
+  size_t varSize[nVars];
+#if USE_MPI
+  int rank, comm_size;
+  struct var1DDeco {
+    int chunkSize, start;
+    Xt_idxlist partDesc;
+  } varDeco[nVars];
+#endif
 
   gridID = gridCreate ( GRID_LONLAT, nlon*nlat );
   gridDefXsize ( gridID, nlon );
@@ -47,12 +63,36 @@ void modelRun ()
     {
       zaxisID[i] = zaxisCreate ( ZAXIS_PRESSURE, nlev[i] );
       zaxisDefLevels ( zaxisID[i], levs );
+      varSize[i] = nlon * nlat * nlev[i];
     }
   vlistID = vlistCreate ();
 
+#if USE_MPI
+  xmpi ( MPI_Comm_rank ( commModel, &rank ));
+  xmpi ( MPI_Comm_size ( commModel, &comm_size ));
+#endif
   for ( i = 0; i < nVars; i++ )
-    varID[i] = vlistDefVar ( vlistID, gridID, zaxisID[i], TIME_VARIABLE );
-
+    {
+      varID[i] = vlistDefVar ( vlistID, gridID, zaxisID[i], TIME_VARIABLE );
+#ifdef USE_MPI
+      {
+         int start = uniform_partition_start((int [2]){ 0, varSize[i] - 1 },
+                                             comm_size, rank),
+           chunkSize = uniform_partition_start((int [2]){ 0, varSize[i] - 1 },
+                                               comm_size, rank + 1) - start;
+         fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank,
+                 start, chunkSize);
+         Xt_idxlist idxlist
+           = xt_idxstripes_new(&(struct Xt_stripe){ .start = start,
+                 .nstrides = chunkSize, .stride = 1 }, 1);
+         varDeco[i] = (struct var1DDeco){
+           .start = start,
+           .chunkSize = chunkSize,
+           .partDesc = idxlist
+         };
+      }
+#endif
+    }
   taxisID = taxisCreate ( TAXIS_ABSOLUTE );
   vlistDefTaxis ( vlistID, taxisID );
 
@@ -61,11 +101,12 @@ void modelRun ()
   xassert ( streamID >= 0 );
   streamDefVlist ( streamID, vlistID);
 
+#ifdef USE_MPI
   pioEndDef ();
-
+#endif
   for ( tfID = 0; tfID < ntfiles; tfID++ )
     {
-      if ( tfID > 0 )
+      /* if ( tfID > 0 ) */
 	{
 	  streamClose ( streamID );
 	  sprintf ( &filename[0], "%s_%d.grb", name, tfID );
@@ -80,24 +121,42 @@ void modelRun ()
 	  streamDefTimestep ( streamID, tsID );
 	  for ( i = 0; i < nVars; i++ )
 	    {
-	      start = pioInqVarDecoOff   ( vlistID, varID[i] );
-	      chunk = pioInqVarDecoChunk ( vlistID, varID[i] );
-	      stop = start + chunk;
-	      for ( j = start; j < stop; j++ ) var[j] = 2.2;
+#ifdef USE_MPI
+              int start = varDeco[i].start;
+              int chunk = varDeco[i].chunkSize;
+#else
+              int chunk = varSize[i];
+              int start = 0;
+#endif
+	      for (j = 0; j < chunk; ++j) var[j] = 2.2;
+#ifdef USE_MPI
+              streamWriteVarPart(streamID, varID[i], var, nmiss,
+                                 varDeco[i].partDesc);
+#else
 	      streamWriteVar ( streamID, varID[i], &var[start], nmiss );
+#endif
 	      start = CDI_UNDEFID;
 	      chunk = CDI_UNDEFID;
 	    }
-	  pioWriteTimestep ( tsID, vdate, vtime );
+#ifdef USE_MPI
+	  pioWriteTimestep();
+#endif
 	}
     }
+#ifdef USE_MPI
   pioEndTimestepping ();
+#endif
   streamClose ( streamID );
   vlistDestroy ( vlistID );
   taxisDestroy ( taxisID );
   for ( i = 0; i < nVars; i++ )
     zaxisDestroy ( zaxisID[i] );
   gridDestroy ( gridID );
+#ifdef USE_MPI
+  for (int varID = 0; varID < nVars; ++varID)
+    xt_idxlist_delete(varDeco[varID].partDesc);
+  MPI_Barrier(commModel);
+#endif
 }
 
 struct {
@@ -107,26 +166,23 @@ struct {
   { "PIO_MPI", PIO_MPI },
   { "PIO_FPGUARD", PIO_FPGUARD },
   { "PIO_ASYNCH", PIO_ASYNCH },
-  { "PIO_WRITER", PIO_WRITER }
+  { "PIO_WRITER", PIO_WRITER },
+  { "PIO_FPGUARD", PIO_FPGUARD},
 };
 
 
 int main (int argc, char *argv[])
 {
-  enum {
-    nNamespaces = 1 };
-
-  static int hasLocalFile[nNamespaces] = { 0 };
-
+  MPI_Comm commModel = MPI_COMM_NULL;
 #ifdef USE_MPI
-  MPI_Comm commGlob, commModel;
-  int sizeGlob;
-  int rankGlob;
-  int IOMode = PIO_MPI;
+  MPI_Comm commGlob;
+  int sizeGlob, rankGlob, pioNamespace;
+  int IOMode = PIO_WRITER;
   int nProcsIO = 2;
 
   xmpi ( MPI_Init ( &argc, &argv));
-  xmpi ( MPI_Comm_dup ( MPI_COMM_WORLD, &commGlob ));
+  commGlob = MPI_COMM_WORLD;
+  xt_initialize(commGlob);
   xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN ));
   xmpi ( MPI_Comm_size ( commGlob, &sizeGlob ));
   xmpi ( MPI_Comm_rank ( commGlob, &rankGlob ));
@@ -161,18 +217,32 @@ int main (int argc, char *argv[])
       }
   }
 
-  commModel = pioInit_c ( commGlob, nProcsIO, IOMode, nNamespaces, hasLocalFile );
+  commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f);
+  pioNamespaceSetActive(pioNamespace);
 #endif
 
-  modelRun ();
+  modelRun(commModel);
 
 #ifdef USE_MPI
   pioFinalize ();
+  xt_finalize();
   MPI_Finalize ();
 #endif
   return 0;
 }
 
+#ifdef USE_MPI
+static int
+uniform_partition_start(int set_interval[2], int nparts, int part_idx)
+{
+  int part_offset
+    = (((long long)set_interval[1] - (long long)set_interval[0] + 1LL)
+       * (long long)part_idx) / (long long)nparts;
+  int start = set_interval[0] + part_offset;
+  return start;
+}
+#endif
+
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/examples/pio/collectData2003.F90 b/libcdi/examples/pio/collectData2003.F90
index 90d8b4f..111b6bc 100644
--- a/libcdi/examples/pio/collectData2003.F90
+++ b/libcdi/examples/pio/collectData2003.F90
@@ -3,6 +3,10 @@
 #endif
 
 PROGRAM collectdata2003
+#ifdef USE_MPI
+  USE yaxt, ONLY: xt_initialize, xt_finalize, xt_idxlist, xt_idxstripes_new, &
+       xt_idxlist_delete, xt_int_kind, xt_stripe
+#endif
 
   IMPLICIT NONE
 
@@ -10,38 +14,41 @@ PROGRAM collectdata2003
 
 #ifdef USE_MPI
   INCLUDE 'mpif.h'
+
+  INTEGER, PARAMETER :: i4 = SELECTED_INT_KIND(9)
+  INTEGER, PARAMETER :: i8 = SELECTED_INT_KIND(14)
 #endif
 
   ! For parallel IO:
   !  Parameter and variables needed.
   INTEGER, PARAMETER :: nProcsIO     = 3
-  ! INTEGER, PARAMETER :: IOMode       = PIO_NONE                  
-  ! INTEGER, PARAMETER :: IOMode       = PIO_MPI              
-  ! INTEGER, PARAMETER :: IOMode       = PIO_WRITER            
-  ! INTEGER, PARAMETER :: IOMode       = PIO_ASYNCH          
-  INTEGER, PARAMETER :: IOMode       = PIO_FPGUARD 
-  INTEGER, PARAMETER :: nNamespaces  = 1 
-  INTEGER, PARAMETER :: hasLocalFile(nNamespaces) = (/ 0 /)  
+  ! INTEGER, PARAMETER :: IOMode       = PIO_NONE
+  ! INTEGER, PARAMETER :: IOMode       = PIO_MPI
+  ! INTEGER, PARAMETER :: IOMode       = PIO_WRITER
+  ! INTEGER, PARAMETER :: IOMode       = PIO_ASYNCH
+  INTEGER, PARAMETER :: IOMode       = PIO_FPGUARD
 
-  INTEGER ::commGlob, commModel, error
+  INTEGER ::commGlob, commModel, error, pio_namespace
 
   ! Start parallel environment
 #ifdef USE_MPI
   CALL MPI_INIT ( error )
-  CALL MPI_COMM_DUP ( MPI_COMM_WORLD, commGlob, error )
-#endif
+  commGlob = MPI_COMM_WORLD
+  CALL xt_initialize(commGlob)
 
   ! For parallel IO:
   ! Initialize environment.
-  commModel = pioInit ( commGlob, nProcsIO, IOMode, nNamespaces, hasLocalFile )
+  commModel = pioInit(commGlob, nProcsIO, IOMode, pio_namespace, 1.1)
+  CALL pioNamespaceSetActive(pio_namespace)
+#endif
 
   CALL modelrun ( commModel )
 
-  ! For parallel IO: 
+#ifdef USE_MPI
+  ! For parallel IO:
   ! Cleanup environment.
   CALL pioFinalize ()
-
-#ifdef USE_MPI
+  CALL xt_finalize
   CALL MPI_FINALIZE ( error )
 #endif
 
@@ -65,7 +72,15 @@ CONTAINS
     DOUBLE PRECISION :: lons ( nlon ), lats ( nlat ), levs ( nlev )
     DOUBLE PRECISION :: var1 ( nlon * nlat ), var2 ( nlon * nlat * nlev )
     CHARACTER(len=256) :: varname
-    INTEGER :: startID, stopID, chunk
+    INTEGER :: last, start, chunk
+#ifdef USE_MPI
+    INTEGER :: rank, comm_size, ierror
+    TYPE var1ddeco
+      INTEGER :: start, chunksize
+      TYPE(xt_idxlist) :: partdesc
+    END TYPE var1ddeco
+    TYPE(var1ddeco) :: vardeco1, vardeco2
+#endif
 
     lons = (/0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330/)
     lats = (/-75, -45, -15, 15, 45, 75/)
@@ -94,6 +109,22 @@ CONTAINS
     varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARIABLE)
     varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE)
 
+#ifdef USE_MPI
+    CALL mpi_comm_rank(commModel, rank, ierror)
+    IF (ierror /= mpi_success) STOP 1
+    CALL mpi_comm_size(commModel, comm_size, ierror)
+    IF (ierror /= mpi_success) STOP 1
+    start = uniform_partition_start((/ 1, SIZE(var1) /), comm_size, rank + 1)
+    chunk = uniform_partition_start((/ 1, SIZE(var1) /), comm_size, rank + 2) &
+         - start
+    vardeco1 = var1ddeco(start, chunk, &
+         xt_idxstripes_new(xt_stripe(start - 1, chunk, 1)))
+    start = uniform_partition_start((/ 1, SIZE(var2) /), comm_size, rank + 1)
+    chunk = uniform_partition_start((/ 1, SIZE(var2) /), comm_size, rank + 2) &
+         - start
+    vardeco2 = var1ddeco(start, chunk, &
+         xt_idxstripes_new(xt_stripe(start - 1, chunk, 1)))
+#endif
     !     Define the variable names
     varname = 'varname1'
     CALL vlistDefVarName(vlistID, varID1, varname)
@@ -115,51 +146,73 @@ CONTAINS
     !     Assign the variable list to the dataset
     CALL streamDefVlist(streamID, vlistID)
 
-    !     For parallel IO: 
-    !          End definition stage for CDI resources, 
+#ifdef USE_MPI
+    !     For parallel IO:
+    !          End definition stage for CDI resources,
     !          balance load of variables among collecting IO server,
     !          Decompose data on model processes for IO
     !          Transfer resources to the collecting IO server.
-    CALL pioEndDef (); 
-
+    CALL pioEndDef ();
+#endif
     !     Loop over the number of time steps
     DO tsID = 0, nts-1
       CALL taxisDefVdate ( taxisID, vdate + tsID )
       CALL taxisDefVtime ( taxisID, vtime )
       status = streamDefTimestep ( streamID, tsID )
 
-      ! For parallel IO:    
+      ! For parallel IO:
       ! Inquire start index and chunk for IO transposition of var1
-      startID = pioInqVarDecoOff   ( vlistID, varID1 ) + 1
-      chunk   = pioInqVarDecoChunk ( vlistID, varID1 ) - 1
-      stopID = startID + chunk 
+#ifdef USE_MPI
+      start = vardeco1%start
+      last = start + vardeco1%chunksize - 1
+#else
+      start = 1
+      last = SIZE(var1)
+#endif
       ! Init decomposed data for var1
-      DO i = startID, stopID
+      DO i = start, last
         var1(i) = 1.1
       END DO
       ! Write var1
-      CALL streamWriteVar(streamID, varID1, var1 ( startID ), nmiss)
-
-      ! For parallel IO: 
+#ifdef USE_MPI
+      CALL streamwritevarpart(streamID, varID1, var1(start:last), nmiss, &
+           vardeco1%partdesc)
+#else
+      CALL streamWriteVar(streamID, varID1, var1, nmiss)
+#endif
+      ! For parallel IO:
       ! Inquire start index and chunk for IO transposition of var2
-      startID = pioInqVarDecoOff ( vlistID, varID2 ) + 1
-      chunk = pioInqVarDecoChunk ( vlistID, varID2 ) - 1
-      stopID = startID + chunk
+#ifdef USE_MPI
+      start = vardeco2%start
+      last = start + vardeco2%chunksize - 1
+#else
+      start = 1
+      last = SIZE(var2)
+#endif
       ! Init decomposed data for var2
-      DO i = startID, stopID
+      DO i = start, last
         var2(i) = 2.2
       END DO
       ! Write var2
-      CALL streamWriteVar(streamID, varID2, var2 ( startID ), nmiss)
+#ifdef USE_MPI
+      CALL streamwritevarpart(streamID, varID2, var2(start:last), nmiss, &
+           vardeco2%partdesc)
+#else
+      CALL streamWriteVar(streamID, varID2, var2, nmiss)
+#endif
 
-      ! For parallel IO: 
+#ifdef USE_MPI
+      ! For parallel IO:
       ! Start transmission of all data for output in this timestep to IO server.
-      CALL pioWriteTimestep ( tsID, vdate, vtime )
+      CALL pioWriteTimestep
+#endif
     END DO
 
+#ifdef USE_MPI
     ! For parallel IO:
     ! Preparation for local cleanup
     CALL pioEndTimestepping ()
+#endif
 
     !     Close the output stream
     CALL streamClose(streamID)
@@ -170,7 +223,24 @@ CONTAINS
     CALL zaxisDestroy(zaxisID1)
     CALL zaxisDestroy(zaxisID2)
     CALL gridDestroy(gridID)
-
+#ifdef USE_MPI
+    CALL mpi_barrier(commModel, ierror)
+    IF (ierror /= mpi_success) STOP 1
+#endif
   END SUBROUTINE modelrun
 
+#ifdef USE_MPI
+  FUNCTION uniform_partition_start(set_interval, nparts, part_idx) &
+       RESULT(start)
+    INTEGER(i4), INTENT(in) :: nparts
+    INTEGER(i4), INTENT(in) :: set_interval(2)
+    INTEGER(i4), INTENT(in) :: part_idx
+
+    INTEGER(i4) :: start, part_offset
+
+    part_offset = INT((INT(set_interval(2) - set_interval(1) + 1, i8) &
+         &             * INT(part_idx - 1, i8)) / INT(nparts, i8))
+    start = set_interval(1) + part_offset
+  END FUNCTION uniform_partition_start
+#endif
 END PROGRAM collectdata2003
diff --git a/libcdi/examples/pio/collectDataNStreams.c b/libcdi/examples/pio/collectDataNStreams.c
index cbbacb1..a011b28 100644
--- a/libcdi/examples/pio/collectDataNStreams.c
+++ b/libcdi/examples/pio/collectDataNStreams.c
@@ -4,16 +4,18 @@
 
 #ifdef USE_MPI
 #include <mpi.h>
-#include "pio_c_temp.h"
+#else
+typedef int MPI_Comm;
+#define MPI_COMM_NULL 0
 #endif
 
 #include "cdi.h"
 #include "pio_util.h"
 
-void hoursPassingHack ( int * vdate, int * vtime, int hoursPassed )
+static void hoursPassingHack ( int * vdate, int * vtime, int hoursPassed )
 {
   int sum, days, hours, oldDays;
-  
+
   xassert ( hoursPassed % 10000 == 0 );
   sum = * vtime + hoursPassed;
   days = sum / 240000;
@@ -23,8 +25,13 @@ void hoursPassingHack ( int * vdate, int * vtime, int hoursPassed )
   * vtime = hours;
   * vdate = * vdate + days;
 }
- 
-void modelRun ()
+
+#ifdef USE_MPI
+static int
+uniform_partition_start(int set_interval[2], int nparts, int part_idx);
+#endif
+
+static void modelRun(MPI_Comm commModel)
 {
   enum {
     filetype    = FILETYPE_GRB,
@@ -42,19 +49,24 @@ void modelRun ()
 
   static char nameExp[7]           = "example";
   static int asciiA                = 65;
-  char nameStream[8];
   char filename[1024];
 
   int gridID, zaxisID[nStreams][nVars], taxisID;
   int streamID[nStreams], vlistID[nStreams], varID[nStreams][nVars], tsID, tfID = 0;
-  int i, j, k, nmiss = 0, rank;
+  int i, j, nmiss = 0;
   double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
   double lats[nlat] = {-75, -45, -15, 15, 45, 75};
   double levs[MAXNLEV] = {101300, 92500, 85000, 50000, 20000};
-  double var[nlon*nlat*MAXNLEV];
+  double *var;
   int vdate = 19850101, vtime = 120000, hourStep = 20000;
-  int start = CDI_UNDEFID, chunk = CDI_UNDEFID, stop = CDI_UNDEFID;
-
+  size_t varSize[nStreams][nVars];
+#if USE_MPI
+  int rank, comm_size;
+  struct var1DDeco {
+    int chunkSize, start;
+    Xt_idxlist partDesc;
+  } varDeco[nStreams][nVars];
+#endif
   xassert ( nStreams < MAXNSTREAMS );
 
   gridID = gridCreate ( GRID_LONLAT, nlon*nlat );
@@ -74,10 +86,44 @@ void modelRun ()
       vlistID[i] = vlistCreate ();
     }
 
-  for ( i = 0; i < nStreams; i++ )
-    for ( j = 0; j < nVars; j++ )
-      varID[i][j] = vlistDefVar ( vlistID[i], gridID, zaxisID[i][j], TIME_VARIABLE );
-
+#if USE_MPI
+  xmpi ( MPI_Comm_rank ( commModel, &rank ));
+  xmpi ( MPI_Comm_size ( commModel, &comm_size ));
+#endif
+  {
+    int maxChunkSize = 0;
+    for ( i = 0; i < nStreams; i++ )
+      for ( j = 0; j < nVars; j++ )
+      {
+        varID[i][j] = vlistDefVar(vlistID[i], gridID, zaxisID[i][j],
+                                  TIME_VARIABLE );
+        varSize[i][j] = nlon * nlat * nlev[i][j];
+#ifdef USE_MPI
+        {
+          int start = uniform_partition_start((int [2]){ 0, varSize[i][j] - 1 },
+                                              comm_size, rank),
+            chunkSize = uniform_partition_start((int [2]){ 0, varSize[i][j] - 1 },
+                                                comm_size, rank + 1) - start;
+          if (maxChunkSize < chunkSize)
+            maxChunkSize = chunkSize;
+          fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank,
+                  start, chunkSize);
+          Xt_idxlist idxlist
+            = xt_idxstripes_new(&(struct Xt_stripe){ .start = start,
+                  .nstrides = chunkSize, .stride = 1 }, 1);
+          varDeco[i][j] = (struct var1DDeco){
+            .start = start,
+            .chunkSize = chunkSize,
+            .partDesc = idxlist
+          };
+        }
+#else
+        if (maxChunkSize < varSize[i][j])
+          maxChunkSize = varSize[i][j];
+#endif
+      }
+    var = malloc(maxChunkSize * sizeof (var[0]));
+  }
   taxisID = taxisCreate ( TAXIS_ABSOLUTE );
   for ( i = 0; i < nStreams; i++ )
     vlistDefTaxis ( vlistID[i], taxisID );
@@ -91,7 +137,9 @@ void modelRun ()
       streamDefVlist ( streamID[i], vlistID[i]);
     }
 
+#ifdef USE_MPI
   pioEndDef ();
+#endif
 
   for ( tfID = 0; tfID < ntfiles; tfID++ )
     {
@@ -112,25 +160,47 @@ void modelRun ()
           hoursPassingHack ( &vdate, &vtime, hourStep );
 	  taxisDefVdate ( taxisID, vdate );
 	  taxisDefVtime ( taxisID, vtime );
+          /* temporary fix for problem calling streamDefTimestep after
+           * streamWriteVarPart
+           * FIXME: this can be merged with the loop below again once
+           * per-stream RDMA windows are realized */
+          for ( i = 0; i < nStreams; i++ )
+            streamDefTimestep(streamID[i], tsID);
           for ( i = 0; i < nStreams; i++ )
             {
-              streamDefTimestep ( streamID[i], tsID );
               for ( j = 0; j < nVars; j++ )
                 {
-                  start = pioInqVarDecoOff   ( vlistID[i], varID[i][j] );
-                  chunk = pioInqVarDecoChunk ( vlistID[i], varID[i][j] );
-                  stop = start + chunk;
-                  for ( k = start; k < stop; k++ ) var[k] = 2.2;
-                  streamWriteVar ( streamID[i], varID[i][j], &var[start], nmiss );
-                  start = CDI_UNDEFID;
-                  chunk = CDI_UNDEFID;
+#ifdef USE_MPI
+                  int start = varDeco[i][j].start;
+                  int chunk = varDeco[i][j].chunkSize;
+#else
+                  int start = 0, chunk = varSize[i][j];
+#endif
+                  for(int k = 0; k < chunk; k++)
+                    var[k] = 3.3 * (double)(k + start);
+#ifdef USE_MPI
+                  streamWriteVarPart(streamID[i], varID[i][j], var, nmiss,
+                                     varDeco[i][j].partDesc);
+#else
+                  streamWriteVar(streamID[i], varID[i][j], var, nmiss);
+#endif
                 }
             }
-	  pioWriteTimestep ( tsID, vdate, vtime );
+#ifdef USE_MPI
+	  pioWriteTimestep();
+#endif
 	}
+#ifdef USE_MPI
+      MPI_Barrier(commModel);
+#endif
     }
 
+#ifdef USE_MPI
   pioEndTimestepping ();
+  for (int streamID = 0; streamID < nStreams; ++streamID)
+    for (int varID = 0; varID < nVars; ++varID)
+      xt_idxlist_delete(varDeco[streamID][varID].partDesc);
+#endif
 
   for ( i = 0; i < nStreams; i++ )
     {
@@ -142,6 +212,7 @@ void modelRun ()
     for ( j = 0; j < nVars; j++ )
       zaxisDestroy ( zaxisID[i][j] );
   gridDestroy ( gridID );
+  free(var);
   xdebug("%s", "RETURN");
 }
 
@@ -155,18 +226,18 @@ int main (int argc, char *argv[])
     IOModeDef       = PIO_FPGUARD,
     //IOModeDef       = PIO_ASYNCH,
     //IOModeDef       = PIO_WRITER,
-    nNamespaces = 1 };
-
-  static int hasLocalFile[nNamespaces] = { 0 };
+  };
 
+  MPI_Comm commModel = MPI_COMM_NULL;
 #ifdef USE_MPI
-  MPI_Comm commGlob, commModel;
+  MPI_Comm commGlob;
   int sizeGlob;
   int rankGlob;
-  int IOMode, nProcsIO, count;
+  int IOMode, nProcsIO, pioNamespace;
 
   xmpi ( MPI_Init ( &argc, &argv));
-  xmpi ( MPI_Comm_dup ( MPI_COMM_WORLD, &commGlob ));
+  commGlob = MPI_COMM_WORLD;
+  xt_initialize(commGlob);
   xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN ));
   xmpi ( MPI_Comm_size ( commGlob, &sizeGlob ));
   xmpi ( MPI_Comm_rank ( commGlob, &rankGlob ));
@@ -186,14 +257,28 @@ int main (int argc, char *argv[])
       nProcsIO = nProcsIODef;
     }
 
-  commModel = pioInit_c ( commGlob, nProcsIO, IOMode, nNamespaces, hasLocalFile );
+  commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f);
+  pioNamespaceSetActive(pioNamespace);
 #endif
 
-  modelRun ();
+  modelRun(commModel);
 
 #ifdef USE_MPI
   pioFinalize ();
+  xt_finalize();
   MPI_Finalize ();
 #endif
   return 0;
 }
+
+#ifdef USE_MPI
+static int
+uniform_partition_start(int set_interval[2], int nparts, int part_idx)
+{
+  int part_offset
+    = (((long long)set_interval[1] - (long long)set_interval[0] + 1LL)
+       * (long long)part_idx) / (long long)nparts;
+  int start = set_interval[0] + part_offset;
+  return start;
+}
+#endif
diff --git a/libcdi/examples/pio/compareResourcesArray.c b/libcdi/examples/pio/compareResourcesArray.c
index 62aa035..aaf246b 100644
--- a/libcdi/examples/pio/compareResourcesArray.c
+++ b/libcdi/examples/pio/compareResourcesArray.c
@@ -6,33 +6,29 @@
 
 #ifdef USE_MPI
 #include <mpi.h>
+#include <yaxt.h>
 #include "cdi.h"
-#include "pio_c_temp.h"
 #include "pio_util.h"
+#include "resource_handle.h"
+#include "resource_unpack.h"
 
 extern int    reshListCompare      ( int, int );
-extern void   reshPackBufferCreate  ( char **, int *, MPI_Comm );
-extern void   reshPackBufferDestroy ( char ** );
-extern void   rpcUnpackResources    ( char *, int, MPI_Comm );
 extern void   arrayDestroy          ( void );
 
 enum {
   IOMode           = PIO_NONE,
   nProcsIO         = 1,
-  nNamespaces      = 2,
   DOUBLE_PRECISION = 8,
   nlon             = 12,
   nlat             = 6,
   nlev             = 5,
   ntsteps          = 3 };
 
-static int hasLocalFile[nNamespaces] = { 0, 0 };
-
 double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
 double lats[nlat] = {-75, -45, -15, 15, 45, 75};
 double levs[nlev] = {101300, 92500, 85000, 50000, 20000};
 
-int defineGrid ()
+static int defineGrid()
 {
   int gridID = CDI_UNDEFID;
   int mask_vec[nlon*nlat];
@@ -89,7 +85,7 @@ int defineGrid ()
   return gridID;
 }
 
-int defineZaxis ()
+static int defineZaxis ()
 {
   int zaxisID = CDI_UNDEFID;
   double vct[3] = { 3.0, 3.3, 3.6 };
@@ -110,7 +106,7 @@ int defineZaxis ()
   return zaxisID;
 }
 
-int defineTaxis ()
+static int defineTaxis ()
 {
   int taxisID = CDI_UNDEFID;
 
@@ -159,7 +155,8 @@ int defineVlist ( int gridID, int zaxisID, int taxisID )
   return vlistID;
 }
 
-int defineInstitute ()
+static int
+defineInstitute ()
 {
   int instID = CDI_UNDEFID;
 
@@ -168,18 +165,26 @@ int defineInstitute ()
   return instID;
 }
 
-int defineModel ( int instID )
+static void
+defineModel(int instID)
 {
-  int modelID = CDI_UNDEFID;
-
-  modelID = modelDef ( instID, 0, "myModel");
+  modelDef(instID, 0, "myModel");
+}
 
-  return modelID;
+static void
+printResources()
+{
+  FILE *fp = fopen("reshArrayModel.txt", "w");
+  if (!fp)
+    xabort("%s", "could not open file");
+  reshListPrint(fp);
+  fclose(fp);
 }
 
-void modelRun ( MPI_Comm comm )
+
+static void modelRun ( MPI_Comm comm )
 {
-  int gridID, zaxisID, taxisID, instID, modelID, vlistID, streamID;
+  int gridID, zaxisID, taxisID, instID, vlistID, streamID;
 
   char * recvBuffer, * sendBuffer;
   int bufferSize, differ;
@@ -191,26 +196,26 @@ void modelRun ( MPI_Comm comm )
   zaxisID = defineZaxis     ();
   taxisID = defineTaxis     ();
   instID  = defineInstitute ();
-  modelID = defineModel     ( instID );
+  defineModel(instID);
   vlistID = defineVlist     ( gridID, zaxisID, taxisID);
   streamID = streamOpenWrite("example.grb", FILETYPE_GRB);
   if ( streamID < 0 ) xabort ( "Could not open file" );
   defineStream ( streamID, vlistID );
 
-  reshPackBufferCreate ( &sendBuffer, &bufferSize, comm );
-  xmpi ( MPI_Send ( sendBuffer, bufferSize, MPI_PACKED, 0, 0, comm ));  
+  reshPackBufferCreate(&sendBuffer, &bufferSize, &comm);
+  xmpi ( MPI_Send ( sendBuffer, bufferSize, MPI_PACKED, 0, 0, comm ));
   recvBuffer = xmalloc ( bufferSize * sizeof ( char ));
   xmpi ( MPI_Recv ( recvBuffer, bufferSize, MPI_PACKED, 0,
 		    0, comm, &status ));
- 
+
   pioNamespaceSetActive ( 1 );
-  rpcUnpackResources ( recvBuffer, bufferSize, comm );  
-  free ( recvBuffer );  
+  reshUnpackResources(recvBuffer, bufferSize, &comm);
+  free ( recvBuffer );
   reshPackBufferDestroy ( &sendBuffer );
 
   differ = reshListCompare ( 0, 1 );
   printf ( "The resource arrays %s.\n", differ ? "differ" : "are equal" );
-  reshListPrint ( "reshArrayModel" );
+  printResources();
 
   pioNamespaceSetActive ( 0 );
   streamClose(streamID);
@@ -222,11 +227,12 @@ void modelRun ( MPI_Comm comm )
 int main (int argc, char *argv[]) 
 {
 #ifdef USE_MPI
-  int sizeGlob;
+  int sizeGlob, pioNamespace;
   MPI_Comm commGlob, commModel;
 
   MPI_Init(&argc, &argv);           
-  xmpi ( MPI_Comm_dup ( MPI_COMM_WORLD, &commGlob ));
+  commGlob = MPI_COMM_WORLD;
+  xt_initialize(commGlob);
   xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN ));
   xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); 
 
@@ -236,10 +242,12 @@ int main (int argc, char *argv[])
   if ( nProcsIO != 1 )
     xabort ( "bad distribution of tasks on PEs" );
 
-  commModel = pioInit_c ( commGlob, nProcsIO, IOMode, nNamespaces, hasLocalFile );
+  commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f);
+  pioNamespaceSetActive(pioNamespace);
 
   modelRun ( commModel );
 
+  xt_finalize();
   MPI_Finalize (); 
 #else
   printf ( "Use MPI for this testprogram.\n" );
diff --git a/libcdi/interfaces/Makefile.in b/libcdi/interfaces/Makefile.in
index 6477279..e1fc0c3 100644
--- a/libcdi/interfaces/Makefile.in
+++ b/libcdi/interfaces/Makefile.in
@@ -140,6 +140,13 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+BUILD_CXX = @BUILD_CXX@
+BUILD_F77 = @BUILD_F77@
+BUILD_FC = @BUILD_FC@
+BUILD_FCFLAGS = @BUILD_FCFLAGS@
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CDI_F90_INTERFACE_FCFLAGS = @CDI_F90_INTERFACE_FCFLAGS@
@@ -165,6 +172,9 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
 ENABLE_EXTRA = @ENABLE_EXTRA@
 ENABLE_GRIB = @ENABLE_GRIB@
 ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
+ENABLE_NETCDF = @ENABLE_NETCDF@
 ENABLE_PYTHON = @ENABLE_PYTHON@
 ENABLE_RUBY = @ENABLE_RUBY@
 ENABLE_SERVICE = @ENABLE_SERVICE@
@@ -185,6 +195,7 @@ FPP_INCOPT = @FPP_INCOPT@
 GREP = @GREP@
 GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
 GRIB_API_LIBS = @GRIB_API_LIBS@
+HAVE_PARALLEL_NC4 = @HAVE_PARALLEL_NC4@
 HDF5_INCLUDE = @HDF5_INCLUDE@
 HDF5_LIBS = @HDF5_LIBS@
 HDF5_ROOT = @HDF5_ROOT@
@@ -228,6 +239,11 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PPM_CORE_CFLAGS = @PPM_CORE_CFLAGS@
+PPM_CORE_LIBS = @PPM_CORE_LIBS@
 PTHREAD_CC = @PTHREAD_CC@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -247,6 +263,8 @@ THREADS_LIBS = @THREADS_LIBS@
 USER_NAME = @USER_NAME@
 USE_MPI = @USE_MPI@
 VERSION = @VERSION@
+YAXT_CFLAGS = @YAXT_CFLAGS@
+YAXT_LIBS = @YAXT_LIBS@
 ZLIB_INCLUDE = @ZLIB_INCLUDE@
 ZLIB_LIBS = @ZLIB_LIBS@
 abs_builddir = @abs_builddir@
diff --git a/libcdi/interfaces/python/CdiObj.py b/libcdi/interfaces/python/CdiObj.py
index 241d17d..6f1c3bd 100644
--- a/libcdi/interfaces/python/CdiObj.py
+++ b/libcdi/interfaces/python/CdiObj.py
@@ -1,33 +1,12 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 2.0.4
+# Version 1.3.31
 #
-# Do not make changes to this file unless you know what you are doing--modify
-# the SWIG interface file instead.
-
-
+# Don't modify this file, modify the SWIG interface instead.
+# This file is compatible with both classic and new-style classes.
 
-from sys import version_info
-if version_info >= (2,6,0):
-    def swig_import_helper():
-        from os.path import dirname
-        import imp
-        fp = None
-        try:
-            fp, pathname, description = imp.find_module('_CdiObj', [dirname(__file__)])
-        except ImportError:
-            import _CdiObj
-            return _CdiObj
-        if fp is not None:
-            try:
-                _mod = imp.load_module('_CdiObj', fp, pathname, description)
-            finally:
-                fp.close()
-            return _mod
-    _CdiObj = swig_import_helper()
-    del swig_import_helper
-else:
-    import _CdiObj
-del version_info
+import _CdiObj
+import new
+new_instancemethod = new.instancemethod
 try:
     _swig_property = property
 except NameError:
@@ -35,12 +14,12 @@ except NameError:
 def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
     if (name == "thisown"): return self.this.own(value)
     if (name == "this"):
-        if type(value).__name__ == 'SwigPyObject':
+        if type(value).__name__ == 'PySwigObject':
             self.__dict__[name] = value
             return
     method = class_type.__swig_setmethods__.get(name,None)
     if method: return method(self,value)
-    if (not static):
+    if (not static) or hasattr(self,name):
         self.__dict__[name] = value
     else:
         raise AttributeError("You cannot add attributes to %s" % self)
@@ -52,49 +31,50 @@ def _swig_getattr(self,class_type,name):
     if (name == "thisown"): return self.this.own()
     method = class_type.__swig_getmethods__.get(name,None)
     if method: return method(self)
-    raise AttributeError(name)
+    raise AttributeError,name
 
 def _swig_repr(self):
     try: strthis = "proxy of " + self.this.__repr__()
     except: strthis = ""
     return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
 
+import types
 try:
-    _object = object
+    _object = types.ObjectType
     _newclass = 1
 except AttributeError:
     class _object : pass
     _newclass = 0
+del types
 
 
-class SwigPyIterator(_object):
+class PySwigIterator(_object):
     __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, SwigPyIterator, name, value)
+    __setattr__ = lambda self, name, value: _swig_setattr(self, PySwigIterator, name, value)
     __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, SwigPyIterator, name)
-    def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
+    __getattr__ = lambda self, name: _swig_getattr(self, PySwigIterator, name)
+    def __init__(self): raise AttributeError, "No constructor defined"
     __repr__ = _swig_repr
-    __swig_destroy__ = _CdiObj.delete_SwigPyIterator
+    __swig_destroy__ = _CdiObj.delete_PySwigIterator
     __del__ = lambda self : None;
-    def value(self): return _CdiObj.SwigPyIterator_value(self)
-    def incr(self, n = 1): return _CdiObj.SwigPyIterator_incr(self, n)
-    def decr(self, n = 1): return _CdiObj.SwigPyIterator_decr(self, n)
-    def distance(self, *args): return _CdiObj.SwigPyIterator_distance(self, *args)
-    def equal(self, *args): return _CdiObj.SwigPyIterator_equal(self, *args)
-    def copy(self): return _CdiObj.SwigPyIterator_copy(self)
-    def next(self): return _CdiObj.SwigPyIterator_next(self)
-    def __next__(self): return _CdiObj.SwigPyIterator___next__(self)
-    def previous(self): return _CdiObj.SwigPyIterator_previous(self)
-    def advance(self, *args): return _CdiObj.SwigPyIterator_advance(self, *args)
-    def __eq__(self, *args): return _CdiObj.SwigPyIterator___eq__(self, *args)
-    def __ne__(self, *args): return _CdiObj.SwigPyIterator___ne__(self, *args)
-    def __iadd__(self, *args): return _CdiObj.SwigPyIterator___iadd__(self, *args)
-    def __isub__(self, *args): return _CdiObj.SwigPyIterator___isub__(self, *args)
-    def __add__(self, *args): return _CdiObj.SwigPyIterator___add__(self, *args)
-    def __sub__(self, *args): return _CdiObj.SwigPyIterator___sub__(self, *args)
+    def value(*args): return _CdiObj.PySwigIterator_value(*args)
+    def incr(*args): return _CdiObj.PySwigIterator_incr(*args)
+    def decr(*args): return _CdiObj.PySwigIterator_decr(*args)
+    def distance(*args): return _CdiObj.PySwigIterator_distance(*args)
+    def equal(*args): return _CdiObj.PySwigIterator_equal(*args)
+    def copy(*args): return _CdiObj.PySwigIterator_copy(*args)
+    def next(*args): return _CdiObj.PySwigIterator_next(*args)
+    def previous(*args): return _CdiObj.PySwigIterator_previous(*args)
+    def advance(*args): return _CdiObj.PySwigIterator_advance(*args)
+    def __eq__(*args): return _CdiObj.PySwigIterator___eq__(*args)
+    def __ne__(*args): return _CdiObj.PySwigIterator___ne__(*args)
+    def __iadd__(*args): return _CdiObj.PySwigIterator___iadd__(*args)
+    def __isub__(*args): return _CdiObj.PySwigIterator___isub__(*args)
+    def __add__(*args): return _CdiObj.PySwigIterator___add__(*args)
+    def __sub__(*args): return _CdiObj.PySwigIterator___sub__(*args)
     def __iter__(self): return self
-SwigPyIterator_swigregister = _CdiObj.SwigPyIterator_swigregister
-SwigPyIterator_swigregister(SwigPyIterator)
+PySwigIterator_swigregister = _CdiObj.PySwigIterator_swigregister
+PySwigIterator_swigregister(PySwigIterator)
 
 class IntVector(_object):
     __swig_setmethods__ = {}
@@ -102,42 +82,41 @@ class IntVector(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, IntVector, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.IntVector_iterator(self)
+    def iterator(*args): return _CdiObj.IntVector_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.IntVector___nonzero__(self)
-    def __bool__(self): return _CdiObj.IntVector___bool__(self)
-    def __len__(self): return _CdiObj.IntVector___len__(self)
-    def pop(self): return _CdiObj.IntVector_pop(self)
-    def __getslice__(self, *args): return _CdiObj.IntVector___getslice__(self, *args)
-    def __setslice__(self, *args): return _CdiObj.IntVector___setslice__(self, *args)
-    def __delslice__(self, *args): return _CdiObj.IntVector___delslice__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.IntVector___delitem__(self, *args)
-    def __getitem__(self, *args): return _CdiObj.IntVector___getitem__(self, *args)
-    def __setitem__(self, *args): return _CdiObj.IntVector___setitem__(self, *args)
-    def append(self, *args): return _CdiObj.IntVector_append(self, *args)
-    def empty(self): return _CdiObj.IntVector_empty(self)
-    def size(self): return _CdiObj.IntVector_size(self)
-    def clear(self): return _CdiObj.IntVector_clear(self)
-    def swap(self, *args): return _CdiObj.IntVector_swap(self, *args)
-    def get_allocator(self): return _CdiObj.IntVector_get_allocator(self)
-    def begin(self): return _CdiObj.IntVector_begin(self)
-    def end(self): return _CdiObj.IntVector_end(self)
-    def rbegin(self): return _CdiObj.IntVector_rbegin(self)
-    def rend(self): return _CdiObj.IntVector_rend(self)
-    def pop_back(self): return _CdiObj.IntVector_pop_back(self)
-    def erase(self, *args): return _CdiObj.IntVector_erase(self, *args)
+    def __nonzero__(*args): return _CdiObj.IntVector___nonzero__(*args)
+    def __len__(*args): return _CdiObj.IntVector___len__(*args)
+    def pop(*args): return _CdiObj.IntVector_pop(*args)
+    def __getslice__(*args): return _CdiObj.IntVector___getslice__(*args)
+    def __setslice__(*args): return _CdiObj.IntVector___setslice__(*args)
+    def __delslice__(*args): return _CdiObj.IntVector___delslice__(*args)
+    def __delitem__(*args): return _CdiObj.IntVector___delitem__(*args)
+    def __getitem__(*args): return _CdiObj.IntVector___getitem__(*args)
+    def __setitem__(*args): return _CdiObj.IntVector___setitem__(*args)
+    def append(*args): return _CdiObj.IntVector_append(*args)
+    def empty(*args): return _CdiObj.IntVector_empty(*args)
+    def size(*args): return _CdiObj.IntVector_size(*args)
+    def clear(*args): return _CdiObj.IntVector_clear(*args)
+    def swap(*args): return _CdiObj.IntVector_swap(*args)
+    def get_allocator(*args): return _CdiObj.IntVector_get_allocator(*args)
+    def begin(*args): return _CdiObj.IntVector_begin(*args)
+    def end(*args): return _CdiObj.IntVector_end(*args)
+    def rbegin(*args): return _CdiObj.IntVector_rbegin(*args)
+    def rend(*args): return _CdiObj.IntVector_rend(*args)
+    def pop_back(*args): return _CdiObj.IntVector_pop_back(*args)
+    def erase(*args): return _CdiObj.IntVector_erase(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_IntVector(*args)
         try: self.this.append(this)
         except: self.this = this
-    def push_back(self, *args): return _CdiObj.IntVector_push_back(self, *args)
-    def front(self): return _CdiObj.IntVector_front(self)
-    def back(self): return _CdiObj.IntVector_back(self)
-    def assign(self, *args): return _CdiObj.IntVector_assign(self, *args)
-    def resize(self, *args): return _CdiObj.IntVector_resize(self, *args)
-    def insert(self, *args): return _CdiObj.IntVector_insert(self, *args)
-    def reserve(self, *args): return _CdiObj.IntVector_reserve(self, *args)
-    def capacity(self): return _CdiObj.IntVector_capacity(self)
+    def push_back(*args): return _CdiObj.IntVector_push_back(*args)
+    def front(*args): return _CdiObj.IntVector_front(*args)
+    def back(*args): return _CdiObj.IntVector_back(*args)
+    def assign(*args): return _CdiObj.IntVector_assign(*args)
+    def resize(*args): return _CdiObj.IntVector_resize(*args)
+    def insert(*args): return _CdiObj.IntVector_insert(*args)
+    def reserve(*args): return _CdiObj.IntVector_reserve(*args)
+    def capacity(*args): return _CdiObj.IntVector_capacity(*args)
     __swig_destroy__ = _CdiObj.delete_IntVector
     __del__ = lambda self : None;
 IntVector_swigregister = _CdiObj.IntVector_swigregister
@@ -149,42 +128,41 @@ class DoubleVector(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, DoubleVector, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.DoubleVector_iterator(self)
+    def iterator(*args): return _CdiObj.DoubleVector_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.DoubleVector___nonzero__(self)
-    def __bool__(self): return _CdiObj.DoubleVector___bool__(self)
-    def __len__(self): return _CdiObj.DoubleVector___len__(self)
-    def pop(self): return _CdiObj.DoubleVector_pop(self)
-    def __getslice__(self, *args): return _CdiObj.DoubleVector___getslice__(self, *args)
-    def __setslice__(self, *args): return _CdiObj.DoubleVector___setslice__(self, *args)
-    def __delslice__(self, *args): return _CdiObj.DoubleVector___delslice__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.DoubleVector___delitem__(self, *args)
-    def __getitem__(self, *args): return _CdiObj.DoubleVector___getitem__(self, *args)
-    def __setitem__(self, *args): return _CdiObj.DoubleVector___setitem__(self, *args)
-    def append(self, *args): return _CdiObj.DoubleVector_append(self, *args)
-    def empty(self): return _CdiObj.DoubleVector_empty(self)
-    def size(self): return _CdiObj.DoubleVector_size(self)
-    def clear(self): return _CdiObj.DoubleVector_clear(self)
-    def swap(self, *args): return _CdiObj.DoubleVector_swap(self, *args)
-    def get_allocator(self): return _CdiObj.DoubleVector_get_allocator(self)
-    def begin(self): return _CdiObj.DoubleVector_begin(self)
-    def end(self): return _CdiObj.DoubleVector_end(self)
-    def rbegin(self): return _CdiObj.DoubleVector_rbegin(self)
-    def rend(self): return _CdiObj.DoubleVector_rend(self)
-    def pop_back(self): return _CdiObj.DoubleVector_pop_back(self)
-    def erase(self, *args): return _CdiObj.DoubleVector_erase(self, *args)
+    def __nonzero__(*args): return _CdiObj.DoubleVector___nonzero__(*args)
+    def __len__(*args): return _CdiObj.DoubleVector___len__(*args)
+    def pop(*args): return _CdiObj.DoubleVector_pop(*args)
+    def __getslice__(*args): return _CdiObj.DoubleVector___getslice__(*args)
+    def __setslice__(*args): return _CdiObj.DoubleVector___setslice__(*args)
+    def __delslice__(*args): return _CdiObj.DoubleVector___delslice__(*args)
+    def __delitem__(*args): return _CdiObj.DoubleVector___delitem__(*args)
+    def __getitem__(*args): return _CdiObj.DoubleVector___getitem__(*args)
+    def __setitem__(*args): return _CdiObj.DoubleVector___setitem__(*args)
+    def append(*args): return _CdiObj.DoubleVector_append(*args)
+    def empty(*args): return _CdiObj.DoubleVector_empty(*args)
+    def size(*args): return _CdiObj.DoubleVector_size(*args)
+    def clear(*args): return _CdiObj.DoubleVector_clear(*args)
+    def swap(*args): return _CdiObj.DoubleVector_swap(*args)
+    def get_allocator(*args): return _CdiObj.DoubleVector_get_allocator(*args)
+    def begin(*args): return _CdiObj.DoubleVector_begin(*args)
+    def end(*args): return _CdiObj.DoubleVector_end(*args)
+    def rbegin(*args): return _CdiObj.DoubleVector_rbegin(*args)
+    def rend(*args): return _CdiObj.DoubleVector_rend(*args)
+    def pop_back(*args): return _CdiObj.DoubleVector_pop_back(*args)
+    def erase(*args): return _CdiObj.DoubleVector_erase(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_DoubleVector(*args)
         try: self.this.append(this)
         except: self.this = this
-    def push_back(self, *args): return _CdiObj.DoubleVector_push_back(self, *args)
-    def front(self): return _CdiObj.DoubleVector_front(self)
-    def back(self): return _CdiObj.DoubleVector_back(self)
-    def assign(self, *args): return _CdiObj.DoubleVector_assign(self, *args)
-    def resize(self, *args): return _CdiObj.DoubleVector_resize(self, *args)
-    def insert(self, *args): return _CdiObj.DoubleVector_insert(self, *args)
-    def reserve(self, *args): return _CdiObj.DoubleVector_reserve(self, *args)
-    def capacity(self): return _CdiObj.DoubleVector_capacity(self)
+    def push_back(*args): return _CdiObj.DoubleVector_push_back(*args)
+    def front(*args): return _CdiObj.DoubleVector_front(*args)
+    def back(*args): return _CdiObj.DoubleVector_back(*args)
+    def assign(*args): return _CdiObj.DoubleVector_assign(*args)
+    def resize(*args): return _CdiObj.DoubleVector_resize(*args)
+    def insert(*args): return _CdiObj.DoubleVector_insert(*args)
+    def reserve(*args): return _CdiObj.DoubleVector_reserve(*args)
+    def capacity(*args): return _CdiObj.DoubleVector_capacity(*args)
     __swig_destroy__ = _CdiObj.delete_DoubleVector
     __del__ = lambda self : None;
 DoubleVector_swigregister = _CdiObj.DoubleVector_swigregister
@@ -196,42 +174,41 @@ class DoubleDoubleVector(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, DoubleDoubleVector, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.DoubleDoubleVector_iterator(self)
+    def iterator(*args): return _CdiObj.DoubleDoubleVector_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.DoubleDoubleVector___nonzero__(self)
-    def __bool__(self): return _CdiObj.DoubleDoubleVector___bool__(self)
-    def __len__(self): return _CdiObj.DoubleDoubleVector___len__(self)
-    def pop(self): return _CdiObj.DoubleDoubleVector_pop(self)
-    def __getslice__(self, *args): return _CdiObj.DoubleDoubleVector___getslice__(self, *args)
-    def __setslice__(self, *args): return _CdiObj.DoubleDoubleVector___setslice__(self, *args)
-    def __delslice__(self, *args): return _CdiObj.DoubleDoubleVector___delslice__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.DoubleDoubleVector___delitem__(self, *args)
-    def __getitem__(self, *args): return _CdiObj.DoubleDoubleVector___getitem__(self, *args)
-    def __setitem__(self, *args): return _CdiObj.DoubleDoubleVector___setitem__(self, *args)
-    def append(self, *args): return _CdiObj.DoubleDoubleVector_append(self, *args)
-    def empty(self): return _CdiObj.DoubleDoubleVector_empty(self)
-    def size(self): return _CdiObj.DoubleDoubleVector_size(self)
-    def clear(self): return _CdiObj.DoubleDoubleVector_clear(self)
-    def swap(self, *args): return _CdiObj.DoubleDoubleVector_swap(self, *args)
-    def get_allocator(self): return _CdiObj.DoubleDoubleVector_get_allocator(self)
-    def begin(self): return _CdiObj.DoubleDoubleVector_begin(self)
-    def end(self): return _CdiObj.DoubleDoubleVector_end(self)
-    def rbegin(self): return _CdiObj.DoubleDoubleVector_rbegin(self)
-    def rend(self): return _CdiObj.DoubleDoubleVector_rend(self)
-    def pop_back(self): return _CdiObj.DoubleDoubleVector_pop_back(self)
-    def erase(self, *args): return _CdiObj.DoubleDoubleVector_erase(self, *args)
+    def __nonzero__(*args): return _CdiObj.DoubleDoubleVector___nonzero__(*args)
+    def __len__(*args): return _CdiObj.DoubleDoubleVector___len__(*args)
+    def pop(*args): return _CdiObj.DoubleDoubleVector_pop(*args)
+    def __getslice__(*args): return _CdiObj.DoubleDoubleVector___getslice__(*args)
+    def __setslice__(*args): return _CdiObj.DoubleDoubleVector___setslice__(*args)
+    def __delslice__(*args): return _CdiObj.DoubleDoubleVector___delslice__(*args)
+    def __delitem__(*args): return _CdiObj.DoubleDoubleVector___delitem__(*args)
+    def __getitem__(*args): return _CdiObj.DoubleDoubleVector___getitem__(*args)
+    def __setitem__(*args): return _CdiObj.DoubleDoubleVector___setitem__(*args)
+    def append(*args): return _CdiObj.DoubleDoubleVector_append(*args)
+    def empty(*args): return _CdiObj.DoubleDoubleVector_empty(*args)
+    def size(*args): return _CdiObj.DoubleDoubleVector_size(*args)
+    def clear(*args): return _CdiObj.DoubleDoubleVector_clear(*args)
+    def swap(*args): return _CdiObj.DoubleDoubleVector_swap(*args)
+    def get_allocator(*args): return _CdiObj.DoubleDoubleVector_get_allocator(*args)
+    def begin(*args): return _CdiObj.DoubleDoubleVector_begin(*args)
+    def end(*args): return _CdiObj.DoubleDoubleVector_end(*args)
+    def rbegin(*args): return _CdiObj.DoubleDoubleVector_rbegin(*args)
+    def rend(*args): return _CdiObj.DoubleDoubleVector_rend(*args)
+    def pop_back(*args): return _CdiObj.DoubleDoubleVector_pop_back(*args)
+    def erase(*args): return _CdiObj.DoubleDoubleVector_erase(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_DoubleDoubleVector(*args)
         try: self.this.append(this)
         except: self.this = this
-    def push_back(self, *args): return _CdiObj.DoubleDoubleVector_push_back(self, *args)
-    def front(self): return _CdiObj.DoubleDoubleVector_front(self)
-    def back(self): return _CdiObj.DoubleDoubleVector_back(self)
-    def assign(self, *args): return _CdiObj.DoubleDoubleVector_assign(self, *args)
-    def resize(self, *args): return _CdiObj.DoubleDoubleVector_resize(self, *args)
-    def insert(self, *args): return _CdiObj.DoubleDoubleVector_insert(self, *args)
-    def reserve(self, *args): return _CdiObj.DoubleDoubleVector_reserve(self, *args)
-    def capacity(self): return _CdiObj.DoubleDoubleVector_capacity(self)
+    def push_back(*args): return _CdiObj.DoubleDoubleVector_push_back(*args)
+    def front(*args): return _CdiObj.DoubleDoubleVector_front(*args)
+    def back(*args): return _CdiObj.DoubleDoubleVector_back(*args)
+    def assign(*args): return _CdiObj.DoubleDoubleVector_assign(*args)
+    def resize(*args): return _CdiObj.DoubleDoubleVector_resize(*args)
+    def insert(*args): return _CdiObj.DoubleDoubleVector_insert(*args)
+    def reserve(*args): return _CdiObj.DoubleDoubleVector_reserve(*args)
+    def capacity(*args): return _CdiObj.DoubleDoubleVector_capacity(*args)
     __swig_destroy__ = _CdiObj.delete_DoubleDoubleVector
     __del__ = lambda self : None;
 DoubleDoubleVector_swigregister = _CdiObj.DoubleDoubleVector_swigregister
@@ -243,42 +220,41 @@ class StringVector(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, StringVector, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.StringVector_iterator(self)
+    def iterator(*args): return _CdiObj.StringVector_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.StringVector___nonzero__(self)
-    def __bool__(self): return _CdiObj.StringVector___bool__(self)
-    def __len__(self): return _CdiObj.StringVector___len__(self)
-    def pop(self): return _CdiObj.StringVector_pop(self)
-    def __getslice__(self, *args): return _CdiObj.StringVector___getslice__(self, *args)
-    def __setslice__(self, *args): return _CdiObj.StringVector___setslice__(self, *args)
-    def __delslice__(self, *args): return _CdiObj.StringVector___delslice__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.StringVector___delitem__(self, *args)
-    def __getitem__(self, *args): return _CdiObj.StringVector___getitem__(self, *args)
-    def __setitem__(self, *args): return _CdiObj.StringVector___setitem__(self, *args)
-    def append(self, *args): return _CdiObj.StringVector_append(self, *args)
-    def empty(self): return _CdiObj.StringVector_empty(self)
-    def size(self): return _CdiObj.StringVector_size(self)
-    def clear(self): return _CdiObj.StringVector_clear(self)
-    def swap(self, *args): return _CdiObj.StringVector_swap(self, *args)
-    def get_allocator(self): return _CdiObj.StringVector_get_allocator(self)
-    def begin(self): return _CdiObj.StringVector_begin(self)
-    def end(self): return _CdiObj.StringVector_end(self)
-    def rbegin(self): return _CdiObj.StringVector_rbegin(self)
-    def rend(self): return _CdiObj.StringVector_rend(self)
-    def pop_back(self): return _CdiObj.StringVector_pop_back(self)
-    def erase(self, *args): return _CdiObj.StringVector_erase(self, *args)
+    def __nonzero__(*args): return _CdiObj.StringVector___nonzero__(*args)
+    def __len__(*args): return _CdiObj.StringVector___len__(*args)
+    def pop(*args): return _CdiObj.StringVector_pop(*args)
+    def __getslice__(*args): return _CdiObj.StringVector___getslice__(*args)
+    def __setslice__(*args): return _CdiObj.StringVector___setslice__(*args)
+    def __delslice__(*args): return _CdiObj.StringVector___delslice__(*args)
+    def __delitem__(*args): return _CdiObj.StringVector___delitem__(*args)
+    def __getitem__(*args): return _CdiObj.StringVector___getitem__(*args)
+    def __setitem__(*args): return _CdiObj.StringVector___setitem__(*args)
+    def append(*args): return _CdiObj.StringVector_append(*args)
+    def empty(*args): return _CdiObj.StringVector_empty(*args)
+    def size(*args): return _CdiObj.StringVector_size(*args)
+    def clear(*args): return _CdiObj.StringVector_clear(*args)
+    def swap(*args): return _CdiObj.StringVector_swap(*args)
+    def get_allocator(*args): return _CdiObj.StringVector_get_allocator(*args)
+    def begin(*args): return _CdiObj.StringVector_begin(*args)
+    def end(*args): return _CdiObj.StringVector_end(*args)
+    def rbegin(*args): return _CdiObj.StringVector_rbegin(*args)
+    def rend(*args): return _CdiObj.StringVector_rend(*args)
+    def pop_back(*args): return _CdiObj.StringVector_pop_back(*args)
+    def erase(*args): return _CdiObj.StringVector_erase(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_StringVector(*args)
         try: self.this.append(this)
         except: self.this = this
-    def push_back(self, *args): return _CdiObj.StringVector_push_back(self, *args)
-    def front(self): return _CdiObj.StringVector_front(self)
-    def back(self): return _CdiObj.StringVector_back(self)
-    def assign(self, *args): return _CdiObj.StringVector_assign(self, *args)
-    def resize(self, *args): return _CdiObj.StringVector_resize(self, *args)
-    def insert(self, *args): return _CdiObj.StringVector_insert(self, *args)
-    def reserve(self, *args): return _CdiObj.StringVector_reserve(self, *args)
-    def capacity(self): return _CdiObj.StringVector_capacity(self)
+    def push_back(*args): return _CdiObj.StringVector_push_back(*args)
+    def front(*args): return _CdiObj.StringVector_front(*args)
+    def back(*args): return _CdiObj.StringVector_back(*args)
+    def assign(*args): return _CdiObj.StringVector_assign(*args)
+    def resize(*args): return _CdiObj.StringVector_resize(*args)
+    def insert(*args): return _CdiObj.StringVector_insert(*args)
+    def reserve(*args): return _CdiObj.StringVector_reserve(*args)
+    def capacity(*args): return _CdiObj.StringVector_capacity(*args)
     __swig_destroy__ = _CdiObj.delete_StringVector
     __del__ = lambda self : None;
 StringVector_swigregister = _CdiObj.StringVector_swigregister
@@ -290,42 +266,41 @@ class VarsVector(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, VarsVector, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.VarsVector_iterator(self)
+    def iterator(*args): return _CdiObj.VarsVector_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.VarsVector___nonzero__(self)
-    def __bool__(self): return _CdiObj.VarsVector___bool__(self)
-    def __len__(self): return _CdiObj.VarsVector___len__(self)
-    def pop(self): return _CdiObj.VarsVector_pop(self)
-    def __getslice__(self, *args): return _CdiObj.VarsVector___getslice__(self, *args)
-    def __setslice__(self, *args): return _CdiObj.VarsVector___setslice__(self, *args)
-    def __delslice__(self, *args): return _CdiObj.VarsVector___delslice__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.VarsVector___delitem__(self, *args)
-    def __getitem__(self, *args): return _CdiObj.VarsVector___getitem__(self, *args)
-    def __setitem__(self, *args): return _CdiObj.VarsVector___setitem__(self, *args)
-    def append(self, *args): return _CdiObj.VarsVector_append(self, *args)
-    def empty(self): return _CdiObj.VarsVector_empty(self)
-    def size(self): return _CdiObj.VarsVector_size(self)
-    def clear(self): return _CdiObj.VarsVector_clear(self)
-    def swap(self, *args): return _CdiObj.VarsVector_swap(self, *args)
-    def get_allocator(self): return _CdiObj.VarsVector_get_allocator(self)
-    def begin(self): return _CdiObj.VarsVector_begin(self)
-    def end(self): return _CdiObj.VarsVector_end(self)
-    def rbegin(self): return _CdiObj.VarsVector_rbegin(self)
-    def rend(self): return _CdiObj.VarsVector_rend(self)
-    def pop_back(self): return _CdiObj.VarsVector_pop_back(self)
-    def erase(self, *args): return _CdiObj.VarsVector_erase(self, *args)
+    def __nonzero__(*args): return _CdiObj.VarsVector___nonzero__(*args)
+    def __len__(*args): return _CdiObj.VarsVector___len__(*args)
+    def pop(*args): return _CdiObj.VarsVector_pop(*args)
+    def __getslice__(*args): return _CdiObj.VarsVector___getslice__(*args)
+    def __setslice__(*args): return _CdiObj.VarsVector___setslice__(*args)
+    def __delslice__(*args): return _CdiObj.VarsVector___delslice__(*args)
+    def __delitem__(*args): return _CdiObj.VarsVector___delitem__(*args)
+    def __getitem__(*args): return _CdiObj.VarsVector___getitem__(*args)
+    def __setitem__(*args): return _CdiObj.VarsVector___setitem__(*args)
+    def append(*args): return _CdiObj.VarsVector_append(*args)
+    def empty(*args): return _CdiObj.VarsVector_empty(*args)
+    def size(*args): return _CdiObj.VarsVector_size(*args)
+    def clear(*args): return _CdiObj.VarsVector_clear(*args)
+    def swap(*args): return _CdiObj.VarsVector_swap(*args)
+    def get_allocator(*args): return _CdiObj.VarsVector_get_allocator(*args)
+    def begin(*args): return _CdiObj.VarsVector_begin(*args)
+    def end(*args): return _CdiObj.VarsVector_end(*args)
+    def rbegin(*args): return _CdiObj.VarsVector_rbegin(*args)
+    def rend(*args): return _CdiObj.VarsVector_rend(*args)
+    def pop_back(*args): return _CdiObj.VarsVector_pop_back(*args)
+    def erase(*args): return _CdiObj.VarsVector_erase(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_VarsVector(*args)
         try: self.this.append(this)
         except: self.this = this
-    def push_back(self, *args): return _CdiObj.VarsVector_push_back(self, *args)
-    def front(self): return _CdiObj.VarsVector_front(self)
-    def back(self): return _CdiObj.VarsVector_back(self)
-    def assign(self, *args): return _CdiObj.VarsVector_assign(self, *args)
-    def resize(self, *args): return _CdiObj.VarsVector_resize(self, *args)
-    def insert(self, *args): return _CdiObj.VarsVector_insert(self, *args)
-    def reserve(self, *args): return _CdiObj.VarsVector_reserve(self, *args)
-    def capacity(self): return _CdiObj.VarsVector_capacity(self)
+    def push_back(*args): return _CdiObj.VarsVector_push_back(*args)
+    def front(*args): return _CdiObj.VarsVector_front(*args)
+    def back(*args): return _CdiObj.VarsVector_back(*args)
+    def assign(*args): return _CdiObj.VarsVector_assign(*args)
+    def resize(*args): return _CdiObj.VarsVector_resize(*args)
+    def insert(*args): return _CdiObj.VarsVector_insert(*args)
+    def reserve(*args): return _CdiObj.VarsVector_reserve(*args)
+    def capacity(*args): return _CdiObj.VarsVector_capacity(*args)
     __swig_destroy__ = _CdiObj.delete_VarsVector
     __del__ = lambda self : None;
 VarsVector_swigregister = _CdiObj.VarsVector_swigregister
@@ -337,44 +312,42 @@ class VarsMap(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, VarsMap, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.VarsMap_iterator(self)
+    def iterator(*args): return _CdiObj.VarsMap_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.VarsMap___nonzero__(self)
-    def __bool__(self): return _CdiObj.VarsMap___bool__(self)
-    def __len__(self): return _CdiObj.VarsMap___len__(self)
+    def __nonzero__(*args): return _CdiObj.VarsMap___nonzero__(*args)
+    def __len__(*args): return _CdiObj.VarsMap___len__(*args)
+    def __getitem__(*args): return _CdiObj.VarsMap___getitem__(*args)
+    def __delitem__(*args): return _CdiObj.VarsMap___delitem__(*args)
+    def has_key(*args): return _CdiObj.VarsMap_has_key(*args)
+    def keys(*args): return _CdiObj.VarsMap_keys(*args)
+    def values(*args): return _CdiObj.VarsMap_values(*args)
+    def items(*args): return _CdiObj.VarsMap_items(*args)
+    def __contains__(*args): return _CdiObj.VarsMap___contains__(*args)
+    def key_iterator(*args): return _CdiObj.VarsMap_key_iterator(*args)
+    def value_iterator(*args): return _CdiObj.VarsMap_value_iterator(*args)
     def __iter__(self): return self.key_iterator()
     def iterkeys(self): return self.key_iterator()
     def itervalues(self): return self.value_iterator()
     def iteritems(self): return self.iterator()
-    def __getitem__(self, *args): return _CdiObj.VarsMap___getitem__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.VarsMap___delitem__(self, *args)
-    def has_key(self, *args): return _CdiObj.VarsMap_has_key(self, *args)
-    def keys(self): return _CdiObj.VarsMap_keys(self)
-    def values(self): return _CdiObj.VarsMap_values(self)
-    def items(self): return _CdiObj.VarsMap_items(self)
-    def __contains__(self, *args): return _CdiObj.VarsMap___contains__(self, *args)
-    def key_iterator(self): return _CdiObj.VarsMap_key_iterator(self)
-    def value_iterator(self): return _CdiObj.VarsMap_value_iterator(self)
-    def __setitem__(self, *args): return _CdiObj.VarsMap___setitem__(self, *args)
-    def asdict(self): return _CdiObj.VarsMap_asdict(self)
+    def __setitem__(*args): return _CdiObj.VarsMap___setitem__(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_VarsMap(*args)
         try: self.this.append(this)
         except: self.this = this
-    def empty(self): return _CdiObj.VarsMap_empty(self)
-    def size(self): return _CdiObj.VarsMap_size(self)
-    def clear(self): return _CdiObj.VarsMap_clear(self)
-    def swap(self, *args): return _CdiObj.VarsMap_swap(self, *args)
-    def get_allocator(self): return _CdiObj.VarsMap_get_allocator(self)
-    def begin(self): return _CdiObj.VarsMap_begin(self)
-    def end(self): return _CdiObj.VarsMap_end(self)
-    def rbegin(self): return _CdiObj.VarsMap_rbegin(self)
-    def rend(self): return _CdiObj.VarsMap_rend(self)
-    def count(self, *args): return _CdiObj.VarsMap_count(self, *args)
-    def erase(self, *args): return _CdiObj.VarsMap_erase(self, *args)
-    def find(self, *args): return _CdiObj.VarsMap_find(self, *args)
-    def lower_bound(self, *args): return _CdiObj.VarsMap_lower_bound(self, *args)
-    def upper_bound(self, *args): return _CdiObj.VarsMap_upper_bound(self, *args)
+    def empty(*args): return _CdiObj.VarsMap_empty(*args)
+    def size(*args): return _CdiObj.VarsMap_size(*args)
+    def clear(*args): return _CdiObj.VarsMap_clear(*args)
+    def swap(*args): return _CdiObj.VarsMap_swap(*args)
+    def get_allocator(*args): return _CdiObj.VarsMap_get_allocator(*args)
+    def begin(*args): return _CdiObj.VarsMap_begin(*args)
+    def end(*args): return _CdiObj.VarsMap_end(*args)
+    def rbegin(*args): return _CdiObj.VarsMap_rbegin(*args)
+    def rend(*args): return _CdiObj.VarsMap_rend(*args)
+    def count(*args): return _CdiObj.VarsMap_count(*args)
+    def erase(*args): return _CdiObj.VarsMap_erase(*args)
+    def find(*args): return _CdiObj.VarsMap_find(*args)
+    def lower_bound(*args): return _CdiObj.VarsMap_lower_bound(*args)
+    def upper_bound(*args): return _CdiObj.VarsMap_upper_bound(*args)
     __swig_destroy__ = _CdiObj.delete_VarsMap
     __del__ = lambda self : None;
 VarsMap_swigregister = _CdiObj.VarsMap_swigregister
@@ -386,44 +359,42 @@ class VarsByCode(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, VarsByCode, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.VarsByCode_iterator(self)
+    def iterator(*args): return _CdiObj.VarsByCode_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.VarsByCode___nonzero__(self)
-    def __bool__(self): return _CdiObj.VarsByCode___bool__(self)
-    def __len__(self): return _CdiObj.VarsByCode___len__(self)
+    def __nonzero__(*args): return _CdiObj.VarsByCode___nonzero__(*args)
+    def __len__(*args): return _CdiObj.VarsByCode___len__(*args)
+    def __getitem__(*args): return _CdiObj.VarsByCode___getitem__(*args)
+    def __delitem__(*args): return _CdiObj.VarsByCode___delitem__(*args)
+    def has_key(*args): return _CdiObj.VarsByCode_has_key(*args)
+    def keys(*args): return _CdiObj.VarsByCode_keys(*args)
+    def values(*args): return _CdiObj.VarsByCode_values(*args)
+    def items(*args): return _CdiObj.VarsByCode_items(*args)
+    def __contains__(*args): return _CdiObj.VarsByCode___contains__(*args)
+    def key_iterator(*args): return _CdiObj.VarsByCode_key_iterator(*args)
+    def value_iterator(*args): return _CdiObj.VarsByCode_value_iterator(*args)
     def __iter__(self): return self.key_iterator()
     def iterkeys(self): return self.key_iterator()
     def itervalues(self): return self.value_iterator()
     def iteritems(self): return self.iterator()
-    def __getitem__(self, *args): return _CdiObj.VarsByCode___getitem__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.VarsByCode___delitem__(self, *args)
-    def has_key(self, *args): return _CdiObj.VarsByCode_has_key(self, *args)
-    def keys(self): return _CdiObj.VarsByCode_keys(self)
-    def values(self): return _CdiObj.VarsByCode_values(self)
-    def items(self): return _CdiObj.VarsByCode_items(self)
-    def __contains__(self, *args): return _CdiObj.VarsByCode___contains__(self, *args)
-    def key_iterator(self): return _CdiObj.VarsByCode_key_iterator(self)
-    def value_iterator(self): return _CdiObj.VarsByCode_value_iterator(self)
-    def __setitem__(self, *args): return _CdiObj.VarsByCode___setitem__(self, *args)
-    def asdict(self): return _CdiObj.VarsByCode_asdict(self)
+    def __setitem__(*args): return _CdiObj.VarsByCode___setitem__(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_VarsByCode(*args)
         try: self.this.append(this)
         except: self.this = this
-    def empty(self): return _CdiObj.VarsByCode_empty(self)
-    def size(self): return _CdiObj.VarsByCode_size(self)
-    def clear(self): return _CdiObj.VarsByCode_clear(self)
-    def swap(self, *args): return _CdiObj.VarsByCode_swap(self, *args)
-    def get_allocator(self): return _CdiObj.VarsByCode_get_allocator(self)
-    def begin(self): return _CdiObj.VarsByCode_begin(self)
-    def end(self): return _CdiObj.VarsByCode_end(self)
-    def rbegin(self): return _CdiObj.VarsByCode_rbegin(self)
-    def rend(self): return _CdiObj.VarsByCode_rend(self)
-    def count(self, *args): return _CdiObj.VarsByCode_count(self, *args)
-    def erase(self, *args): return _CdiObj.VarsByCode_erase(self, *args)
-    def find(self, *args): return _CdiObj.VarsByCode_find(self, *args)
-    def lower_bound(self, *args): return _CdiObj.VarsByCode_lower_bound(self, *args)
-    def upper_bound(self, *args): return _CdiObj.VarsByCode_upper_bound(self, *args)
+    def empty(*args): return _CdiObj.VarsByCode_empty(*args)
+    def size(*args): return _CdiObj.VarsByCode_size(*args)
+    def clear(*args): return _CdiObj.VarsByCode_clear(*args)
+    def swap(*args): return _CdiObj.VarsByCode_swap(*args)
+    def get_allocator(*args): return _CdiObj.VarsByCode_get_allocator(*args)
+    def begin(*args): return _CdiObj.VarsByCode_begin(*args)
+    def end(*args): return _CdiObj.VarsByCode_end(*args)
+    def rbegin(*args): return _CdiObj.VarsByCode_rbegin(*args)
+    def rend(*args): return _CdiObj.VarsByCode_rend(*args)
+    def count(*args): return _CdiObj.VarsByCode_count(*args)
+    def erase(*args): return _CdiObj.VarsByCode_erase(*args)
+    def find(*args): return _CdiObj.VarsByCode_find(*args)
+    def lower_bound(*args): return _CdiObj.VarsByCode_lower_bound(*args)
+    def upper_bound(*args): return _CdiObj.VarsByCode_upper_bound(*args)
     __swig_destroy__ = _CdiObj.delete_VarsByCode
     __del__ = lambda self : None;
 VarsByCode_swigregister = _CdiObj.VarsByCode_swigregister
@@ -435,44 +406,42 @@ class TaxesMap(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, TaxesMap, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.TaxesMap_iterator(self)
+    def iterator(*args): return _CdiObj.TaxesMap_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.TaxesMap___nonzero__(self)
-    def __bool__(self): return _CdiObj.TaxesMap___bool__(self)
-    def __len__(self): return _CdiObj.TaxesMap___len__(self)
+    def __nonzero__(*args): return _CdiObj.TaxesMap___nonzero__(*args)
+    def __len__(*args): return _CdiObj.TaxesMap___len__(*args)
+    def __getitem__(*args): return _CdiObj.TaxesMap___getitem__(*args)
+    def __delitem__(*args): return _CdiObj.TaxesMap___delitem__(*args)
+    def has_key(*args): return _CdiObj.TaxesMap_has_key(*args)
+    def keys(*args): return _CdiObj.TaxesMap_keys(*args)
+    def values(*args): return _CdiObj.TaxesMap_values(*args)
+    def items(*args): return _CdiObj.TaxesMap_items(*args)
+    def __contains__(*args): return _CdiObj.TaxesMap___contains__(*args)
+    def key_iterator(*args): return _CdiObj.TaxesMap_key_iterator(*args)
+    def value_iterator(*args): return _CdiObj.TaxesMap_value_iterator(*args)
     def __iter__(self): return self.key_iterator()
     def iterkeys(self): return self.key_iterator()
     def itervalues(self): return self.value_iterator()
     def iteritems(self): return self.iterator()
-    def __getitem__(self, *args): return _CdiObj.TaxesMap___getitem__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.TaxesMap___delitem__(self, *args)
-    def has_key(self, *args): return _CdiObj.TaxesMap_has_key(self, *args)
-    def keys(self): return _CdiObj.TaxesMap_keys(self)
-    def values(self): return _CdiObj.TaxesMap_values(self)
-    def items(self): return _CdiObj.TaxesMap_items(self)
-    def __contains__(self, *args): return _CdiObj.TaxesMap___contains__(self, *args)
-    def key_iterator(self): return _CdiObj.TaxesMap_key_iterator(self)
-    def value_iterator(self): return _CdiObj.TaxesMap_value_iterator(self)
-    def __setitem__(self, *args): return _CdiObj.TaxesMap___setitem__(self, *args)
-    def asdict(self): return _CdiObj.TaxesMap_asdict(self)
+    def __setitem__(*args): return _CdiObj.TaxesMap___setitem__(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_TaxesMap(*args)
         try: self.this.append(this)
         except: self.this = this
-    def empty(self): return _CdiObj.TaxesMap_empty(self)
-    def size(self): return _CdiObj.TaxesMap_size(self)
-    def clear(self): return _CdiObj.TaxesMap_clear(self)
-    def swap(self, *args): return _CdiObj.TaxesMap_swap(self, *args)
-    def get_allocator(self): return _CdiObj.TaxesMap_get_allocator(self)
-    def begin(self): return _CdiObj.TaxesMap_begin(self)
-    def end(self): return _CdiObj.TaxesMap_end(self)
-    def rbegin(self): return _CdiObj.TaxesMap_rbegin(self)
-    def rend(self): return _CdiObj.TaxesMap_rend(self)
-    def count(self, *args): return _CdiObj.TaxesMap_count(self, *args)
-    def erase(self, *args): return _CdiObj.TaxesMap_erase(self, *args)
-    def find(self, *args): return _CdiObj.TaxesMap_find(self, *args)
-    def lower_bound(self, *args): return _CdiObj.TaxesMap_lower_bound(self, *args)
-    def upper_bound(self, *args): return _CdiObj.TaxesMap_upper_bound(self, *args)
+    def empty(*args): return _CdiObj.TaxesMap_empty(*args)
+    def size(*args): return _CdiObj.TaxesMap_size(*args)
+    def clear(*args): return _CdiObj.TaxesMap_clear(*args)
+    def swap(*args): return _CdiObj.TaxesMap_swap(*args)
+    def get_allocator(*args): return _CdiObj.TaxesMap_get_allocator(*args)
+    def begin(*args): return _CdiObj.TaxesMap_begin(*args)
+    def end(*args): return _CdiObj.TaxesMap_end(*args)
+    def rbegin(*args): return _CdiObj.TaxesMap_rbegin(*args)
+    def rend(*args): return _CdiObj.TaxesMap_rend(*args)
+    def count(*args): return _CdiObj.TaxesMap_count(*args)
+    def erase(*args): return _CdiObj.TaxesMap_erase(*args)
+    def find(*args): return _CdiObj.TaxesMap_find(*args)
+    def lower_bound(*args): return _CdiObj.TaxesMap_lower_bound(*args)
+    def upper_bound(*args): return _CdiObj.TaxesMap_upper_bound(*args)
     __swig_destroy__ = _CdiObj.delete_TaxesMap
     __del__ = lambda self : None;
 TaxesMap_swigregister = _CdiObj.TaxesMap_swigregister
@@ -484,44 +453,42 @@ class ZaxesMap(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, ZaxesMap, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.ZaxesMap_iterator(self)
+    def iterator(*args): return _CdiObj.ZaxesMap_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.ZaxesMap___nonzero__(self)
-    def __bool__(self): return _CdiObj.ZaxesMap___bool__(self)
-    def __len__(self): return _CdiObj.ZaxesMap___len__(self)
+    def __nonzero__(*args): return _CdiObj.ZaxesMap___nonzero__(*args)
+    def __len__(*args): return _CdiObj.ZaxesMap___len__(*args)
+    def __getitem__(*args): return _CdiObj.ZaxesMap___getitem__(*args)
+    def __delitem__(*args): return _CdiObj.ZaxesMap___delitem__(*args)
+    def has_key(*args): return _CdiObj.ZaxesMap_has_key(*args)
+    def keys(*args): return _CdiObj.ZaxesMap_keys(*args)
+    def values(*args): return _CdiObj.ZaxesMap_values(*args)
+    def items(*args): return _CdiObj.ZaxesMap_items(*args)
+    def __contains__(*args): return _CdiObj.ZaxesMap___contains__(*args)
+    def key_iterator(*args): return _CdiObj.ZaxesMap_key_iterator(*args)
+    def value_iterator(*args): return _CdiObj.ZaxesMap_value_iterator(*args)
     def __iter__(self): return self.key_iterator()
     def iterkeys(self): return self.key_iterator()
     def itervalues(self): return self.value_iterator()
     def iteritems(self): return self.iterator()
-    def __getitem__(self, *args): return _CdiObj.ZaxesMap___getitem__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.ZaxesMap___delitem__(self, *args)
-    def has_key(self, *args): return _CdiObj.ZaxesMap_has_key(self, *args)
-    def keys(self): return _CdiObj.ZaxesMap_keys(self)
-    def values(self): return _CdiObj.ZaxesMap_values(self)
-    def items(self): return _CdiObj.ZaxesMap_items(self)
-    def __contains__(self, *args): return _CdiObj.ZaxesMap___contains__(self, *args)
-    def key_iterator(self): return _CdiObj.ZaxesMap_key_iterator(self)
-    def value_iterator(self): return _CdiObj.ZaxesMap_value_iterator(self)
-    def __setitem__(self, *args): return _CdiObj.ZaxesMap___setitem__(self, *args)
-    def asdict(self): return _CdiObj.ZaxesMap_asdict(self)
+    def __setitem__(*args): return _CdiObj.ZaxesMap___setitem__(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_ZaxesMap(*args)
         try: self.this.append(this)
         except: self.this = this
-    def empty(self): return _CdiObj.ZaxesMap_empty(self)
-    def size(self): return _CdiObj.ZaxesMap_size(self)
-    def clear(self): return _CdiObj.ZaxesMap_clear(self)
-    def swap(self, *args): return _CdiObj.ZaxesMap_swap(self, *args)
-    def get_allocator(self): return _CdiObj.ZaxesMap_get_allocator(self)
-    def begin(self): return _CdiObj.ZaxesMap_begin(self)
-    def end(self): return _CdiObj.ZaxesMap_end(self)
-    def rbegin(self): return _CdiObj.ZaxesMap_rbegin(self)
-    def rend(self): return _CdiObj.ZaxesMap_rend(self)
-    def count(self, *args): return _CdiObj.ZaxesMap_count(self, *args)
-    def erase(self, *args): return _CdiObj.ZaxesMap_erase(self, *args)
-    def find(self, *args): return _CdiObj.ZaxesMap_find(self, *args)
-    def lower_bound(self, *args): return _CdiObj.ZaxesMap_lower_bound(self, *args)
-    def upper_bound(self, *args): return _CdiObj.ZaxesMap_upper_bound(self, *args)
+    def empty(*args): return _CdiObj.ZaxesMap_empty(*args)
+    def size(*args): return _CdiObj.ZaxesMap_size(*args)
+    def clear(*args): return _CdiObj.ZaxesMap_clear(*args)
+    def swap(*args): return _CdiObj.ZaxesMap_swap(*args)
+    def get_allocator(*args): return _CdiObj.ZaxesMap_get_allocator(*args)
+    def begin(*args): return _CdiObj.ZaxesMap_begin(*args)
+    def end(*args): return _CdiObj.ZaxesMap_end(*args)
+    def rbegin(*args): return _CdiObj.ZaxesMap_rbegin(*args)
+    def rend(*args): return _CdiObj.ZaxesMap_rend(*args)
+    def count(*args): return _CdiObj.ZaxesMap_count(*args)
+    def erase(*args): return _CdiObj.ZaxesMap_erase(*args)
+    def find(*args): return _CdiObj.ZaxesMap_find(*args)
+    def lower_bound(*args): return _CdiObj.ZaxesMap_lower_bound(*args)
+    def upper_bound(*args): return _CdiObj.ZaxesMap_upper_bound(*args)
     __swig_destroy__ = _CdiObj.delete_ZaxesMap
     __del__ = lambda self : None;
 ZaxesMap_swigregister = _CdiObj.ZaxesMap_swigregister
@@ -533,44 +500,42 @@ class GridsMap(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GridsMap, name)
     __repr__ = _swig_repr
-    def iterator(self): return _CdiObj.GridsMap_iterator(self)
+    def iterator(*args): return _CdiObj.GridsMap_iterator(*args)
     def __iter__(self): return self.iterator()
-    def __nonzero__(self): return _CdiObj.GridsMap___nonzero__(self)
-    def __bool__(self): return _CdiObj.GridsMap___bool__(self)
-    def __len__(self): return _CdiObj.GridsMap___len__(self)
+    def __nonzero__(*args): return _CdiObj.GridsMap___nonzero__(*args)
+    def __len__(*args): return _CdiObj.GridsMap___len__(*args)
+    def __getitem__(*args): return _CdiObj.GridsMap___getitem__(*args)
+    def __delitem__(*args): return _CdiObj.GridsMap___delitem__(*args)
+    def has_key(*args): return _CdiObj.GridsMap_has_key(*args)
+    def keys(*args): return _CdiObj.GridsMap_keys(*args)
+    def values(*args): return _CdiObj.GridsMap_values(*args)
+    def items(*args): return _CdiObj.GridsMap_items(*args)
+    def __contains__(*args): return _CdiObj.GridsMap___contains__(*args)
+    def key_iterator(*args): return _CdiObj.GridsMap_key_iterator(*args)
+    def value_iterator(*args): return _CdiObj.GridsMap_value_iterator(*args)
     def __iter__(self): return self.key_iterator()
     def iterkeys(self): return self.key_iterator()
     def itervalues(self): return self.value_iterator()
     def iteritems(self): return self.iterator()
-    def __getitem__(self, *args): return _CdiObj.GridsMap___getitem__(self, *args)
-    def __delitem__(self, *args): return _CdiObj.GridsMap___delitem__(self, *args)
-    def has_key(self, *args): return _CdiObj.GridsMap_has_key(self, *args)
-    def keys(self): return _CdiObj.GridsMap_keys(self)
-    def values(self): return _CdiObj.GridsMap_values(self)
-    def items(self): return _CdiObj.GridsMap_items(self)
-    def __contains__(self, *args): return _CdiObj.GridsMap___contains__(self, *args)
-    def key_iterator(self): return _CdiObj.GridsMap_key_iterator(self)
-    def value_iterator(self): return _CdiObj.GridsMap_value_iterator(self)
-    def __setitem__(self, *args): return _CdiObj.GridsMap___setitem__(self, *args)
-    def asdict(self): return _CdiObj.GridsMap_asdict(self)
+    def __setitem__(*args): return _CdiObj.GridsMap___setitem__(*args)
     def __init__(self, *args): 
         this = _CdiObj.new_GridsMap(*args)
         try: self.this.append(this)
         except: self.this = this
-    def empty(self): return _CdiObj.GridsMap_empty(self)
-    def size(self): return _CdiObj.GridsMap_size(self)
-    def clear(self): return _CdiObj.GridsMap_clear(self)
-    def swap(self, *args): return _CdiObj.GridsMap_swap(self, *args)
-    def get_allocator(self): return _CdiObj.GridsMap_get_allocator(self)
-    def begin(self): return _CdiObj.GridsMap_begin(self)
-    def end(self): return _CdiObj.GridsMap_end(self)
-    def rbegin(self): return _CdiObj.GridsMap_rbegin(self)
-    def rend(self): return _CdiObj.GridsMap_rend(self)
-    def count(self, *args): return _CdiObj.GridsMap_count(self, *args)
-    def erase(self, *args): return _CdiObj.GridsMap_erase(self, *args)
-    def find(self, *args): return _CdiObj.GridsMap_find(self, *args)
-    def lower_bound(self, *args): return _CdiObj.GridsMap_lower_bound(self, *args)
-    def upper_bound(self, *args): return _CdiObj.GridsMap_upper_bound(self, *args)
+    def empty(*args): return _CdiObj.GridsMap_empty(*args)
+    def size(*args): return _CdiObj.GridsMap_size(*args)
+    def clear(*args): return _CdiObj.GridsMap_clear(*args)
+    def swap(*args): return _CdiObj.GridsMap_swap(*args)
+    def get_allocator(*args): return _CdiObj.GridsMap_get_allocator(*args)
+    def begin(*args): return _CdiObj.GridsMap_begin(*args)
+    def end(*args): return _CdiObj.GridsMap_end(*args)
+    def rbegin(*args): return _CdiObj.GridsMap_rbegin(*args)
+    def rend(*args): return _CdiObj.GridsMap_rend(*args)
+    def count(*args): return _CdiObj.GridsMap_count(*args)
+    def erase(*args): return _CdiObj.GridsMap_erase(*args)
+    def find(*args): return _CdiObj.GridsMap_find(*args)
+    def lower_bound(*args): return _CdiObj.GridsMap_lower_bound(*args)
+    def upper_bound(*args): return _CdiObj.GridsMap_upper_bound(*args)
     __swig_destroy__ = _CdiObj.delete_GridsMap
     __del__ = lambda self : None;
 GridsMap_swigregister = _CdiObj.GridsMap_swigregister
@@ -658,12 +623,12 @@ class CdiGrid(_object):
     __swig_setmethods__["name"] = _CdiObj.CdiGrid_name_set
     __swig_getmethods__["name"] = _CdiObj.CdiGrid_name_get
     if _newclass:name = _swig_property(_CdiObj.CdiGrid_name_get, _CdiObj.CdiGrid_name_set)
-    def getValues(self): return _CdiObj.CdiGrid_getValues(self)
-    def getBounds(self): return _CdiObj.CdiGrid_getBounds(self)
-    def getValuesAsPointer(self, *args): return _CdiObj.CdiGrid_getValuesAsPointer(self, *args)
-    def getBoundsAsPointer(self, *args): return _CdiObj.CdiGrid_getBoundsAsPointer(self, *args)
-    def getFloatVals(self, *args): return _CdiObj.CdiGrid_getFloatVals(self, *args)
-    def getFloatBounds(self, *args): return _CdiObj.CdiGrid_getFloatBounds(self, *args)
+    def getValues(*args): return _CdiObj.CdiGrid_getValues(*args)
+    def getBounds(*args): return _CdiObj.CdiGrid_getBounds(*args)
+    def getValuesAsPointer(*args): return _CdiObj.CdiGrid_getValuesAsPointer(*args)
+    def getBoundsAsPointer(*args): return _CdiObj.CdiGrid_getBoundsAsPointer(*args)
+    def getFloatVals(*args): return _CdiObj.CdiGrid_getFloatVals(*args)
+    def getFloatBounds(*args): return _CdiObj.CdiGrid_getFloatBounds(*args)
 CdiGrid_swigregister = _CdiObj.CdiGrid_swigregister
 CdiGrid_swigregister(CdiGrid)
 
@@ -853,13 +818,13 @@ class CdiVariable(_object):
     __swig_setmethods__["taxis"] = _CdiObj.CdiVariable_taxis_set
     __swig_getmethods__["taxis"] = _CdiObj.CdiVariable_taxis_get
     if _newclass:taxis = _swig_property(_CdiObj.CdiVariable_taxis_get, _CdiObj.CdiVariable_taxis_set)
-    def sinfo(self): return _CdiObj.CdiVariable_sinfo(self)
-    def getValues(self): return _CdiObj.CdiVariable_getValues(self)
-    def getValuesWithLevel(self, tsID = 0): return _CdiObj.CdiVariable_getValuesWithLevel(self, tsID)
-    def getFValues(self): return _CdiObj.CdiVariable_getFValues(self)
-    def getFValuesWithLevel(self, tsID = 0): return _CdiObj.CdiVariable_getFValuesWithLevel(self, tsID)
-    def getValuesAsPointer(self): return _CdiObj.CdiVariable_getValuesAsPointer(self)
-    def getValuesWithLevelAsPointer(self, tsID = 0): return _CdiObj.CdiVariable_getValuesWithLevelAsPointer(self, tsID)
+    def sinfo(*args): return _CdiObj.CdiVariable_sinfo(*args)
+    def getValues(*args): return _CdiObj.CdiVariable_getValues(*args)
+    def getValuesWithLevel(*args): return _CdiObj.CdiVariable_getValuesWithLevel(*args)
+    def getFValues(*args): return _CdiObj.CdiVariable_getFValues(*args)
+    def getFValuesWithLevel(*args): return _CdiObj.CdiVariable_getFValuesWithLevel(*args)
+    def getValuesAsPointer(*args): return _CdiObj.CdiVariable_getValuesAsPointer(*args)
+    def getValuesWithLevelAsPointer(*args): return _CdiObj.CdiVariable_getValuesWithLevelAsPointer(*args)
 CdiVariable_swigregister = _CdiObj.CdiVariable_swigregister
 CdiVariable_swigregister(CdiVariable)
 
@@ -920,10 +885,9 @@ class Cdi(_object):
     __swig_setmethods__["grids"] = _CdiObj.Cdi_grids_set
     __swig_getmethods__["grids"] = _CdiObj.Cdi_grids_get
     if _newclass:grids = _swig_property(_CdiObj.Cdi_grids_get, _CdiObj.Cdi_grids_set)
-    def griddes(self): return _CdiObj.Cdi_griddes(self)
+    def griddes(*args): return _CdiObj.Cdi_griddes(*args)
 Cdi_swigregister = _CdiObj.Cdi_swigregister
 Cdi_swigregister(Cdi)
 
-# This file is compatible with both classic and new-style classes.
 
 
diff --git a/libcdi/interfaces/python/cdiobj_wrap.cpp b/libcdi/interfaces/python/cdiobj_wrap.cpp
index f6df6c9..726bb4b 100644
--- a/libcdi/interfaces/python/cdiobj_wrap.cpp
+++ b/libcdi/interfaces/python/cdiobj_wrap.cpp
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.4
+ * Version 1.3.31
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -11,28 +11,20 @@
 #define SWIGPYTHON
 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
 
-
 #ifdef __cplusplus
-/* SwigValueWrapper is described in swig.swg */
-template<typename T> class SwigValueWrapper {
-  struct SwigMovePointer {
-    T *ptr;
-    SwigMovePointer(T *p) : ptr(p) { }
-    ~SwigMovePointer() { delete ptr; }
-    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
-  } pointer;
-  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
-  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+template<class T> class SwigValueWrapper {
+    T *tt;
 public:
-  SwigValueWrapper() : pointer(0) { }
-  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
-  operator T&() const { return *pointer.ptr; }
-  T *operator&() { return pointer.ptr; }
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
 };
-
-template <typename T> T SwigValueInit() {
-  return T();
-}
 #endif
 
 /* -----------------------------------------------------------------------------
@@ -42,14 +34,14 @@ template <typename T> T SwigValueInit() {
 
 /* template workaround for compilers that cannot correctly implement the C++ standard */
 #ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-#  define SWIGTEMPLATEDISAMBIGUATOR template
+# if defined(__SUNPRO_CC)
+#   if (__SUNPRO_CC <= 0x560)
+#     define SWIGTEMPLATEDISAMBIGUATOR template
+#   else
+#     define SWIGTEMPLATEDISAMBIGUATOR 
+#   endif
 # else
-#  define SWIGTEMPLATEDISAMBIGUATOR
+#   define SWIGTEMPLATEDISAMBIGUATOR 
 # endif
 #endif
 
@@ -77,12 +69,6 @@ template <typename T> T SwigValueInit() {
 # endif
 #endif
 
-#ifndef SWIG_MSC_UNSUPPRESS_4505
-# if defined(_MSC_VER)
-#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
-#endif
-
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
@@ -138,12 +124,6 @@ template <typename T> T SwigValueInit() {
 # define _CRT_SECURE_NO_DEPRECATE
 #endif
 
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
 
 /* Python.h has to appear first */
 #include <Python.h>
@@ -151,13 +131,13 @@ template <typename T> T SwigValueInit() {
 /* -----------------------------------------------------------------------------
  * swigrun.swg
  *
- * This file contains generic C API SWIG runtime support for pointer
+ * This file contains generic CAPI SWIG runtime support for pointer
  * type checking.
  * ----------------------------------------------------------------------------- */
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "4"
+#define SWIG_RUNTIME_VERSION "3"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
@@ -170,11 +150,11 @@ template <typename T> T SwigValueInit() {
 
 /*
   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
-  creating a static or dynamic library from the SWIG runtime code.
-  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
   
-  But only do this if strictly necessary, ie, if you have problems
-  with your compiler or suchlike.
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
 */
 
 #ifndef SWIGRUNTIME
@@ -192,7 +172,6 @@ template <typename T> T SwigValueInit() {
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
-#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -201,14 +180,14 @@ template <typename T> T SwigValueInit() {
 /* 
    Flags/methods for returning states.
    
-   The SWIG conversion methods, as ConvertPtr, return an integer 
+   The swig conversion methods, as ConvertPtr, return and integer 
    that tells if the conversion was successful or not. And if not,
    an error code can be returned (see swigerrors.swg for the codes).
    
    Use the following macros/flags to set or process the returning
    states.
    
-   In old versions of SWIG, code such as the following was usually written:
+   In old swig versions, you usually write code as:
 
      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
        // success code
@@ -216,7 +195,7 @@ template <typename T> T SwigValueInit() {
        //fail code
      }
 
-   Now you can be more explicit:
+   Now you can be more explicit as:
 
     int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
     if (SWIG_IsOK(res)) {
@@ -225,7 +204,7 @@ template <typename T> T SwigValueInit() {
       // fail code
     }
 
-   which is the same really, but now you can also do
+   that seems to be the same, but now you can also do
 
     Type *ptr;
     int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
@@ -243,7 +222,7 @@ template <typename T> T SwigValueInit() {
     
    I.e., now SWIG_ConvertPtr can return new objects and you can
    identify the case and take care of the deallocation. Of course that
-   also requires SWIG_ConvertPtr to return new result values, such as
+   requires also to SWIG_ConvertPtr to return new result values, as
 
       int SWIG_ConvertPtr(obj, ptr,...) {         
         if (<obj is ok>) {			       
@@ -261,7 +240,7 @@ template <typename T> T SwigValueInit() {
 
    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
    more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
-   SWIG errors code.
+   swig errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
    allows to return the 'cast rank', for example, if you have this
@@ -275,8 +254,9 @@ template <typename T> T SwigValueInit() {
       fooi(1)   // cast rank '0'
 
    just use the SWIG_AddCast()/SWIG_CheckState()
-*/
 
+
+ */
 #define SWIG_OK                    (0) 
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
@@ -301,6 +281,7 @@ template <typename T> T SwigValueInit() {
 #define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
 #define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
 
+
 /* Cast-Rank Mode */
 #if defined(SWIG_CASTRANK_MODE)
 #  ifndef SWIG_TypeRank
@@ -323,16 +304,18 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 #endif
 
 
+
+
 #include <string.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *, int *);
+typedef void *(*swig_converter_func)(void *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store information on one type */
+/* Structure to store inforomation on one type */
 typedef struct swig_type_info {
   const char             *name;			/* mangled name of this type */
   const char             *str;			/* human readable name of this type */
@@ -377,7 +360,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
     while ((*f2 == ' ') && (f2 != l2)) ++f2;
     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
   }
-  return (int)((l1 - f1) - (l2 - f2));
+  return (l1 - f1) - (l2 - f2);
 }
 
 /*
@@ -419,66 +402,48 @@ SWIG_TypeCompare(const char *nb, const char *tb) {
 }
 
 
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
 /*
   Check the typename
 */
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
-  if (ty) {
-    swig_cast_info *iter = ty->cast;
-    while (iter) {
-      if (strcmp(iter->type->name, c) == 0) {
-        if (iter == ty->cast)
-          return iter;
-        /* Move iter to the top of the linked list */
-        iter->prev->next = iter->next;
-        if (iter->next)
-          iter->next->prev = iter->prev;
-        iter->next = ty->cast;
-        iter->prev = 0;
-        if (ty->cast) ty->cast->prev = iter;
-        ty->cast = iter;
-        return iter;
-      }
-      iter = iter->next;
-    }
-  }
-  return 0;
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
 }
 
-/* 
-  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
-*/
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
 SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
-  if (ty) {
-    swig_cast_info *iter = ty->cast;
-    while (iter) {
-      if (iter->type == from) {
-        if (iter == ty->cast)
-          return iter;
-        /* Move iter to the top of the linked list */
-        iter->prev->next = iter->next;
-        if (iter->next)
-          iter->next->prev = iter->prev;
-        iter->next = ty->cast;
-        iter->prev = 0;
-        if (ty->cast) ty->cast->prev = iter;
-        ty->cast = iter;
-        return iter;
-      }
-      iter = iter->next;
-    }
-  }
-  return 0;
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
 }
 
 /*
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
 }
 
 /* 
@@ -749,75 +714,6 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 
 
 
-/* Compatibility macros for Python 3 */
-#if PY_VERSION_HEX >= 0x03000000
-
-#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
-#define PyInt_Check(x) PyLong_Check(x)
-#define PyInt_AsLong(x) PyLong_AsLong(x)
-#define PyInt_FromLong(x) PyLong_FromLong(x)
-#define PyString_Check(name) PyBytes_Check(name)
-#define PyString_FromString(x) PyUnicode_FromString(x)
-#define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
-#define PyString_AsString(str) PyBytes_AsString(str)
-#define PyString_Size(str) PyBytes_Size(str)	
-#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
-#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
-#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
-#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
-
-#endif
-
-#ifndef Py_TYPE
-#  define Py_TYPE(op) ((op)->ob_type)
-#endif
-
-/* SWIG APIs for compatibility of both Python 2 & 3 */
-
-#if PY_VERSION_HEX >= 0x03000000
-#  define SWIG_Python_str_FromFormat PyUnicode_FromFormat
-#else
-#  define SWIG_Python_str_FromFormat PyString_FromFormat
-#endif
-
-
-/* Warning: This function will allocate a new string in Python 3,
- * so please call SWIG_Python_str_DelForPy3(x) to free the space.
- */
-SWIGINTERN char*
-SWIG_Python_str_AsChar(PyObject *str)
-{
-#if PY_VERSION_HEX >= 0x03000000
-  char *cstr;
-  char *newstr;
-  Py_ssize_t len;
-  str = PyUnicode_AsUTF8String(str);
-  PyBytes_AsStringAndSize(str, &cstr, &len);
-  newstr = (char *) malloc(len+1);
-  memcpy(newstr, cstr, len+1);
-  Py_XDECREF(str);
-  return newstr;
-#else
-  return PyString_AsString(str);
-#endif
-}
-
-#if PY_VERSION_HEX >= 0x03000000
-#  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
-#else
-#  define SWIG_Python_str_DelForPy3(x) 
-#endif
-
-
-SWIGINTERN PyObject*
-SWIG_Python_str_FromChar(const char *c)
-{
-#if PY_VERSION_HEX >= 0x03000000
-  return PyUnicode_FromString(c); 
-#else
-  return PyString_FromString(c);
-#endif
-}
 
 /* Add PyOS_snprintf for old Pythons */
 #if PY_VERSION_HEX < 0x02020000
@@ -864,7 +760,6 @@ PyString_FromFormat(const char *fmt, ...) {
 #  define PyObject_GenericGetAttr 0
 # endif
 #endif
-
 /* Py_NotImplemented is defined in 2.1 and up. */
 #if PY_VERSION_HEX < 0x02010000
 # ifndef Py_NotImplemented
@@ -872,6 +767,7 @@ PyString_FromFormat(const char *fmt, ...) {
 # endif
 #endif
 
+
 /* A crude PyString_AsStringAndSize implementation for old Pythons */
 #if PY_VERSION_HEX < 0x02010000
 # ifndef PyString_AsStringAndSize
@@ -886,6 +782,7 @@ PyString_FromFormat(const char *fmt, ...) {
 # endif
 #endif
 
+
 /* PyBool_FromLong for old Pythons */
 #if PY_VERSION_HEX < 0x02030000
 static
@@ -904,63 +801,6 @@ PyObject *PyBool_FromLong(long ok)
 typedef int Py_ssize_t;
 # define PY_SSIZE_T_MAX INT_MAX
 # define PY_SSIZE_T_MIN INT_MIN
-typedef inquiry lenfunc;
-typedef intargfunc ssizeargfunc;
-typedef intintargfunc ssizessizeargfunc;
-typedef intobjargproc ssizeobjargproc;
-typedef intintobjargproc ssizessizeobjargproc;
-typedef getreadbufferproc readbufferproc;
-typedef getwritebufferproc writebufferproc;
-typedef getsegcountproc segcountproc;
-typedef getcharbufferproc charbufferproc;
-static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
-{
-  long result = 0;
-  PyObject *i = PyNumber_Int(x);
-  if (i) {
-    result = PyInt_AsLong(i);
-    Py_DECREF(i);
-  }
-  return result;
-}
-#endif
-
-#if PY_VERSION_HEX < 0x02040000
-#define Py_VISIT(op)				\
-  do { 						\
-    if (op) {					\
-      int vret = visit((op), arg);		\
-      if (vret)					\
-        return vret;				\
-    }						\
-  } while (0)
-#endif
-
-#if PY_VERSION_HEX < 0x02030000
-typedef struct {
-  PyTypeObject type;
-  PyNumberMethods as_number;
-  PyMappingMethods as_mapping;
-  PySequenceMethods as_sequence;
-  PyBufferProcs as_buffer;
-  PyObject *name, *slots;
-} PyHeapTypeObject;
-#endif
-
-#if PY_VERSION_HEX < 0x02030000
-typedef destructor freefunc;
-#endif
-
-#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
-     (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
-     (PY_MAJOR_VERSION > 3))
-# define SWIGPY_USE_CAPSULE
-# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
-#endif
-
-#if PY_VERSION_HEX < 0x03020000
-#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
-#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
 #endif
 
 /* -----------------------------------------------------------------------------
@@ -1020,20 +860,19 @@ SWIG_Python_AddErrorMsg(const char* mesg)
 
   if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
   if (value) {
-    char *tmp;
     PyObject *old_str = PyObject_Str(value);
     PyErr_Clear();
     Py_XINCREF(type);
-
-    PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
-    SWIG_Python_str_DelForPy3(tmp);
+    PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
     Py_DECREF(old_str);
     Py_DECREF(value);
   } else {
-    PyErr_SetString(PyExc_RuntimeError, mesg);
+    PyErr_Format(PyExc_RuntimeError, mesg);
   }
 }
 
+
+
 #if defined(SWIG_PYTHON_NO_THREADS)
 #  if defined(SWIG_PYTHON_THREADS)
 #    undef SWIG_PYTHON_THREADS
@@ -1107,6 +946,9 @@ SWIG_Python_AddErrorMsg(const char* mesg)
 
 #ifdef __cplusplus
 extern "C" {
+#if 0
+} /* cc-mode */
+#endif
 #endif
 
 /* -----------------------------------------------------------------------------
@@ -1127,29 +969,18 @@ typedef struct swig_const_info {
   swig_type_info **ptype;
 } swig_const_info;
 
-
-/* -----------------------------------------------------------------------------
- * Wrapper of PyInstanceMethod_New() used in Python 3
- * It is exported to the generated module, used for -fastproxy
- * ----------------------------------------------------------------------------- */
-#if PY_VERSION_HEX >= 0x03000000
-SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
-{
-  return PyInstanceMethod_New(func);
-}
-#else
-SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
-{
-  return NULL;
-}
-#endif
-
 #ifdef __cplusplus
+#if 0
+{ /* cc-mode */
+#endif
 }
 #endif
 
 
 /* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
  * pyrun.swg
  *
  * This file contains the runtime support for Python modules
@@ -1164,15 +995,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
 #define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
-
-#ifdef SWIGPYTHON_BUILTIN
-#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(self, ptr, type, flags)
-#else
-#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
-#endif
-
-#define SWIG_InternalNewPointerObj(ptr, type, flags)	SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
-
+#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(ptr, type, flags)
 #define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
 #define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
 #define swig_owntype                                    int
@@ -1187,7 +1010,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
 
 /* for C or C++ function pointers */
 #define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
-#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(ptr, type, 0)
 
 /* for C++ member pointers, ie, member methods */
 #define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
@@ -1198,7 +1021,7 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
 
 #define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule()
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
-#define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)
+#define SWIG_NewClientData(obj)                         PySwigClientData_New(obj)
 
 #define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
 #define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg				   
@@ -1230,33 +1053,12 @@ SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
 
 /* Set a constant value */
 
-#if defined(SWIGPYTHON_BUILTIN)
-
-SWIGINTERN void
-SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
-  PyObject *s = PyString_InternFromString(key);
-  PyList_Append(seq, s);
-  Py_DECREF(s);
-}
-
-SWIGINTERN void
-SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {   
-  PyDict_SetItemString(d, (char *)name, obj);
-  Py_DECREF(obj);
-  if (public_interface)
-    SwigPyBuiltin_AddPublicSymbol(public_interface, name);
-}
-
-#else
-
 SWIGINTERN void
 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
-  PyDict_SetItemString(d, (char *)name, obj);
+  PyDict_SetItemString(d, (char*) name, obj);
   Py_DECREF(obj);                            
 }
 
-#endif
-
 /* Append a value to the result obj */
 
 SWIGINTERN PyObject*
@@ -1305,37 +1107,29 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
 /* Unpack the argument tuple */
 
 SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs)
 {
   if (!args) {
     if (!min && !max) {
       return 1;
     } else {
       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
-		   name, (min == max ? "" : "at least "), (int)min);
+		   name, (min == max ? "" : "at least "), min);
       return 0;
     }
   }  
   if (!PyTuple_Check(args)) {
-    if (min <= 1 && max >= 1) {
-      register int i;
-      objs[0] = args;
-      for (i = 1; i < max; ++i) {
-	objs[i] = 0;
-      }
-      return 2;
-    }
     PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
     return 0;
   } else {
-    register Py_ssize_t l = PyTuple_GET_SIZE(args);
+    register int l = PyTuple_GET_SIZE(args);
     if (l < min) {
       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
-		   name, (min == max ? "" : "at least "), (int)min, (int)l);
+		   name, (min == max ? "" : "at least "), min, l);
       return 0;
     } else if (l > max) {
       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
-		   name, (min == max ? "" : "at most "), (int)max, (int)l);
+		   name, (min == max ? "" : "at most "), max, l);
       return 0;
     } else {
       register int i;
@@ -1377,11 +1171,11 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
 
 #define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)
 
-#define SWIG_BUILTIN_TP_INIT	    (SWIG_POINTER_OWN << 2)
-#define SWIG_BUILTIN_INIT	    (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
-
 #ifdef __cplusplus
 extern "C" {
+#if 0
+} /* cc-mode */
+#endif
 #endif
 
 /*  How to access Py_None */
@@ -1423,7 +1217,7 @@ SWIG_Py_Void(void)
   return none;
 }
 
-/* SwigPyClientData */
+/* PySwigClientData */
 
 typedef struct {
   PyObject *klass;
@@ -1432,31 +1226,30 @@ typedef struct {
   PyObject *destroy;
   int delargs;
   int implicitconv;
-  PyTypeObject *pytype;
-} SwigPyClientData;
+} PySwigClientData;
 
 SWIGRUNTIMEINLINE int 
 SWIG_Python_CheckImplicit(swig_type_info *ty)
 {
-  SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
+  PySwigClientData *data = (PySwigClientData *)ty->clientdata;
   return data ? data->implicitconv : 0;
 }
 
 SWIGRUNTIMEINLINE PyObject *
 SWIG_Python_ExceptionType(swig_type_info *desc) {
-  SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
+  PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
   PyObject *klass = data ? data->klass : 0;
   return (klass ? klass : PyExc_RuntimeError);
 }
 
 
-SWIGRUNTIME SwigPyClientData * 
-SwigPyClientData_New(PyObject* obj)
+SWIGRUNTIME PySwigClientData * 
+PySwigClientData_New(PyObject* obj)
 {
   if (!obj) {
     return 0;
   } else {
-    SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
+    PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
     /* the klass element */
     data->klass = obj;
     Py_INCREF(data->klass);
@@ -1499,19 +1292,19 @@ SwigPyClientData_New(PyObject* obj)
       data->delargs = 0;
     }
     data->implicitconv = 0;
-    data->pytype = 0;
     return data;
   }
 }
 
 SWIGRUNTIME void 
-SwigPyClientData_Del(SwigPyClientData *data) {
+PySwigClientData_Del(PySwigClientData* data)
+{
   Py_XDECREF(data->newraw);
   Py_XDECREF(data->newargs);
   Py_XDECREF(data->destroy);
 }
 
-/* =============== SwigPyObject =====================*/
+/* =============== PySwigObject =====================*/
 
 typedef struct {
   PyObject_HEAD
@@ -1519,31 +1312,24 @@ typedef struct {
   swig_type_info *ty;
   int own;
   PyObject *next;
-#ifdef SWIGPYTHON_BUILTIN
-  PyObject *dict;
-#endif
-} SwigPyObject;
+} PySwigObject;
 
 SWIGRUNTIME PyObject *
-SwigPyObject_long(SwigPyObject *v)
+PySwigObject_long(PySwigObject *v)
 {
   return PyLong_FromVoidPtr(v->ptr);
 }
 
 SWIGRUNTIME PyObject *
-SwigPyObject_format(const char* fmt, SwigPyObject *v)
+PySwigObject_format(const char* fmt, PySwigObject *v)
 {
   PyObject *res = NULL;
   PyObject *args = PyTuple_New(1);
   if (args) {
-    if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
-      PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
+    if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
+      PyObject *ofmt = PyString_FromString(fmt);
       if (ofmt) {
-#if PY_VERSION_HEX >= 0x03000000
-	res = PyUnicode_Format(ofmt,args);
-#else
 	res = PyString_Format(ofmt,args);
-#endif
 	Py_DECREF(ofmt);
       }
       Py_DECREF(args);
@@ -1553,57 +1339,49 @@ SwigPyObject_format(const char* fmt, SwigPyObject *v)
 }
 
 SWIGRUNTIME PyObject *
-SwigPyObject_oct(SwigPyObject *v)
+PySwigObject_oct(PySwigObject *v)
 {
-  return SwigPyObject_format("%o",v);
+  return PySwigObject_format("%o",v);
 }
 
 SWIGRUNTIME PyObject *
-SwigPyObject_hex(SwigPyObject *v)
+PySwigObject_hex(PySwigObject *v)
 {
-  return SwigPyObject_format("%x",v);
+  return PySwigObject_format("%x",v);
 }
 
 SWIGRUNTIME PyObject *
 #ifdef METH_NOARGS
-SwigPyObject_repr(SwigPyObject *v)
+PySwigObject_repr(PySwigObject *v)
 #else
-SwigPyObject_repr(SwigPyObject *v, PyObject *args)
+PySwigObject_repr(PySwigObject *v, PyObject *args)
 #endif
 {
   const char *name = SWIG_TypePrettyName(v->ty);
-  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, (void *)v);
+  PyObject *hex = PySwigObject_hex(v);    
+  PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
+  Py_DECREF(hex);
   if (v->next) {
-# ifdef METH_NOARGS
-    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
-# else
-    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
-# endif
-# if PY_VERSION_HEX >= 0x03000000
-    PyObject *joined = PyUnicode_Concat(repr, nrep);
-    Py_DecRef(repr);
-    Py_DecRef(nrep);
-    repr = joined;
-# else
+#ifdef METH_NOARGS
+    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
+#else
+    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
+#endif
     PyString_ConcatAndDel(&repr,nrep);
-# endif
   }
   return repr;  
 }
 
 SWIGRUNTIME int
-SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 {
-  char *str;
 #ifdef METH_NOARGS
-  PyObject *repr = SwigPyObject_repr(v);
+  PyObject *repr = PySwigObject_repr(v);
 #else
-  PyObject *repr = SwigPyObject_repr(v, NULL);
+  PyObject *repr = PySwigObject_repr(v, NULL);
 #endif
   if (repr) {
-    str = SWIG_Python_str_AsChar(repr); 
-    fputs(str, fp);
-    SWIG_Python_str_DelForPy3(str);
+    fputs(PyString_AsString(repr), fp);
     Py_DECREF(repr);
     return 0; 
   } else {
@@ -1612,87 +1390,53 @@ SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 }
 
 SWIGRUNTIME PyObject *
-SwigPyObject_str(SwigPyObject *v)
+PySwigObject_str(PySwigObject *v)
 {
   char result[SWIG_BUFFER_SIZE];
   return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
-    SWIG_Python_str_FromChar(result) : 0;
+    PyString_FromString(result) : 0;
 }
 
 SWIGRUNTIME int
-SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
+PySwigObject_compare(PySwigObject *v, PySwigObject *w)
 {
   void *i = v->ptr;
   void *j = w->ptr;
   return (i < j) ? -1 : ((i > j) ? 1 : 0);
 }
 
-/* Added for Python 3.x, would it also be useful for Python 2.x? */
-SWIGRUNTIME PyObject*
-SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
-{
-  PyObject* res;
-  if( op != Py_EQ && op != Py_NE ) {
-    Py_INCREF(Py_NotImplemented);
-    return Py_NotImplemented;
-  }
-  res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
-  return res;  
-}
-
-
-SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
+SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
 
-#ifdef SWIGPYTHON_BUILTIN
-static swig_type_info *SwigPyObject_stype = 0;
-SWIGRUNTIME PyTypeObject*
-SwigPyObject_type(void) {
-    SwigPyClientData *cd;
-    assert(SwigPyObject_stype);
-    cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
-    assert(cd);
-    assert(cd->pytype);
-    return cd->pytype;
-}
-#else
 SWIGRUNTIME PyTypeObject*
-SwigPyObject_type(void) {
-  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
+PySwigObject_type(void) {
+  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
   return type;
 }
-#endif
 
 SWIGRUNTIMEINLINE int
-SwigPyObject_Check(PyObject *op) {
-#ifdef SWIGPYTHON_BUILTIN
-  PyTypeObject *target_tp = SwigPyObject_type();
-  if (PyType_IsSubtype(op->ob_type, target_tp))
-    return 1;
-  return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
-#else
-  return (Py_TYPE(op) == SwigPyObject_type())
-    || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
-#endif
+PySwigObject_Check(PyObject *op) {
+  return ((op)->ob_type == PySwigObject_type())
+    || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
 }
 
 SWIGRUNTIME PyObject *
-SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
+PySwigObject_New(void *ptr, swig_type_info *ty, int own);
 
 SWIGRUNTIME void
-SwigPyObject_dealloc(PyObject *v)
+PySwigObject_dealloc(PyObject *v)
 {
-  SwigPyObject *sobj = (SwigPyObject *) v;
+  PySwigObject *sobj = (PySwigObject *) v;
   PyObject *next = sobj->next;
-  if (sobj->own == SWIG_POINTER_OWN) {
+  if (sobj->own) {
     swig_type_info *ty = sobj->ty;
-    SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
+    PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
     PyObject *destroy = data ? data->destroy : 0;
     if (destroy) {
       /* destroy is always a VARARGS method */
       PyObject *res;
       if (data->delargs) {
-	/* we need to create a temporary object to carry the destroy operation */
-	PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
+	/* we need to create a temporal object to carry the destroy operation */
+	PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
 	res = SWIG_Python_CallFunctor(destroy, tmp);
 	Py_DECREF(tmp);
       } else {
@@ -1701,28 +1445,27 @@ SwigPyObject_dealloc(PyObject *v)
 	res = ((*meth)(mself, v));
       }
       Py_XDECREF(res);
-    } 
-#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-    else {
+    } else {
       const char *name = SWIG_TypePrettyName(ty);
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
-    }
+#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
 #endif
+    }
   } 
   Py_XDECREF(next);
   PyObject_DEL(v);
 }
 
 SWIGRUNTIME PyObject* 
-SwigPyObject_append(PyObject* v, PyObject* next)
+PySwigObject_append(PyObject* v, PyObject* next)
 {
-  SwigPyObject *sobj = (SwigPyObject *) v;
+  PySwigObject *sobj = (PySwigObject *) v;
 #ifndef METH_O
   PyObject *tmp = 0;
   if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
   next = tmp;
 #endif
-  if (!SwigPyObject_Check(next)) {
+  if (!PySwigObject_Check(next)) {
     return NULL;
   }
   sobj->next = next;
@@ -1732,12 +1475,12 @@ SwigPyObject_append(PyObject* v, PyObject* next)
 
 SWIGRUNTIME PyObject* 
 #ifdef METH_NOARGS
-SwigPyObject_next(PyObject* v)
+PySwigObject_next(PyObject* v)
 #else
-SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 #endif
 {
-  SwigPyObject *sobj = (SwigPyObject *) v;
+  PySwigObject *sobj = (PySwigObject *) v;
   if (sobj->next) {    
     Py_INCREF(sobj->next);
     return sobj->next;
@@ -1748,30 +1491,30 @@ SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 
 SWIGINTERN PyObject*
 #ifdef METH_NOARGS
-SwigPyObject_disown(PyObject *v)
+PySwigObject_disown(PyObject *v)
 #else
-SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 #endif
 {
-  SwigPyObject *sobj = (SwigPyObject *)v;
+  PySwigObject *sobj = (PySwigObject *)v;
   sobj->own = 0;
   return SWIG_Py_Void();
 }
 
 SWIGINTERN PyObject*
 #ifdef METH_NOARGS
-SwigPyObject_acquire(PyObject *v)
+PySwigObject_acquire(PyObject *v)
 #else
-SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 #endif
 {
-  SwigPyObject *sobj = (SwigPyObject *)v;
+  PySwigObject *sobj = (PySwigObject *)v;
   sobj->own = SWIG_POINTER_OWN;
   return SWIG_Py_Void();
 }
 
 SWIGINTERN PyObject*
-SwigPyObject_own(PyObject *v, PyObject *args)
+PySwigObject_own(PyObject *v, PyObject *args)
 {
   PyObject *val = 0;
 #if (PY_VERSION_HEX < 0x02020000)
@@ -1784,20 +1527,20 @@ SwigPyObject_own(PyObject *v, PyObject *args)
     } 
   else
     {
-      SwigPyObject *sobj = (SwigPyObject *)v;
+      PySwigObject *sobj = (PySwigObject *)v;
       PyObject *obj = PyBool_FromLong(sobj->own);
       if (val) {
 #ifdef METH_NOARGS
 	if (PyObject_IsTrue(val)) {
-	  SwigPyObject_acquire(v);
+	  PySwigObject_acquire(v);
 	} else {
-	  SwigPyObject_disown(v);
+	  PySwigObject_disown(v);
 	}
 #else
 	if (PyObject_IsTrue(val)) {
-	  SwigPyObject_acquire(v,args);
+	  PySwigObject_acquire(v,args);
 	} else {
-	  SwigPyObject_disown(v,args);
+	  PySwigObject_disown(v,args);
 	}
 #endif
       } 
@@ -1808,47 +1551,44 @@ SwigPyObject_own(PyObject *v, PyObject *args)
 #ifdef METH_O
 static PyMethodDef
 swigobject_methods[] = {
-  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
-  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
-  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
-  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_O,       (char *)"appends another 'this' object"},
-  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
-  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
+  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
+  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
+  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
+  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_O,       (char *)"appends another 'this' object"},
+  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
+  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
   {0, 0, 0, 0}  
 };
 #else
 static PyMethodDef
 swigobject_methods[] = {
-  {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
-  {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
-  {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
-  {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
-  {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
-  {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
+  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
+  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
+  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
+  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
+  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
+  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
   {0, 0, 0, 0}  
 };
 #endif
 
 #if PY_VERSION_HEX < 0x02020000
 SWIGINTERN PyObject *
-SwigPyObject_getattr(SwigPyObject *sobj,char *name)
+PySwigObject_getattr(PySwigObject *sobj,char *name)
 {
   return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
 }
 #endif
 
 SWIGRUNTIME PyTypeObject*
-SwigPyObject_TypeOnce(void) {
+_PySwigObject_type(void) {
   static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
-
-  static PyNumberMethods SwigPyObject_as_number = {
+  
+  static PyNumberMethods PySwigObject_as_number = {
     (binaryfunc)0, /*nb_add*/
     (binaryfunc)0, /*nb_subtract*/
     (binaryfunc)0, /*nb_multiply*/
-    /* nb_divide removed in Python 3 */
-#if PY_VERSION_HEX < 0x03000000
     (binaryfunc)0, /*nb_divide*/
-#endif
     (binaryfunc)0, /*nb_remainder*/
     (binaryfunc)0, /*nb_divmod*/
     (ternaryfunc)0,/*nb_power*/
@@ -1862,122 +1602,94 @@ SwigPyObject_TypeOnce(void) {
     0,		   /*nb_and*/
     0,		   /*nb_xor*/
     0,		   /*nb_or*/
-#if PY_VERSION_HEX < 0x03000000
-    0,   /*nb_coerce*/
-#endif
-    (unaryfunc)SwigPyObject_long, /*nb_int*/
-#if PY_VERSION_HEX < 0x03000000
-    (unaryfunc)SwigPyObject_long, /*nb_long*/
-#else
-    0, /*nb_reserved*/
-#endif
+    (coercion)0,   /*nb_coerce*/
+    (unaryfunc)PySwigObject_long, /*nb_int*/
+    (unaryfunc)PySwigObject_long, /*nb_long*/
     (unaryfunc)0,                 /*nb_float*/
-#if PY_VERSION_HEX < 0x03000000
-    (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
-    (unaryfunc)SwigPyObject_hex,  /*nb_hex*/
-#endif
-#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
-#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
+    (unaryfunc)PySwigObject_oct,  /*nb_oct*/
+    (unaryfunc)PySwigObject_hex,  /*nb_hex*/
+#if PY_VERSION_HEX >= 0x02020000
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ 
+#elif PY_VERSION_HEX >= 0x02000000
     0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
 #endif
   };
 
-  static PyTypeObject swigpyobject_type;
+  static PyTypeObject pyswigobject_type;  
   static int type_init = 0;
   if (!type_init) {
-    const PyTypeObject tmp = {
-      /* PyObject header changed in Python 3 */
-#if PY_VERSION_HEX >= 0x03000000
-      PyVarObject_HEAD_INIT(NULL, 0)
-#else
-      PyObject_HEAD_INIT(NULL)
-      0,                                    /* ob_size */
-#endif
-      (char *)"SwigPyObject",               /* tp_name */
-      sizeof(SwigPyObject),                 /* tp_basicsize */
-      0,                                    /* tp_itemsize */
-      (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
-      (printfunc)SwigPyObject_print,        /* tp_print */
+    const PyTypeObject tmp
+      = {
+	PyObject_HEAD_INIT(NULL)
+	0,				    /* ob_size */
+	(char *)"PySwigObject",		    /* tp_name */
+	sizeof(PySwigObject),		    /* tp_basicsize */
+	0,			            /* tp_itemsize */
+	(destructor)PySwigObject_dealloc,   /* tp_dealloc */
+	(printfunc)PySwigObject_print,	    /* tp_print */
 #if PY_VERSION_HEX < 0x02020000
-      (getattrfunc)SwigPyObject_getattr,    /* tp_getattr */
-#else
-      (getattrfunc)0,                       /* tp_getattr */
-#endif
-      (setattrfunc)0,                       /* tp_setattr */
-#if PY_VERSION_HEX >= 0x03000000
-    0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
+	(getattrfunc)PySwigObject_getattr,  /* tp_getattr */ 
 #else
-      (cmpfunc)SwigPyObject_compare,        /* tp_compare */
+	(getattrfunc)0,			    /* tp_getattr */ 
 #endif
-      (reprfunc)SwigPyObject_repr,          /* tp_repr */
-      &SwigPyObject_as_number,              /* tp_as_number */
-      0,                                    /* tp_as_sequence */
-      0,                                    /* tp_as_mapping */
-      (hashfunc)0,                          /* tp_hash */
-      (ternaryfunc)0,                       /* tp_call */
-      (reprfunc)SwigPyObject_str,           /* tp_str */
-      PyObject_GenericGetAttr,              /* tp_getattro */
-      0,                                    /* tp_setattro */
-      0,                                    /* tp_as_buffer */
-      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
-      swigobject_doc,                       /* tp_doc */
-      0,                                    /* tp_traverse */
-      0,                                    /* tp_clear */
-      (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
-      0,                                    /* tp_weaklistoffset */
+	(setattrfunc)0,			    /* tp_setattr */ 
+	(cmpfunc)PySwigObject_compare,	    /* tp_compare */ 
+	(reprfunc)PySwigObject_repr,	    /* tp_repr */    
+	&PySwigObject_as_number,	    /* tp_as_number */
+	0,				    /* tp_as_sequence */
+	0,				    /* tp_as_mapping */
+	(hashfunc)0,			    /* tp_hash */
+	(ternaryfunc)0,			    /* tp_call */
+	(reprfunc)PySwigObject_str,	    /* tp_str */
+	PyObject_GenericGetAttr,            /* tp_getattro */
+	0,				    /* tp_setattro */
+	0,		                    /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
+	swigobject_doc, 	            /* tp_doc */        
+	0,                                  /* tp_traverse */
+	0,                                  /* tp_clear */
+	0,                                  /* tp_richcompare */
+	0,                                  /* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-      0,                                    /* tp_iter */
-      0,                                    /* tp_iternext */
-      swigobject_methods,                   /* tp_methods */
-      0,                                    /* tp_members */
-      0,                                    /* tp_getset */
-      0,                                    /* tp_base */
-      0,                                    /* tp_dict */
-      0,                                    /* tp_descr_get */
-      0,                                    /* tp_descr_set */
-      0,                                    /* tp_dictoffset */
-      0,                                    /* tp_init */
-      0,                                    /* tp_alloc */
-      0,                                    /* tp_new */
-      0,                                    /* tp_free */
-      0,                                    /* tp_is_gc */
-      0,                                    /* tp_bases */
-      0,                                    /* tp_mro */
-      0,                                    /* tp_cache */
-      0,                                    /* tp_subclasses */
-      0,                                    /* tp_weaklist */
+	0,                                  /* tp_iter */
+	0,                                  /* tp_iternext */
+	swigobject_methods,		    /* tp_methods */ 
+	0,			            /* tp_members */
+	0,				    /* tp_getset */	    	
+	0,			            /* tp_base */	        
+	0,				    /* tp_dict */	    	
+	0,				    /* tp_descr_get */  	
+	0,				    /* tp_descr_set */  	
+	0,				    /* tp_dictoffset */ 	
+	0,				    /* tp_init */	    	
+	0,				    /* tp_alloc */	    	
+	0,			            /* tp_new */	    	
+	0,	                            /* tp_free */	   
+        0,                                  /* tp_is_gc */  
+	0,				    /* tp_bases */   
+	0,				    /* tp_mro */
+	0,				    /* tp_cache */   
+ 	0,				    /* tp_subclasses */
+	0,				    /* tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-      0,                                    /* tp_del */
-#endif
-#if PY_VERSION_HEX >= 0x02060000
-      0,                                    /* tp_version */
+	0,                                  /* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-      0,0,0,0                               /* tp_alloc -> tp_next */
+	0,0,0,0                             /* tp_alloc -> tp_next */
 #endif
-    };
-    swigpyobject_type = tmp;
+      };
+    pyswigobject_type = tmp;
+    pyswigobject_type.ob_type = &PyType_Type;
     type_init = 1;
-#if PY_VERSION_HEX < 0x02020000
-    swigpyobject_type.ob_type = &PyType_Type;
-#else
-    if (PyType_Ready(&swigpyobject_type) < 0)
-      return NULL;
-#endif
   }
-  return &swigpyobject_type;
+  return &pyswigobject_type;
 }
 
 SWIGRUNTIME PyObject *
-SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
+PySwigObject_New(void *ptr, swig_type_info *ty, int own)
 {
-  SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
+  PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
   if (sobj) {
     sobj->ptr  = ptr;
     sobj->ty   = ty;
@@ -1996,10 +1708,10 @@ typedef struct {
   void *pack;
   swig_type_info *ty;
   size_t size;
-} SwigPyPacked;
+} PySwigPacked;
 
 SWIGRUNTIME int
-SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 {
   char result[SWIG_BUFFER_SIZE];
   fputs("<Swig Packed ", fp); 
@@ -2013,29 +1725,29 @@ SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 }
   
 SWIGRUNTIME PyObject *
-SwigPyPacked_repr(SwigPyPacked *v)
+PySwigPacked_repr(PySwigPacked *v)
 {
   char result[SWIG_BUFFER_SIZE];
   if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-    return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
+    return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
   } else {
-    return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
+    return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
   }  
 }
 
 SWIGRUNTIME PyObject *
-SwigPyPacked_str(SwigPyPacked *v)
+PySwigPacked_str(PySwigPacked *v)
 {
   char result[SWIG_BUFFER_SIZE];
   if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
-    return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
+    return PyString_FromFormat("%s%s", result, v->ty->name);
   } else {
-    return SWIG_Python_str_FromChar(v->ty->name);
+    return PyString_FromString(v->ty->name);
   }  
 }
 
 SWIGRUNTIME int
-SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
+PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
 {
   size_t i = v->size;
   size_t j = w->size;
@@ -2043,120 +1755,104 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
   return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
 }
 
-SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
+SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
 
 SWIGRUNTIME PyTypeObject*
-SwigPyPacked_type(void) {
-  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
+PySwigPacked_type(void) {
+  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
   return type;
 }
 
 SWIGRUNTIMEINLINE int
-SwigPyPacked_Check(PyObject *op) {
-  return ((op)->ob_type == SwigPyPacked_TypeOnce()) 
-    || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
+PySwigPacked_Check(PyObject *op) {
+  return ((op)->ob_type == _PySwigPacked_type()) 
+    || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
 }
 
 SWIGRUNTIME void
-SwigPyPacked_dealloc(PyObject *v)
+PySwigPacked_dealloc(PyObject *v)
 {
-  if (SwigPyPacked_Check(v)) {
-    SwigPyPacked *sobj = (SwigPyPacked *) v;
+  if (PySwigPacked_Check(v)) {
+    PySwigPacked *sobj = (PySwigPacked *) v;
     free(sobj->pack);
   }
   PyObject_DEL(v);
 }
 
 SWIGRUNTIME PyTypeObject*
-SwigPyPacked_TypeOnce(void) {
+_PySwigPacked_type(void) {
   static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
-  static PyTypeObject swigpypacked_type;
-  static int type_init = 0;
+  static PyTypeObject pyswigpacked_type;
+  static int type_init = 0;  
   if (!type_init) {
-    const PyTypeObject tmp = {
-      /* PyObject header changed in Python 3 */
-#if PY_VERSION_HEX>=0x03000000
-      PyVarObject_HEAD_INIT(NULL, 0)
-#else
-      PyObject_HEAD_INIT(NULL)
-      0,                                    /* ob_size */
-#endif
-      (char *)"SwigPyPacked",               /* tp_name */
-      sizeof(SwigPyPacked),                 /* tp_basicsize */
-      0,                                    /* tp_itemsize */
-      (destructor)SwigPyPacked_dealloc,     /* tp_dealloc */
-      (printfunc)SwigPyPacked_print,        /* tp_print */
-      (getattrfunc)0,                       /* tp_getattr */
-      (setattrfunc)0,                       /* tp_setattr */
-#if PY_VERSION_HEX>=0x03000000
-      0, /* tp_reserved in 3.0.1 */
-#else
-      (cmpfunc)SwigPyPacked_compare,        /* tp_compare */
-#endif
-      (reprfunc)SwigPyPacked_repr,          /* tp_repr */
-      0,                                    /* tp_as_number */
-      0,                                    /* tp_as_sequence */
-      0,                                    /* tp_as_mapping */
-      (hashfunc)0,                          /* tp_hash */
-      (ternaryfunc)0,                       /* tp_call */
-      (reprfunc)SwigPyPacked_str,           /* tp_str */
-      PyObject_GenericGetAttr,              /* tp_getattro */
-      0,                                    /* tp_setattro */
-      0,                                    /* tp_as_buffer */
-      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
-      swigpacked_doc,                       /* tp_doc */
-      0,                                    /* tp_traverse */
-      0,                                    /* tp_clear */
-      0,                                    /* tp_richcompare */
-      0,                                    /* tp_weaklistoffset */
+    const PyTypeObject tmp
+      = {
+	PyObject_HEAD_INIT(NULL)
+	0,				    /* ob_size */	
+	(char *)"PySwigPacked",		    /* tp_name */	
+	sizeof(PySwigPacked),		    /* tp_basicsize */	
+	0,				    /* tp_itemsize */	
+	(destructor)PySwigPacked_dealloc,   /* tp_dealloc */	
+	(printfunc)PySwigPacked_print,	    /* tp_print */   	
+	(getattrfunc)0,			    /* tp_getattr */ 	
+	(setattrfunc)0,			    /* tp_setattr */ 	
+	(cmpfunc)PySwigPacked_compare,	    /* tp_compare */ 	
+	(reprfunc)PySwigPacked_repr,	    /* tp_repr */    	
+	0,	                            /* tp_as_number */	
+	0,				    /* tp_as_sequence */
+	0,				    /* tp_as_mapping */	
+	(hashfunc)0,			    /* tp_hash */	
+	(ternaryfunc)0,			    /* tp_call */	
+	(reprfunc)PySwigPacked_str,	    /* tp_str */	
+	PyObject_GenericGetAttr,            /* tp_getattro */
+	0,				    /* tp_setattro */
+	0,		                    /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
+	swigpacked_doc, 	            /* tp_doc */
+	0,                                  /* tp_traverse */
+	0,                                  /* tp_clear */
+	0,                                  /* tp_richcompare */
+	0,                                  /* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-      0,                                    /* tp_iter */
-      0,                                    /* tp_iternext */
-      0,                                    /* tp_methods */
-      0,                                    /* tp_members */
-      0,                                    /* tp_getset */
-      0,                                    /* tp_base */
-      0,                                    /* tp_dict */
-      0,                                    /* tp_descr_get */
-      0,                                    /* tp_descr_set */
-      0,                                    /* tp_dictoffset */
-      0,                                    /* tp_init */
-      0,                                    /* tp_alloc */
-      0,                                    /* tp_new */
-      0,                                    /* tp_free */
-      0,                                    /* tp_is_gc */
-      0,                                    /* tp_bases */
-      0,                                    /* tp_mro */
-      0,                                    /* tp_cache */
-      0,                                    /* tp_subclasses */
-      0,                                    /* tp_weaklist */
+	0,                                  /* tp_iter */
+	0,                                  /* tp_iternext */
+	0,		                    /* tp_methods */ 
+	0,			            /* tp_members */
+	0,				    /* tp_getset */	    	
+	0,			            /* tp_base */	        
+	0,				    /* tp_dict */	    	
+	0,				    /* tp_descr_get */  	
+	0,				    /* tp_descr_set */  	
+	0,				    /* tp_dictoffset */ 	
+	0,				    /* tp_init */	    	
+	0,				    /* tp_alloc */	    	
+	0,			            /* tp_new */	    	
+	0, 	                            /* tp_free */	   
+        0,                                  /* tp_is_gc */  
+	0,				    /* tp_bases */   
+	0,				    /* tp_mro */
+	0,				    /* tp_cache */   
+ 	0,				    /* tp_subclasses */
+	0,				    /* tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-      0,                                    /* tp_del */
-#endif
-#if PY_VERSION_HEX >= 0x02060000
-      0,                                    /* tp_version */
+	0,                                  /* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-      0,0,0,0                               /* tp_alloc -> tp_next */
+	0,0,0,0                             /* tp_alloc -> tp_next */
 #endif
-    };
-    swigpypacked_type = tmp;
+      };
+    pyswigpacked_type = tmp;
+    pyswigpacked_type.ob_type = &PyType_Type;
     type_init = 1;
-#if PY_VERSION_HEX < 0x02020000
-    swigpypacked_type.ob_type = &PyType_Type;
-#else
-    if (PyType_Ready(&swigpypacked_type) < 0)
-      return NULL;
-#endif
   }
-  return &swigpypacked_type;
+  return &pyswigpacked_type;
 }
 
 SWIGRUNTIME PyObject *
-SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
+PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
 {
-  SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
+  PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
   if (sobj) {
     void *pack = malloc(size);
     if (pack) {
@@ -2173,10 +1869,10 @@ SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
 }
 
 SWIGRUNTIME swig_type_info *
-SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
+PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
 {
-  if (SwigPyPacked_Check(obj)) {
-    SwigPyPacked *sobj = (SwigPyPacked *)obj;
+  if (PySwigPacked_Check(obj)) {
+    PySwigPacked *sobj = (PySwigPacked *)obj;
     if (sobj->size != size) return 0;
     memcpy(ptr, sobj->pack, size);
     return sobj->ty;
@@ -2192,96 +1888,73 @@ SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
 SWIGRUNTIMEINLINE PyObject *
 _SWIG_This(void)
 {
-    return SWIG_Python_str_FromChar("this");
+  return PyString_FromString("this");
 }
 
-static PyObject *swig_this = NULL;
-
 SWIGRUNTIME PyObject *
 SWIG_This(void)
 {
-  if (swig_this == NULL)
-    swig_this = _SWIG_This();
+  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
   return swig_this;
 }
 
 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
 
-/* TODO: I don't know how to implement the fast getset in Python 3 right now */
-#if PY_VERSION_HEX>=0x03000000
-#define SWIG_PYTHON_SLOW_GETSET_THIS 
-#endif
-
-SWIGRUNTIME SwigPyObject *
+SWIGRUNTIME PySwigObject *
 SWIG_Python_GetSwigThis(PyObject *pyobj) 
 {
-  PyObject *obj;
-
-  if (SwigPyObject_Check(pyobj))
-    return (SwigPyObject *) pyobj;
-
-#ifdef SWIGPYTHON_BUILTIN
-  (void)obj;
-# ifdef PyWeakref_CheckProxy
-  if (PyWeakref_CheckProxy(pyobj)) {
-    pyobj = PyWeakref_GET_OBJECT(pyobj);
-    if (pyobj && SwigPyObject_Check(pyobj))
-      return (SwigPyObject*) pyobj;
-  }
-# endif
-  return NULL;
-#else
-
-  obj = 0;
-
-#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
-  if (PyInstance_Check(pyobj)) {
-    obj = _PyInstance_Lookup(pyobj, SWIG_This());      
+  if (PySwigObject_Check(pyobj)) {
+    return (PySwigObject *) pyobj;
   } else {
-    PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
-    if (dictptr != NULL) {
-      PyObject *dict = *dictptr;
-      obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
+    PyObject *obj = 0;
+#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
+    if (PyInstance_Check(pyobj)) {
+      obj = _PyInstance_Lookup(pyobj, SWIG_This());      
     } else {
+      PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
+      if (dictptr != NULL) {
+	PyObject *dict = *dictptr;
+	obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
+      } else {
 #ifdef PyWeakref_CheckProxy
-      if (PyWeakref_CheckProxy(pyobj)) {
-	PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
-	return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
-      }
+	if (PyWeakref_CheckProxy(pyobj)) {
+	  PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
+	  return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
+	}
 #endif
-      obj = PyObject_GetAttr(pyobj,SWIG_This());
-      if (obj) {
-	Py_DECREF(obj);
-      } else {
-	if (PyErr_Occurred()) PyErr_Clear();
-	return 0;
+	obj = PyObject_GetAttr(pyobj,SWIG_This());
+	if (obj) {
+	  Py_DECREF(obj);
+	} else {
+	  if (PyErr_Occurred()) PyErr_Clear();
+	  return 0;
+	}
       }
     }
-  }
 #else
-  obj = PyObject_GetAttr(pyobj,SWIG_This());
-  if (obj) {
-    Py_DECREF(obj);
-  } else {
-    if (PyErr_Occurred()) PyErr_Clear();
-    return 0;
-  }
+    obj = PyObject_GetAttr(pyobj,SWIG_This());
+    if (obj) {
+      Py_DECREF(obj);
+    } else {
+      if (PyErr_Occurred()) PyErr_Clear();
+      return 0;
+    }
 #endif
-  if (obj && !SwigPyObject_Check(obj)) {
-    /* a PyObject is called 'this', try to get the 'real this'
-       SwigPyObject from it */ 
-    return SWIG_Python_GetSwigThis(obj);
+    if (obj && !PySwigObject_Check(obj)) {
+      /* a PyObject is called 'this', try to get the 'real this'
+	 PySwigObject from it */ 
+      return SWIG_Python_GetSwigThis(obj);
+    }
+    return (PySwigObject *)obj;
   }
-  return (SwigPyObject *)obj;
-#endif
 }
 
 /* Acquire a pointer value */
 
 SWIGRUNTIME int
 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
-  if (own == SWIG_POINTER_OWN) {
-    SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
+  if (own) {
+    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
     if (sobj) {
       int oldown = sobj->own;
       sobj->own = own;
@@ -2295,97 +1968,80 @@ SWIG_Python_AcquirePtr(PyObject *obj, int own) {
 
 SWIGRUNTIME int
 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
-  int res;
-  SwigPyObject *sobj;
-
-  if (!obj)
-    return SWIG_ERROR;
+  if (!obj) return SWIG_ERROR;
   if (obj == Py_None) {
-    if (ptr)
-      *ptr = 0;
+    if (ptr) *ptr = 0;
     return SWIG_OK;
-  }
-
-  res = SWIG_ERROR;
-
-  sobj = SWIG_Python_GetSwigThis(obj);
-  if (own)
-    *own = 0;
-  while (sobj) {
-    void *vptr = sobj->ptr;
-    if (ty) {
-      swig_type_info *to = sobj->ty;
-      if (to == ty) {
-        /* no type cast needed */
-        if (ptr) *ptr = vptr;
-        break;
+  } else {
+    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    while (sobj) {
+      void *vptr = sobj->ptr;
+      if (ty) {
+	swig_type_info *to = sobj->ty;
+	if (to == ty) {
+	  /* no type cast needed */
+	  if (ptr) *ptr = vptr;
+	  break;
+	} else {
+	  swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+	  if (!tc) {
+	    sobj = (PySwigObject *)sobj->next;
+	  } else {
+	    if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+	    break;
+	  }
+	}
       } else {
-        swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
-        if (!tc) {
-          sobj = (SwigPyObject *)sobj->next;
-        } else {
-          if (ptr) {
-            int newmemory = 0;
-            *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
-            if (newmemory == SWIG_CAST_NEW_MEMORY) {
-              assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
-              if (own)
-                *own = *own | SWIG_CAST_NEW_MEMORY;
-            }
-          }
-          break;
-        }
+	if (ptr) *ptr = vptr;
+	break;
       }
-    } else {
-      if (ptr) *ptr = vptr;
-      break;
-    }
-  }
-  if (sobj) {
-    if (own)
-      *own = *own | sobj->own;
-    if (flags & SWIG_POINTER_DISOWN) {
-      sobj->own = 0;
     }
-    res = SWIG_OK;
-  } else {
-    if (flags & SWIG_POINTER_IMPLICIT_CONV) {
-      SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
-      if (data && !data->implicitconv) {
-        PyObject *klass = data->klass;
-        if (klass) {
-          PyObject *impconv;
-          data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
-          impconv = SWIG_Python_CallFunctor(klass, obj);
-          data->implicitconv = 0;
-          if (PyErr_Occurred()) {
-            PyErr_Clear();
-            impconv = 0;
-          }
-          if (impconv) {
-            SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
-            if (iobj) {
-              void *vptr;
-              res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
-              if (SWIG_IsOK(res)) {
-                if (ptr) {
-                  *ptr = vptr;
-                  /* transfer the ownership to 'ptr' */
-                  iobj->own = 0;
-                  res = SWIG_AddCast(res);
-                  res = SWIG_AddNewMask(res);
-                } else {
-                  res = SWIG_AddCast(res);		    
-                }
-              }
-            }
-            Py_DECREF(impconv);
-          }
-        }
+    if (sobj) {
+      if (own) *own = sobj->own;
+      if (flags & SWIG_POINTER_DISOWN) {
+	sobj->own = 0;
+      }
+      return SWIG_OK;
+    } else {
+      int res = SWIG_ERROR;
+      if (flags & SWIG_POINTER_IMPLICIT_CONV) {
+	PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+	if (data && !data->implicitconv) {
+	  PyObject *klass = data->klass;
+	  if (klass) {
+	    PyObject *impconv;
+	    data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
+	    impconv = SWIG_Python_CallFunctor(klass, obj);
+	    data->implicitconv = 0;
+	    if (PyErr_Occurred()) {
+	      PyErr_Clear();
+	      impconv = 0;
+	    }
+	    if (impconv) {
+	      PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
+	      if (iobj) {
+		void *vptr;
+		res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
+		if (SWIG_IsOK(res)) {
+		  if (ptr) {
+		    *ptr = vptr;
+		    /* transfer the ownership to 'ptr' */
+		    iobj->own = 0;
+		    res = SWIG_AddCast(res);
+		    res = SWIG_AddNewMask(res);
+		  } else {
+		    res = SWIG_AddCast(res);		    
+		  }
+		}
+	      }
+	      Py_DECREF(impconv);
+	    }
+	  }
+	}
       }
+      return res;
     }
   }
-  return res;
 }
 
 /* Convert a function ptr value */
@@ -2400,19 +2056,14 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
     /* here we get the method pointer for callbacks */
     const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
     const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
-    if (desc)
+    if (desc) {
       desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
-    if (!desc) 
-      return SWIG_ERROR;
+      if (!desc) return SWIG_ERROR;
+    }
     if (ty) {
       swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
-      if (tc) {
-        int newmemory = 0;
-        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
-        assert(!newmemory); /* newmemory handling not yet implemented */
-      } else {
-        return SWIG_ERROR;
-      }
+      if (!tc) return SWIG_ERROR;
+      *ptr = SWIG_TypeCast(tc,vptr);
     } else {
       *ptr = vptr;
     }
@@ -2424,7 +2075,7 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
 
 SWIGRUNTIME int
 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
-  swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
+  swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
   if (!to) return SWIG_ERROR;
   if (ty) {
     if (to != ty) {
@@ -2441,12 +2092,12 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t
  * ----------------------------------------------------------------------------- */
 
 /*
-  Create a new instance object, without calling __init__, and set the
+  Create a new instance object, whitout calling __init__, and set the
   'this' attribute.
 */
 
 SWIGRUNTIME PyObject* 
-SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
+SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
 {
 #if (PY_VERSION_HEX >= 0x02020000)
   PyObject *inst = 0;
@@ -2470,16 +2121,10 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
 #endif
     }
   } else {
-#if PY_VERSION_HEX >= 0x03000000
-    inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
-    PyObject_SetAttr(inst, SWIG_This(), swig_this);
-    Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
-#else
     PyObject *dict = PyDict_New();
     PyDict_SetItem(dict, SWIG_This(), swig_this);
     inst = PyInstance_NewRaw(data->newargs, dict);
     Py_DECREF(dict);
-#endif
   }
   return inst;
 #else
@@ -2542,9 +2187,9 @@ SWIG_Python_InitShadowInstance(PyObject *args) {
   if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
     return NULL;
   } else {
-    SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
+    PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
     if (sthis) {
-      SwigPyObject_append((PyObject*) sthis, obj[1]);
+      PySwigObject_append((PyObject*) sthis, obj[1]);
     } else {
       SWIG_Python_SetSwigThis(obj[0], obj[1]);
     }
@@ -2555,61 +2200,29 @@ SWIG_Python_InitShadowInstance(PyObject *args) {
 /* Create a new pointer object */
 
 SWIGRUNTIME PyObject *
-SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
-  SwigPyClientData *clientdata;
-  PyObject * robj;
-  int own;
-
-  if (!ptr)
+SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
+  if (!ptr) {
     return SWIG_Py_Void();
-
-  clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
-  own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
-  if (clientdata && clientdata->pytype) {
-    SwigPyObject *newobj;
-    if (flags & SWIG_BUILTIN_TP_INIT) {
-      newobj = (SwigPyObject*) self;
-      if (newobj->ptr) {
-        PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
-        while (newobj->next)
-	  newobj = (SwigPyObject *) newobj->next;
-        newobj->next = next_self;
-        newobj = (SwigPyObject *)next_self;
+  } else {
+    int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
+    PyObject *robj = PySwigObject_New(ptr, type, own);
+    PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
+    if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
+      PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
+      if (inst) {
+	Py_DECREF(robj);
+	robj = inst;
       }
-    } else {
-      newobj = PyObject_New(SwigPyObject, clientdata->pytype);
-    }
-    if (newobj) {
-      newobj->ptr = ptr;
-      newobj->ty = type;
-      newobj->own = own;
-      newobj->next = 0;
-#ifdef SWIGPYTHON_BUILTIN
-      newobj->dict = 0;
-#endif
-      return (PyObject*) newobj;
-    }
-    return SWIG_Py_Void();
-  }
-
-  assert(!(flags & SWIG_BUILTIN_TP_INIT));
-
-  robj = SwigPyObject_New(ptr, type, own);
-  if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
-    PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
-    if (inst) {
-      Py_DECREF(robj);
-      robj = inst;
     }
+    return robj;
   }
-  return robj;
 }
 
 /* Create a new packed object */
 
 SWIGRUNTIMEINLINE PyObject *
 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
-  return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
+  return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
 }
 
 /* -----------------------------------------------------------------------------*
@@ -2628,12 +2241,8 @@ SWIG_Python_GetModule(void) {
 #ifdef SWIG_LINK_RUNTIME
     type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
 #else
-# ifdef SWIGPY_USE_CAPSULE
-    type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
-# else
     type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
 				    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
-# endif
     if (PyErr_Occurred()) {
       PyErr_Clear();
       type_pointer = (void *)0;
@@ -2676,54 +2285,33 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
 #endif
 
 SWIGRUNTIME void
-#ifdef SWIGPY_USE_CAPSULE
-SWIG_Python_DestroyModule(PyObject *obj)
-#else
 SWIG_Python_DestroyModule(void *vptr)
-#endif
 {
-#ifdef SWIGPY_USE_CAPSULE
-  swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
-#else
   swig_module_info *swig_module = (swig_module_info *) vptr;
-#endif
   swig_type_info **types = swig_module->types;
   size_t i;
   for (i =0; i < swig_module->size; ++i) {
     swig_type_info *ty = types[i];
     if (ty->owndata) {
-      SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
-      if (data) SwigPyClientData_Del(data);
+      PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+      if (data) PySwigClientData_Del(data);
     }
   }
   Py_DECREF(SWIG_This());
-  swig_this = NULL;
 }
 
 SWIGRUNTIME void
 SWIG_Python_SetModule(swig_module_info *swig_module) {
-#if PY_VERSION_HEX >= 0x03000000
- /* Add a dummy module object into sys.modules */
-  PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
-#else
-  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
-  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
-#endif
-#ifdef SWIGPY_USE_CAPSULE
-  PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
-  if (pointer && module) {
-    PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
-  } else {
-    Py_XDECREF(pointer);
-  }
-#else
+  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
+
+  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+				   swig_empty_runtime_method_table);
   PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
   if (pointer && module) {
     PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
   } else {
     Py_XDECREF(pointer);
   }
-#endif
 }
 
 /* The python cached type query */
@@ -2737,24 +2325,16 @@ SWIGRUNTIME swig_type_info *
 SWIG_Python_TypeQuery(const char *type)
 {
   PyObject *cache = SWIG_Python_TypeCache();
-  PyObject *key = SWIG_Python_str_FromChar(type); 
+  PyObject *key = PyString_FromString(type); 
   PyObject *obj = PyDict_GetItem(cache, key);
   swig_type_info *descriptor;
   if (obj) {
-#ifdef SWIGPY_USE_CAPSULE
-    descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
-#else
     descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
-#endif
   } else {
     swig_module_info *swig_module = SWIG_Python_GetModule();
     descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
     if (descriptor) {
-#ifdef SWIGPY_USE_CAPSULE
-      obj = PyCapsule_New((void*) descriptor, NULL, NULL);
-#else
       obj = PyCObject_FromVoidPtr(descriptor, NULL);
-#endif
       PyDict_SetItem(cache, key, obj);
       Py_DECREF(obj);
     }
@@ -2772,23 +2352,21 @@ SWIG_Python_TypeQuery(const char *type)
 
 SWIGRUNTIME int
 SWIG_Python_AddErrMesg(const char* mesg, int infront)
-{  
+{
   if (PyErr_Occurred()) {
     PyObject *type = 0;
     PyObject *value = 0;
     PyObject *traceback = 0;
     PyErr_Fetch(&type, &value, &traceback);
     if (value) {
-      char *tmp;
       PyObject *old_str = PyObject_Str(value);
       Py_XINCREF(type);
       PyErr_Clear();
       if (infront) {
-	PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
+	PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
       } else {
-	PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
+	PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
       }
-      SWIG_Python_str_DelForPy3(tmp);
       Py_DECREF(old_str);
     }
     return 1;
@@ -2811,9 +2389,9 @@ SWIG_Python_ArgFail(int argnum)
 }
 
 SWIGRUNTIMEINLINE const char *
-SwigPyObject_GetDesc(PyObject *self)
+PySwigObject_GetDesc(PyObject *self)
 {
-  SwigPyObject *v = (SwigPyObject *)self;
+  PySwigObject *v = (PySwigObject *)self;
   swig_type_info *ty = v ? v->ty : 0;
   return ty ? ty->str : (char*)"";
 }
@@ -2823,10 +2401,10 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
 {
   if (type) {
 #if defined(SWIG_COBJECT_TYPES)
-    if (obj && SwigPyObject_Check(obj)) {
-      const char *otype = (const char *) SwigPyObject_GetDesc(obj);
+    if (obj && PySwigObject_Check(obj)) {
+      const char *otype = (const char *) PySwigObject_GetDesc(obj);
       if (otype) {
-	PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
+	PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
 		     type, otype);
 	return;
       }
@@ -2836,11 +2414,10 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
       const char *otype = (obj ? obj->ob_type->tp_name : 0); 
       if (otype) {
 	PyObject *str = PyObject_Str(obj);
-	const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
+	const char *cstr = str ? PyString_AsString(str) : 0;
 	if (cstr) {
 	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
 		       type, otype, cstr);
-          SWIG_Python_str_DelForPy3(cstr);
 	} else {
 	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
 		       type, otype);
@@ -2858,74 +2435,23 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
 
 /* Convert a pointer value, signal an exception on a type mismatch */
 SWIGRUNTIME void *
-SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
+SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
   void *result;
   if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
     PyErr_Clear();
-#if SWIG_POINTER_EXCEPTION
-    if (flags) {
+    if (flags & SWIG_POINTER_EXCEPTION) {
       SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
       SWIG_Python_ArgFail(argnum);
     }
-#endif
   }
   return result;
 }
 
-SWIGRUNTIME int
-SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
-  PyTypeObject *tp = obj->ob_type;
-  PyObject *descr;
-  PyObject *encoded_name;
-  descrsetfunc f;
-  int res;
-
-#ifdef Py_USING_UNICODE
-  if (PyString_Check(name)) {
-    name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
-    if (!name)
-      return -1;
-  } else if (!PyUnicode_Check(name))
-#else
-  if (!PyString_Check(name))
-#endif
-  {
-    PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
-    return -1;
-  } else {
-    Py_INCREF(name);
-  }
-
-  if (!tp->tp_dict) {
-    if (PyType_Ready(tp) < 0)
-      goto done;
-  }
-
-  res = -1;
-  descr = _PyType_Lookup(tp, name);
-  f = NULL;
-  if (descr != NULL)
-    f = descr->ob_type->tp_descr_set;
-  if (!f) {
-    if (PyString_Check(name)) {
-      encoded_name = name;
-      Py_INCREF(name);
-    } else {
-      encoded_name = PyUnicode_AsUTF8String(name);
-    }
-    PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
-    Py_DECREF(encoded_name);
-  } else {
-    res = f(descr, obj, value);
-  }
-  
-  done:
-  Py_DECREF(name);
-  return res;
-}
-
 
 #ifdef __cplusplus
+#if 0
+{ /* cc-mode */
+#endif
 }
 #endif
 
@@ -2957,36 +2483,39 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
 #define SWIGTYPE_p_p_PyObject swig_types[12]
 #define SWIGTYPE_p_p_double swig_types[13]
 #define SWIGTYPE_p_size_type swig_types[14]
-#define SWIGTYPE_p_std__allocatorT_CdiVariable_t swig_types[15]
-#define SWIGTYPE_p_std__allocatorT_double_t swig_types[16]
-#define SWIGTYPE_p_std__allocatorT_int_t swig_types[17]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t swig_types[18]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t swig_types[19]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t swig_types[20]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t swig_types[21]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t swig_types[22]
-#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[23]
-#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[24]
-#define SWIGTYPE_p_std__invalid_argument swig_types[25]
-#define SWIGTYPE_p_std__lessT_int_t swig_types[26]
-#define SWIGTYPE_p_std__lessT_std__string_t swig_types[27]
-#define SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t swig_types[28]
-#define SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t swig_types[29]
-#define SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t swig_types[30]
-#define SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t swig_types[31]
-#define SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t swig_types[32]
-#define SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t swig_types[33]
-#define SWIGTYPE_p_std__vectorT__Tp__Alloc_t swig_types[34]
-#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[35]
-#define SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t swig_types[36]
-#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[37]
-#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[38]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[39]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t swig_types[40]
-#define SWIGTYPE_p_swig__SwigPyIterator swig_types[41]
-#define SWIGTYPE_p_value_type swig_types[42]
-static swig_type_info *swig_types[44];
-static swig_module_info swig_module = {swig_types, 43, 0, 0, 0, 0};
+#define SWIGTYPE_p_std__invalid_argument swig_types[15]
+#define SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t swig_types[16]
+#define SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type swig_types[17]
+#define SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type swig_types[18]
+#define SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t swig_types[19]
+#define SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type swig_types[20]
+#define SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type swig_types[21]
+#define SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t swig_types[22]
+#define SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type swig_types[23]
+#define SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type swig_types[24]
+#define SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t swig_types[25]
+#define SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type swig_types[26]
+#define SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type swig_types[27]
+#define SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t swig_types[28]
+#define SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type swig_types[29]
+#define SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type swig_types[30]
+#define SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t swig_types[31]
+#define SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type swig_types[32]
+#define SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type swig_types[33]
+#define SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t swig_types[34]
+#define SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type swig_types[35]
+#define SWIGTYPE_p_std__vectorTfloat_std__allocatorTfloat_t_t swig_types[36]
+#define SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t swig_types[37]
+#define SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t__allocator_type swig_types[38]
+#define SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t swig_types[39]
+#define SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type swig_types[40]
+#define SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t swig_types[41]
+#define SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type swig_types[42]
+#define SWIGTYPE_p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t swig_types[43]
+#define SWIGTYPE_p_swig__PySwigIterator swig_types[44]
+#define SWIGTYPE_p_value_type swig_types[45]
+static swig_type_info *swig_types[47];
+static swig_module_info swig_module = {swig_types, 46, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -3001,16 +2530,11 @@ static swig_module_info swig_module = {swig_types, 43, 0, 0, 0, 0};
 /*-----------------------------------------------
               @(target):= _CdiObj.so
   ------------------------------------------------*/
-#if PY_VERSION_HEX >= 0x03000000
-#  define SWIG_init    PyInit__CdiObj
+#define SWIG_init    init_CdiObj
 
-#else
-#  define SWIG_init    init_CdiObj
-
-#endif
 #define SWIG_name    "_CdiObj"
 
-#define SWIGVERSION 0x020004 
+#define SWIGVERSION 0x010331 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -3022,28 +2546,26 @@ static swig_module_info swig_module = {swig_types, 43, 0, 0, 0, 0};
 
 
 namespace swig {
-  class SwigPtr_PyObject {
+  class PyObject_ptr {
   protected:
     PyObject *_obj;
 
   public:
-    SwigPtr_PyObject() :_obj(0)
+    PyObject_ptr() :_obj(0)
     {
     }
 
-    SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj)
+    PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj)
     {
       Py_XINCREF(_obj);      
     }
     
-    SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj)
+    PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
     {
-      if (initial_ref) {
-        Py_XINCREF(_obj);
-      }
+      if (initial_ref) Py_XINCREF(_obj);
     }
     
-    SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) 
+    PyObject_ptr & operator=(const PyObject_ptr& item) 
     {
       Py_XINCREF(item._obj);
       Py_XDECREF(_obj);
@@ -3051,7 +2573,7 @@ namespace swig {
       return *this;      
     }
     
-    ~SwigPtr_PyObject() 
+    ~PyObject_ptr() 
     {
       Py_XDECREF(_obj);
     }
@@ -3070,10 +2592,10 @@ namespace swig {
 
 
 namespace swig {
-  struct SwigVar_PyObject : SwigPtr_PyObject {
-    SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { }
+  struct PyObject_var : PyObject_ptr {
+    PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { }
     
-    SwigVar_PyObject & operator = (PyObject* obj)
+    PyObject_var & operator = (PyObject* obj)
     {
       Py_XDECREF(_obj);
       _obj = obj;
@@ -3090,6 +2612,13 @@ namespace swig {
 #include <stdexcept>
 
 
+  
+#if defined(__SUNPRO_CC) && defined(_RWSTD_VER)
+#  define SWIG_STD_NOASSIGN_STL
+#  define SWIG_STD_NOINSERT_TEMPLATE_STL
+#  define SWIG_STD_NOITERATOR_TRAITS_STL
+#endif
+
 #if defined(__GNUC__)
 #  if __GNUC__ == 2 && __GNUC_MINOR <= 96
 #     define SWIG_STD_NOMODERN_STL
@@ -3097,9 +2626,10 @@ namespace swig {
 #endif
 
 
+
+
 #include <string>
 #include <stdexcept>
-#include <stddef.h>
 
 
 #include <string>
@@ -3107,115 +2637,98 @@ namespace swig {
 
 #include <iostream>
 
-#if PY_VERSION_HEX >= 0x03020000
-# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
-#else
-# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
-#endif
-
   
 namespace swig {
   struct stop_iteration {
   };
 
-  struct SwigPyIterator {
+  struct PySwigIterator {
   private:
-    SwigPtr_PyObject _seq;
+    PyObject_ptr _seq;
 
   protected:
-    SwigPyIterator(PyObject *seq) : _seq(seq)
+    PySwigIterator(PyObject *seq) : _seq(seq)
     {
     }
       
   public:
-    virtual ~SwigPyIterator() {}
+    virtual ~PySwigIterator() {}
 
     // Access iterator method, required by Python
     virtual PyObject *value() const = 0;
 
     // Forward iterator method, required by Python
-    virtual SwigPyIterator *incr(size_t n = 1) = 0;
+    virtual PySwigIterator *incr(size_t n = 1) = 0;
     
     // Backward iterator method, very common in C++, but not required in Python
-    virtual SwigPyIterator *decr(size_t /*n*/ = 1)
+    virtual PySwigIterator *decr(size_t n = 1)
     {
       throw stop_iteration();
     }
 
     // Random access iterator methods, but not required in Python
-    virtual ptrdiff_t distance(const SwigPyIterator &/*x*/) const
+    virtual ptrdiff_t distance(const PySwigIterator &x) const
     {
       throw std::invalid_argument("operation not supported");
     }
 
-    virtual bool equal (const SwigPyIterator &/*x*/) const
+    virtual bool equal (const PySwigIterator &x) const
     {
       throw std::invalid_argument("operation not supported");
     }
     
     // C++ common/needed methods
-    virtual SwigPyIterator *copy() const = 0;
+    virtual PySwigIterator *copy() const = 0;
 
-    PyObject *next()     
+    PyObject *next()
     {
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads       
       PyObject *obj = value();
-      incr();       
-      SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads
-      return obj;     
-    }
-
-    /* Make an alias for Python 3.x */
-    PyObject *__next__()
-    {
-      return next();
+      incr();
+      return obj;
     }
 
     PyObject *previous()
     {
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads       
       decr();
-      PyObject *obj = value();
-      SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads       
-      return obj;
+      return value();
     }
 
-    SwigPyIterator *advance(ptrdiff_t n)
+    PySwigIterator *advance(ptrdiff_t n)
     {
       return  (n > 0) ?  incr(n) : decr(-n);
     }
       
-    bool operator == (const SwigPyIterator& x)  const
+    bool operator == (const PySwigIterator& x)  const
     {
       return equal(x);
     }
       
-    bool operator != (const SwigPyIterator& x) const
+    bool operator != (const PySwigIterator& x) const
     {
       return ! operator==(x);
     }
       
-    SwigPyIterator& operator += (ptrdiff_t n)
+    PySwigIterator& operator += (ptrdiff_t n)
     {
       return *advance(n);
     }
 
-    SwigPyIterator& operator -= (ptrdiff_t n)
+    PySwigIterator& operator -= (ptrdiff_t n)
     {
       return *advance(-n);
     }
       
-    SwigPyIterator* operator + (ptrdiff_t n) const
+    PySwigIterator* operator + (ptrdiff_t n) const
     {
       return copy()->advance(n);
     }
 
-    SwigPyIterator* operator - (ptrdiff_t n) const
+    PySwigIterator* operator - (ptrdiff_t n) const
     {
       return copy()->advance(-n);
     }
       
-    ptrdiff_t operator - (const SwigPyIterator& x) const
+    ptrdiff_t operator - (const PySwigIterator& x) const
     {
       return x.distance(*this);
     }
@@ -3224,20 +2737,12 @@ namespace swig {
       static int init = 0;
       static swig_type_info* desc = 0;
       if (!init) {
-	desc = SWIG_TypeQuery("swig::SwigPyIterator *");
+	desc = SWIG_TypeQuery("swig::PySwigIterator *");
 	init = 1;
       }	
       return desc;
     }    
   };
-
-#if defined(SWIGPYTHON_BUILTIN)
-  inline PyObject* make_output_iterator_builtin (PyObject *pyself)
-  {
-    Py_INCREF(pyself);
-    return pyself;
-  }
-#endif
 }
 
 
@@ -3533,7 +3038,7 @@ namespace swig {
   */
   template <class Type> struct traits_from_ptr {
     static PyObject *from(Type *val, int owner = 0) {
-      return SWIG_InternalNewPointerObj(val, type_info<Type>(), owner);
+      return SWIG_NewPointerObj(val, type_info<Type>(), owner);
     }
   };
 
@@ -3573,7 +3078,7 @@ namespace swig {
   struct traits_asptr {   
     static int asptr(PyObject *obj, Type **val) {
       Type *p;
-      int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
+      int res = (SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0) == SWIG_OK) ? SWIG_OLDOBJ : 0;
       if (SWIG_IsOK(res)) {
 	if (val) *val = p;
       }
@@ -3638,7 +3143,7 @@ namespace swig {
       int res = asval(obj, &v);
       if (!obj || !SWIG_IsOK(res)) {
 	if (!PyErr_Occurred()) {
-	  ::SWIG_Error(SWIG_TypeError,  swig::type_name<Type>());
+	  SWIG_Error(SWIG_TypeError,  swig::type_name<Type>());
 	}
 	if (throw_error) throw std::invalid_argument("bad type");
       }
@@ -3728,38 +3233,27 @@ namespace std {
     { 
       bool res;
       SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-      res = PyObject_RichCompareBool(v, w, Py_LT) ? true : false;
-      /* This may fall into a case of inconsistent
-               eg. ObjA > ObjX > ObjB
-               but ObjA < ObjB
-      */
-      if( PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TypeError) )
-      {
-        /* Objects can't be compared, this mostly occurred in Python 3.0 */
-        /* Compare their ptr directly for a workaround */
-        res = (v < w);
-        PyErr_Clear();
-      }
+      res = PyObject_Compare(v, w) < 0;
       SWIG_PYTHON_THREAD_END_BLOCK;
       return res;
     }
   };
 
   template <>
-  struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool>
+  struct less <swig::PyObject_ptr>: public binary_function<swig::PyObject_ptr, swig::PyObject_ptr, bool>
   {
     bool
-    operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const
+    operator()(const swig::PyObject_ptr& v, const swig::PyObject_ptr& w) const
     {
       return std::less<PyObject *>()(v, w);
     }
   };
 
   template <>
-  struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool>
+  struct less <swig::PyObject_var>: public binary_function<swig::PyObject_var, swig::PyObject_var, bool>
   {
     bool
-    operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const
+    operator()(const swig::PyObject_var& v, const swig::PyObject_var& w) const
     {
       return std::less<PyObject *>()(v, w);
     }
@@ -3862,7 +3356,7 @@ namespace swig {
 
   template <class Sequence, class Difference, class InputSeq>
   inline void
-  setslice(Sequence* self, Difference i, Difference j, const InputSeq& v = InputSeq()) {
+  setslice(Sequence* self, Difference i, Difference j, const InputSeq& v) {
     typename Sequence::size_type size = self->size();
     typename Sequence::size_type ii = swig::check_index(i, size, true);
     typename Sequence::size_type jj = swig::slice_index(j, size);
@@ -3901,27 +3395,23 @@ namespace swig {
 }
 
 
-#if defined(__SUNPRO_CC) && defined(_RWSTD_VER)
-#  if !defined(SWIG_NO_STD_NOITERATOR_TRAITS_STL)
-#    define SWIG_STD_NOITERATOR_TRAITS_STL
-#  endif
-#endif
-
 #if !defined(SWIG_STD_NOITERATOR_TRAITS_STL)
 #include <iterator>
 #else
-namespace std {
+namespace std  {
   template <class Iterator>
   struct iterator_traits {
     typedef ptrdiff_t difference_type;
     typedef typename Iterator::value_type value_type;
   };
 
+#if defined(__SUNPRO_CC) && defined(_RWSTD_VER)
   template <class Iterator, class Category,class T, class Reference, class Pointer, class Distance>
   struct iterator_traits<__reverse_bi_iterator<Iterator,Category,T,Reference,Pointer,Distance> > {
     typedef Distance difference_type;
     typedef T value_type;
   };
+#endif  
 
   template <class T>
   struct iterator_traits<T*> {
@@ -3939,21 +3429,22 @@ namespace std {
     }
     return __n;
   }
-}
+
+} 
 #endif
 
 
 namespace swig {
   template<typename OutIterator>
-  class SwigPyIterator_T :  public SwigPyIterator
+  class PySwigIterator_T :  public PySwigIterator
   {
   public:
     typedef OutIterator out_iterator;
     typedef typename std::iterator_traits<out_iterator>::value_type value_type;    
-    typedef SwigPyIterator_T<out_iterator> self_type;
+    typedef PySwigIterator_T<out_iterator> self_type;
 
-    SwigPyIterator_T(out_iterator curr, PyObject *seq)
-      : SwigPyIterator(seq), current(curr)
+    PySwigIterator_T(out_iterator curr, PyObject *seq)
+      : PySwigIterator(seq), current(curr)
     {
     }
 
@@ -3963,7 +3454,7 @@ namespace swig {
     }
 
     
-    bool equal (const SwigPyIterator &iter) const
+    bool equal (const PySwigIterator &iter) const
     {
       const self_type *iters = dynamic_cast<const self_type *>(&iter);
       if (iters) {
@@ -3973,7 +3464,7 @@ namespace swig {
       }
     }
     
-    ptrdiff_t distance(const SwigPyIterator &iter) const
+    ptrdiff_t distance(const PySwigIterator &iter) const
     {
       const self_type *iters = dynamic_cast<const self_type *>(&iter);
       if (iters) {
@@ -4001,17 +3492,17 @@ namespace swig {
   template<typename OutIterator, 
 	   typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
 	   typename FromOper = from_oper<ValueType> >
-  class SwigPyIteratorOpen_T :  public SwigPyIterator_T<OutIterator>
+  class PySwigIteratorOpen_T :  public PySwigIterator_T<OutIterator>
   {
   public:
     FromOper from;
     typedef OutIterator out_iterator;
     typedef ValueType value_type;
-    typedef SwigPyIterator_T<out_iterator>  base;
-    typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
+    typedef PySwigIterator_T<out_iterator>  base;
+    typedef PySwigIteratorOpen_T<OutIterator, ValueType, FromOper> self_type;
     
-    SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
-      : SwigPyIterator_T<OutIterator>(curr, seq)
+    PySwigIteratorOpen_T(out_iterator curr, PyObject *seq)
+      : PySwigIterator_T<OutIterator>(curr, seq)
     {
     }
     
@@ -4019,12 +3510,12 @@ namespace swig {
       return from(static_cast<const value_type&>(*(base::current)));
     }
     
-    SwigPyIterator *copy() const
+    PySwigIterator *copy() const
     {
       return new self_type(*this);
     }
 
-    SwigPyIterator *incr(size_t n = 1)
+    PySwigIterator *incr(size_t n = 1)
     {
       while (n--) {
 	++base::current;
@@ -4032,7 +3523,7 @@ namespace swig {
       return this;
     }
 
-    SwigPyIterator *decr(size_t n = 1)
+    PySwigIterator *decr(size_t n = 1)
     {
       while (n--) {
 	--base::current;
@@ -4044,17 +3535,17 @@ namespace swig {
   template<typename OutIterator, 
 	   typename ValueType = typename std::iterator_traits<OutIterator>::value_type,
 	   typename FromOper = from_oper<ValueType> >
-  class SwigPyIteratorClosed_T :  public SwigPyIterator_T<OutIterator>
+  class PySwigIteratorClosed_T :  public PySwigIterator_T<OutIterator>
   {
   public:
     FromOper from;
     typedef OutIterator out_iterator;
     typedef ValueType value_type;
-    typedef SwigPyIterator_T<out_iterator>  base;    
-    typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
+    typedef PySwigIterator_T<out_iterator>  base;    
+    typedef PySwigIteratorClosed_T<OutIterator, ValueType, FromOper> self_type;
     
-    SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
-      : SwigPyIterator_T<OutIterator>(curr, seq), begin(first), end(last)
+    PySwigIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
+      : PySwigIterator_T<OutIterator>(curr, seq), begin(first), end(last)
     {
     }
     
@@ -4066,12 +3557,12 @@ namespace swig {
       }
     }
     
-    SwigPyIterator *copy() const
+    PySwigIterator *copy() const
     {
       return new self_type(*this);
     }
 
-    SwigPyIterator *incr(size_t n = 1)
+    PySwigIterator *incr(size_t n = 1)
     {
       while (n--) {
 	if (base::current == end) {
@@ -4083,7 +3574,7 @@ namespace swig {
       return this;
     }
 
-    SwigPyIterator *decr(size_t n = 1)
+    PySwigIterator *decr(size_t n = 1)
     {
       while (n--) {
 	if (base::current == begin) {
@@ -4101,42 +3592,41 @@ namespace swig {
   };
 
   template<typename OutIter>
-  inline SwigPyIterator*
+  inline PySwigIterator*
   make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
   {
-    return new SwigPyIteratorClosed_T<OutIter>(current, begin, end, seq);
+    return new PySwigIteratorClosed_T<OutIter>(current, begin, end, seq);
   }
 
   template<typename OutIter>
-  inline SwigPyIterator*
+  inline PySwigIterator*
   make_output_iterator(const OutIter& current, PyObject *seq = 0)
   {
-    return new SwigPyIteratorOpen_T<OutIter>(current, seq);
+    return new PySwigIteratorOpen_T<OutIter>(current, seq);
   }
-
 }
 
 
 namespace swig
 {
   template <class T>
-  struct SwigPySequence_Ref
+  struct PySequence_Ref
   {
-    SwigPySequence_Ref(PyObject* seq, int index)
+    PySequence_Ref(PyObject* seq, int index)
       : _seq(seq), _index(index)
     {
     }
     
     operator T () const
     {
-      swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
+      swig::PyObject_var item = PySequence_GetItem(_seq, _index);
       try {
 	return swig::as<T>(item, true);
       } catch (std::exception& e) {
 	char msg[1024];
 	sprintf(msg, "in sequence element %d ", _index);
 	if (!PyErr_Occurred()) {
-	  ::SWIG_Error(SWIG_TypeError,  swig::type_name<T>());
+	  SWIG_Error(SWIG_TypeError,  swig::type_name<T>());
 	}
 	SWIG_Python_AddErrorMsg(msg);
 	SWIG_Python_AddErrorMsg(e.what());
@@ -4144,7 +3634,7 @@ namespace swig
       }
     }
 
-    SwigPySequence_Ref& operator=(const T& v)
+    PySequence_Ref& operator=(const T& v)
     {
       PySequence_SetItem(_seq, _index, swig::from<T>(v));
       return *this;
@@ -4156,18 +3646,18 @@ namespace swig
   };
 
   template <class T>
-  struct SwigPySequence_ArrowProxy
+  struct PySequence_ArrowProxy
   {
-    SwigPySequence_ArrowProxy(const T& x): m_value(x) {}
+    PySequence_ArrowProxy(const T& x): m_value(x) {}
     const T* operator->() const { return &m_value; }
     operator const T*() const { return &m_value; }
     T m_value;
   };
 
   template <class T, class Reference >
-  struct SwigPySequence_InputIterator
+  struct PySequence_InputIterator
   {
-    typedef SwigPySequence_InputIterator<T, Reference > self;
+    typedef PySequence_InputIterator<T, Reference > self;
 
     typedef std::random_access_iterator_tag iterator_category;
     typedef Reference reference;
@@ -4175,11 +3665,11 @@ namespace swig
     typedef T* pointer;
     typedef int difference_type;
 
-    SwigPySequence_InputIterator()
+    PySequence_InputIterator()
     {
     }
 
-    SwigPySequence_InputIterator(PyObject* seq, int index)
+    PySequence_InputIterator(PyObject* seq, int index)
       : _seq(seq), _index(index)
     {
     }
@@ -4189,9 +3679,9 @@ namespace swig
       return reference(_seq, _index);
     }
 
-    SwigPySequence_ArrowProxy<T>
+    PySequence_ArrowProxy<T>
     operator->() const {
-      return SwigPySequence_ArrowProxy<T>(operator*());
+      return PySequence_ArrowProxy<T>(operator*());
     }
 
     bool operator==(const self& ri) const
@@ -4260,19 +3750,19 @@ namespace swig
   };
 
   template <class T>
-  struct SwigPySequence_Cont
+  struct PySequence_Cont
   {
-    typedef SwigPySequence_Ref<T> reference;
-    typedef const SwigPySequence_Ref<T> const_reference;
+    typedef PySequence_Ref<T> reference;
+    typedef const PySequence_Ref<T> const_reference;
     typedef T value_type;
     typedef T* pointer;
     typedef int difference_type;
     typedef int size_type;
     typedef const pointer const_pointer;
-    typedef SwigPySequence_InputIterator<T, reference> iterator;
-    typedef SwigPySequence_InputIterator<T, const_reference> const_iterator;
+    typedef PySequence_InputIterator<T, reference> iterator;
+    typedef PySequence_InputIterator<T, const_reference> const_iterator;
 
-    SwigPySequence_Cont(PyObject* seq) : _seq(0)
+    PySequence_Cont(PyObject* seq) : _seq(0)
     {
       if (!PySequence_Check(seq)) {
 	throw std::invalid_argument("a sequence is expected");
@@ -4281,14 +3771,14 @@ namespace swig
       Py_INCREF(_seq);
     }
 
-    ~SwigPySequence_Cont()
+    ~PySequence_Cont()
     {
-      Py_XDECREF(_seq);
+      if (_seq) Py_DECREF(_seq);
     }
 
     size_type size() const
     {
-      return static_cast<size_type>(PySequence_Size(_seq));
+      return PySequence_Size(_seq);
     }
 
     bool empty() const
@@ -4330,7 +3820,7 @@ namespace swig
     {
       int s = size();
       for (int i = 0; i < s; ++i) {
-	swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
+	swig::PyObject_var item = PySequence_GetItem(_seq, i);
 	if (!swig::check<value_type>(item)) {
 	  if (set_err) {
 	    char msg[1024];
@@ -4351,12 +3841,14 @@ namespace swig
 
 
 #include <limits.h>
-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-#   define LLONG_MAX __LONG_LONG_MAX__
-#   define LLONG_MIN (-LLONG_MAX - 1LL)
-#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
+#ifndef LLONG_MIN
+# define LLONG_MIN	LONG_LONG_MIN
+#endif
+#ifndef LLONG_MAX
+# define LLONG_MAX	LONG_LONG_MAX
+#endif
+#ifndef ULLONG_MAX
+# define ULLONG_MAX	ULONG_LONG_MAX
 #endif
 
 
@@ -4404,15 +3896,18 @@ namespace swig {
 
 
 namespace swig {
-  template <class SwigPySeq, class Seq>
+  template <class PySeq, class Seq>
   inline void
-  assign(const SwigPySeq& swigpyseq, Seq* seq) {
-    // seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
-    typedef typename SwigPySeq::value_type value_type;
-    typename SwigPySeq::const_iterator it = swigpyseq.begin();
-    for (;it != swigpyseq.end(); ++it) {
+  assign(const PySeq& pyseq, Seq* seq) {
+#ifdef SWIG_STD_NOASSIGN_STL
+    typedef typename PySeq::value_type value_type;
+    typename PySeq::const_iterator it = pyseq.begin();
+    for (;it != pyseq.end(); ++it) {
       seq->insert(seq->end(),(value_type)(*it));
     }
+#else
+    seq->assign(pyseq.begin(), pyseq.end());
+#endif
   }
 
   template <class Seq, class T = typename Seq::value_type >
@@ -4421,23 +3916,16 @@ namespace swig {
     typedef T value_type;
 
     static int asptr(PyObject *obj, sequence **seq) {
-      if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) {
-	sequence *p;
-	if (::SWIG_ConvertPtr(obj,(void**)&p,
-			      swig::type_info<sequence>(),0) == SWIG_OK) {
-	  if (seq) *seq = p;
-	  return SWIG_OLDOBJ;
-	}
-      } else if (PySequence_Check(obj)) {
+      if (PySequence_Check(obj)) {
 	try {
-	  SwigPySequence_Cont<value_type> swigpyseq(obj);
+	  PySequence_Cont<value_type> pyseq(obj);
 	  if (seq) {
 	    sequence *pseq = new sequence();
-	    assign(swigpyseq, pseq);
+	    assign(pyseq, pseq);
 	    *seq = pseq;
 	    return SWIG_NEWOBJ;
 	  } else {
-	    return swigpyseq.check() ? SWIG_OK : SWIG_ERROR;
+	    return pyseq.check() ? SWIG_OK : SWIG_ERROR;
 	  }
 	} catch (std::exception& e) {
 	  if (seq) {
@@ -4447,6 +3935,13 @@ namespace swig {
 	  }
 	  return SWIG_ERROR;
 	}
+      } else {
+	sequence *p;
+	if (SWIG_ConvertPtr(obj,(void**)&p,
+			    swig::type_info<sequence>(),0) == SWIG_OK) {
+	  if (seq) *seq = p;
+	  return SWIG_OLDOBJ;
+	}
       }
       return SWIG_ERROR;
     }
@@ -4460,12 +3955,12 @@ namespace swig {
     typedef typename sequence::const_iterator const_iterator;
 
     static PyObject *from(const sequence& seq) {
-#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
-      swig_type_info *desc = swig::type_info<sequence>();
-      if (desc && desc->clientdata) {
-	return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN);
-      }
-#endif
+
+
+
+
+
+
       size_type size = seq.size();
       if (size <= (size_type)INT_MAX) {
 	PyObject *obj = PyTuple_New((int)size);
@@ -4502,24 +3997,21 @@ namespace swig {
 
 
       namespace swig {
-	template <>  struct traits<std::vector<int, std::allocator< int > > > {
+	template <>  struct traits<std::vector<int, std::allocator<int > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::vector<" "int" "," "std::allocator< int >" " >";
+	    return "std::vector<" "int" "," "std::allocator<int >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_vector_Sl_int_Sg__iterator(std::vector< int > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_vector_Sl_int_Sg__iterator(std::vector<int > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_vector_Sl_int_Sg____nonzero__(std::vector< int > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN bool std_vector_Sl_int_Sg____bool__(std::vector< int > const *self){
+SWIGINTERN bool std_vector_Sl_int_Sg____nonzero__(std::vector<int > const *self){
       return !(self->empty());
     }
-SWIGINTERN std::vector< int >::size_type std_vector_Sl_int_Sg____len__(std::vector< int > const *self){
+SWIGINTERN std::vector<int >::size_type std_vector_Sl_int_Sg____len__(std::vector<int > const *self){
       return self->size();
     }
 
@@ -4537,68 +4029,32 @@ SWIG_From_size_t  (size_t value)
   return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
 }
 
-SWIGINTERN std::vector< int >::value_type std_vector_Sl_int_Sg__pop(std::vector< int > *self){
+SWIGINTERN std::vector<int >::value_type std_vector_Sl_int_Sg__pop(std::vector<int > *self){
       if (self->size() == 0)
 	throw std::out_of_range("pop from empty container");
-      std::vector<int,std::allocator< int > >::value_type x = self->back();
+      std::vector<int,std::allocator<int > >::value_type x = self->back();
       self->pop_back();
       return x;
     }
-SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){
+SWIGINTERN std::vector<int,std::allocator<int > > *std_vector_Sl_int_Sg____getslice__(std::vector<int > *self,std::vector<int >::difference_type i,std::vector<int >::difference_type j){
       return swig::getslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_int_Sg____setslice____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j,std::vector< int,std::allocator< int > > const &v=std::vector< int,std::allocator< int > >()){
+SWIGINTERN void std_vector_Sl_int_Sg____setslice__(std::vector<int > *self,std::vector<int >::difference_type i,std::vector<int >::difference_type j,std::vector<int,std::allocator<int > > const &v){
       swig::setslice(self, i, j, v);
     }
-SWIGINTERN void std_vector_Sl_int_Sg____delslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){
+SWIGINTERN void std_vector_Sl_int_Sg____delslice__(std::vector<int > *self,std::vector<int >::difference_type i,std::vector<int >::difference_type j){
       swig::delslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_int_Sg____delitem____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i){
+SWIGINTERN void std_vector_Sl_int_Sg____delitem__(std::vector<int > *self,std::vector<int >::difference_type i){
       self->erase(swig::getpos(self,i));
     }
-SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getitem____SWIG_0(std::vector< int > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return NULL;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      return swig::getslice(self, i, j);
-    }
-SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_0(std::vector< int > *self,PySliceObject *slice,std::vector< int,std::allocator< int > > const &v){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::setslice(self, i, j, v);
-    }
-SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_1(std::vector< int > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN void std_vector_Sl_int_Sg____delitem____SWIG_1(std::vector< int > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN std::vector< int >::value_type const &std_vector_Sl_int_Sg____getitem____SWIG_1(std::vector< int > const *self,std::vector< int >::difference_type i){
+SWIGINTERN std::vector<int >::value_type const &std_vector_Sl_int_Sg____getitem__(std::vector<int > const *self,std::vector<int >::difference_type i){
       return *(swig::cgetpos(self, i));
     }
-SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_2(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::value_type const &x){
+SWIGINTERN void std_vector_Sl_int_Sg____setitem__(std::vector<int > *self,std::vector<int >::difference_type i,std::vector<int >::value_type const &x){
       *(swig::getpos(self,i)) = x;
     }
-SWIGINTERN void std_vector_Sl_int_Sg__append(std::vector< int > *self,std::vector< int >::value_type const &x){
+SWIGINTERN void std_vector_Sl_int_Sg__append(std::vector<int > *self,std::vector<int >::value_type const &x){
       self->push_back(x);
     }
 
@@ -4626,174 +4082,96 @@ namespace swig {
 
 
       namespace swig {
-	template <>  struct traits<std::vector<double, std::allocator< double > > > {
+	template <>  struct traits<std::vector<double, std::allocator<double > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::vector<" "double" "," "std::allocator< double >" " >";
+	    return "std::vector<" "double" "," "std::allocator<double >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_vector_Sl_double_Sg__iterator(std::vector< double > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_vector_Sl_double_Sg__iterator(std::vector<double > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_vector_Sl_double_Sg____nonzero__(std::vector< double > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN bool std_vector_Sl_double_Sg____bool__(std::vector< double > const *self){
+SWIGINTERN bool std_vector_Sl_double_Sg____nonzero__(std::vector<double > const *self){
       return !(self->empty());
     }
-SWIGINTERN std::vector< double >::size_type std_vector_Sl_double_Sg____len__(std::vector< double > const *self){
+SWIGINTERN std::vector<double >::size_type std_vector_Sl_double_Sg____len__(std::vector<double > const *self){
       return self->size();
     }
-SWIGINTERN std::vector< double >::value_type std_vector_Sl_double_Sg__pop(std::vector< double > *self){
+SWIGINTERN std::vector<double >::value_type std_vector_Sl_double_Sg__pop(std::vector<double > *self){
       if (self->size() == 0)
 	throw std::out_of_range("pop from empty container");
-      std::vector<double,std::allocator< double > >::value_type x = self->back();
+      std::vector<double,std::allocator<double > >::value_type x = self->back();
       self->pop_back();
       return x;
     }
-SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){
+SWIGINTERN std::vector<double,std::allocator<double > > *std_vector_Sl_double_Sg____getslice__(std::vector<double > *self,std::vector<double >::difference_type i,std::vector<double >::difference_type j){
       return swig::getslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_double_Sg____setslice____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j,std::vector< double,std::allocator< double > > const &v=std::vector< double,std::allocator< double > >()){
+SWIGINTERN void std_vector_Sl_double_Sg____setslice__(std::vector<double > *self,std::vector<double >::difference_type i,std::vector<double >::difference_type j,std::vector<double,std::allocator<double > > const &v){
       swig::setslice(self, i, j, v);
     }
-SWIGINTERN void std_vector_Sl_double_Sg____delslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){
+SWIGINTERN void std_vector_Sl_double_Sg____delslice__(std::vector<double > *self,std::vector<double >::difference_type i,std::vector<double >::difference_type j){
       swig::delslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i){
+SWIGINTERN void std_vector_Sl_double_Sg____delitem__(std::vector<double > *self,std::vector<double >::difference_type i){
       self->erase(swig::getpos(self,i));
     }
-SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getitem____SWIG_0(std::vector< double > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return NULL;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      return swig::getslice(self, i, j);
-    }
-SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_0(std::vector< double > *self,PySliceObject *slice,std::vector< double,std::allocator< double > > const &v){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::setslice(self, i, j, v);
-    }
-SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN std::vector< double >::value_type const &std_vector_Sl_double_Sg____getitem____SWIG_1(std::vector< double > const *self,std::vector< double >::difference_type i){
+SWIGINTERN std::vector<double >::value_type const &std_vector_Sl_double_Sg____getitem__(std::vector<double > const *self,std::vector<double >::difference_type i){
       return *(swig::cgetpos(self, i));
     }
-SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_2(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::value_type const &x){
+SWIGINTERN void std_vector_Sl_double_Sg____setitem__(std::vector<double > *self,std::vector<double >::difference_type i,std::vector<double >::value_type const &x){
       *(swig::getpos(self,i)) = x;
     }
-SWIGINTERN void std_vector_Sl_double_Sg__append(std::vector< double > *self,std::vector< double >::value_type const &x){
+SWIGINTERN void std_vector_Sl_double_Sg__append(std::vector<double > *self,std::vector<double >::value_type const &x){
       self->push_back(x);
     }
 
       namespace swig {
-	template <>  struct traits<std::vector<std::vector< double,std::allocator< double > >, std::allocator< std::vector< double,std::allocator< double > > > > > {
+	template <>  struct traits<std::vector<std::vector<double,std::allocator<double > >, std::allocator<std::vector<double,std::allocator<double > > > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::vector<" "std::vector< double,std::allocator< double > >" "," "std::allocator< std::vector< double,std::allocator< double > > >" " >";
+	    return "std::vector<" "std::vector<double,std::allocator<double > >" "," "std::allocator<std::vector<double,std::allocator<double > > >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(std::vector< std::vector< double > > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(std::vector<std::vector<double > > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__(std::vector< std::vector< double > > const *self){
+SWIGINTERN bool std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__(std::vector<std::vector<double > > const *self){
       return !(self->empty());
     }
-SWIGINTERN bool std_vector_Sl_std_vector_Sl_double_Sg__Sg____bool__(std::vector< std::vector< double > > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN std::vector< std::vector< double > >::size_type std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__(std::vector< std::vector< double > > const *self){
+SWIGINTERN std::vector<std::vector<double > >::size_type std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__(std::vector<std::vector<double > > const *self){
       return self->size();
     }
-SWIGINTERN std::vector< std::vector< double > >::value_type std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(std::vector< std::vector< double > > *self){
+SWIGINTERN std::vector<std::vector<double > >::value_type std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(std::vector<std::vector<double > > *self){
       if (self->size() == 0)
 	throw std::out_of_range("pop from empty container");
-      std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type x = self->back();
+      std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >::value_type x = self->back();
       self->pop_back();
       return x;
     }
-SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){
+SWIGINTERN std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(std::vector<std::vector<double > > *self,std::vector<std::vector<double > >::difference_type i,std::vector<std::vector<double > >::difference_type j){
       return swig::getslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v=std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double >  [...]
+SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice__(std::vector<std::vector<double > > *self,std::vector<std::vector<double > >::difference_type i,std::vector<std::vector<double > >::difference_type j,std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > const &v){
       swig::setslice(self, i, j, v);
     }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delslice__(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){
+SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delslice__(std::vector<std::vector<double > > *self,std::vector<std::vector<double > >::difference_type i,std::vector<std::vector<double > >::difference_type j){
       swig::delslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i){
+SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem__(std::vector<std::vector<double > > *self,std::vector<std::vector<double > >::difference_type i){
       self->erase(swig::getpos(self,i));
     }
-SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0(std::vector< std::vector< double > > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return NULL;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      return swig::getslice(self, i, j);
-    }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(std::vector< std::vector< double > > *self,PySliceObject *slice,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::setslice(self, i, j, v);
-    }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(std::vector< std::vector< double > > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_1(std::vector< std::vector< double > > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN std::vector< std::vector< double > >::value_type const &std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1(std::vector< std::vector< double > > const *self,std::vector< std::vector< double > >::difference_type i){
+SWIGINTERN std::vector<std::vector<double > >::value_type const &std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem__(std::vector<std::vector<double > > const *self,std::vector<std::vector<double > >::difference_type i){
       return *(swig::cgetpos(self, i));
     }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_2(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::value_type const &x){
+SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem__(std::vector<std::vector<double > > *self,std::vector<std::vector<double > >::difference_type i,std::vector<std::vector<double > >::value_type const &x){
       *(swig::getpos(self,i)) = x;
     }
-SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::value_type const &x){
+SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(std::vector<std::vector<double > > *self,std::vector<std::vector<double > >::value_type const &x){
       self->push_back(x);
     }
 
@@ -4813,28 +4191,10 @@ SWIG_pchar_descriptor(void)
 SWIGINTERN int
 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 {
-#if PY_VERSION_HEX>=0x03000000
-  if (PyUnicode_Check(obj))
-#else  
-  if (PyString_Check(obj))
-#endif
-  {
+  if (PyString_Check(obj)) {
     char *cstr; Py_ssize_t len;
-#if PY_VERSION_HEX>=0x03000000
-    if (!alloc && cptr) {
-        /* We can't allow converting without allocation, since the internal
-           representation of string in Python 3 is UCS-2/UCS-4 but we require
-           a UTF-8 representation.
-           TODO(bhy) More detailed explanation */
-        return SWIG_RuntimeError;
-    }
-    obj = PyUnicode_AsUTF8String(obj);
-    PyBytes_AsStringAndSize(obj, &cstr, &len);
-    if(alloc) *alloc = SWIG_NEWOBJ;
-#else
     PyString_AsStringAndSize(obj, &cstr, &len);
-#endif
-    if (cptr) {
+    if (cptr)  {
       if (alloc) {
 	/* 
 	   In python the user should not be able to modify the inner
@@ -4859,16 +4219,10 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 	  *alloc = SWIG_OLDOBJ;
 	}
       } else {
-        #if PY_VERSION_HEX>=0x03000000
-        assert(0); /* Should never reach here in Python 3 */
-        #endif
-	*cptr = SWIG_Python_str_AsChar(obj);
+	*cptr = PyString_AsString(obj);
       }
     }
     if (psize) *psize = len + 1;
-#if PY_VERSION_HEX>=0x03000000
-    Py_XDECREF(obj);
-#endif
     return SWIG_OK;
   } else {
     swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
@@ -4942,13 +4296,9 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
     if (size > INT_MAX) {
       swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
       return pchar_descriptor ? 
-	SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
+	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
     } else {
-#if PY_VERSION_HEX >= 0x03000000
-      return PyUnicode_FromStringAndSize(carray, static_cast< int >(size));
-#else
       return PyString_FromStringAndSize(carray, static_cast< int >(size));
-#endif
     }
   } else {
     return SWIG_Py_Void();
@@ -4959,7 +4309,11 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 SWIGINTERNINLINE PyObject *
 SWIG_From_std_string  (const std::string& s)
 {
-  return SWIG_FromCharPtrAndSize(s.data(), s.size());
+  if (s.size()) {
+    return SWIG_FromCharPtrAndSize(s.data(), s.size());
+  } else {
+    return SWIG_FromCharPtrAndSize(s.c_str(), 0);
+  }
 }
 
 
@@ -4984,88 +4338,49 @@ namespace swig {
 
 
       namespace swig {
-	template <>  struct traits<std::vector<std::string, std::allocator< std::string > > > {
+	template <>  struct traits<std::vector<std::string, std::allocator<std::string > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::vector<" "std::string" "," "std::allocator< std::string >" " >";
+	    return "std::vector<" "std::string" "," "std::allocator<std::string >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_string_Sg__iterator(std::vector< std::string > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_vector_Sl_std_string_Sg__iterator(std::vector<std::string > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_vector_Sl_std_string_Sg____nonzero__(std::vector< std::string > const *self){
+SWIGINTERN bool std_vector_Sl_std_string_Sg____nonzero__(std::vector<std::string > const *self){
       return !(self->empty());
     }
-SWIGINTERN bool std_vector_Sl_std_string_Sg____bool__(std::vector< std::string > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN std::vector< std::string >::size_type std_vector_Sl_std_string_Sg____len__(std::vector< std::string > const *self){
+SWIGINTERN std::vector<std::string >::size_type std_vector_Sl_std_string_Sg____len__(std::vector<std::string > const *self){
       return self->size();
     }
-SWIGINTERN std::vector< std::string >::value_type std_vector_Sl_std_string_Sg__pop(std::vector< std::string > *self){
+SWIGINTERN std::vector<std::string >::value_type std_vector_Sl_std_string_Sg__pop(std::vector<std::string > *self){
       if (self->size() == 0)
 	throw std::out_of_range("pop from empty container");
-      std::vector<std::string,std::allocator< std::string > >::value_type x = self->back();
+      std::vector<std::string,std::allocator<std::string > >::value_type x = self->back();
       self->pop_back();
       return x;
     }
-SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){
+SWIGINTERN std::vector<std::string,std::allocator<std::string > > *std_vector_Sl_std_string_Sg____getslice__(std::vector<std::string > *self,std::vector<std::string >::difference_type i,std::vector<std::string >::difference_type j){
       return swig::getslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_std_string_Sg____setslice____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j,std::vector< std::string,std::allocator< std::string > > const &v=std::vector< std::string,std::allocator< std::string > >()){
+SWIGINTERN void std_vector_Sl_std_string_Sg____setslice__(std::vector<std::string > *self,std::vector<std::string >::difference_type i,std::vector<std::string >::difference_type j,std::vector<std::string,std::allocator<std::string > > const &v){
       swig::setslice(self, i, j, v);
     }
-SWIGINTERN void std_vector_Sl_std_string_Sg____delslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){
+SWIGINTERN void std_vector_Sl_std_string_Sg____delslice__(std::vector<std::string > *self,std::vector<std::string >::difference_type i,std::vector<std::string >::difference_type j){
       swig::delslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i){
+SWIGINTERN void std_vector_Sl_std_string_Sg____delitem__(std::vector<std::string > *self,std::vector<std::string >::difference_type i){
       self->erase(swig::getpos(self,i));
     }
-SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getitem____SWIG_0(std::vector< std::string > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return NULL;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      return swig::getslice(self, i, j);
-    }
-SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_0(std::vector< std::string > *self,PySliceObject *slice,std::vector< std::string,std::allocator< std::string > > const &v){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::setslice(self, i, j, v);
-    }
-SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_1(std::vector< std::string > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_1(std::vector< std::string > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN std::vector< std::string >::value_type const &std_vector_Sl_std_string_Sg____getitem____SWIG_1(std::vector< std::string > const *self,std::vector< std::string >::difference_type i){
+SWIGINTERN std::vector<std::string >::value_type const &std_vector_Sl_std_string_Sg____getitem__(std::vector<std::string > const *self,std::vector<std::string >::difference_type i){
       return *(swig::cgetpos(self, i));
     }
-SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_2(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::value_type const &x){
+SWIGINTERN void std_vector_Sl_std_string_Sg____setitem__(std::vector<std::string > *self,std::vector<std::string >::difference_type i,std::vector<std::string >::value_type const &x){
       *(swig::getpos(self,i)) = x;
     }
-SWIGINTERN void std_vector_Sl_std_string_Sg__append(std::vector< std::string > *self,std::vector< std::string >::value_type const &x){
+SWIGINTERN void std_vector_Sl_std_string_Sg__append(std::vector<std::string > *self,std::vector<std::string >::value_type const &x){
       self->push_back(x);
     }
 
@@ -5078,88 +4393,49 @@ SWIGINTERN void std_vector_Sl_std_string_Sg__append(std::vector< std::string > *
 
 
       namespace swig {
-	template <>  struct traits<std::vector<CdiVariable, std::allocator< CdiVariable > > > {
+	template <>  struct traits<std::vector<CdiVariable, std::allocator<CdiVariable > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::vector<" "CdiVariable" "," "std::allocator< CdiVariable >" " >";
+	    return "std::vector<" "CdiVariable" "," "std::allocator<CdiVariable >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_vector_Sl_CdiVariable_Sg__iterator(std::vector< CdiVariable > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_vector_Sl_CdiVariable_Sg__iterator(std::vector<CdiVariable > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_vector_Sl_CdiVariable_Sg____nonzero__(std::vector< CdiVariable > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN bool std_vector_Sl_CdiVariable_Sg____bool__(std::vector< CdiVariable > const *self){
+SWIGINTERN bool std_vector_Sl_CdiVariable_Sg____nonzero__(std::vector<CdiVariable > const *self){
       return !(self->empty());
     }
-SWIGINTERN std::vector< CdiVariable >::size_type std_vector_Sl_CdiVariable_Sg____len__(std::vector< CdiVariable > const *self){
+SWIGINTERN std::vector<CdiVariable >::size_type std_vector_Sl_CdiVariable_Sg____len__(std::vector<CdiVariable > const *self){
       return self->size();
     }
-SWIGINTERN std::vector< CdiVariable >::value_type std_vector_Sl_CdiVariable_Sg__pop(std::vector< CdiVariable > *self){
+SWIGINTERN std::vector<CdiVariable >::value_type std_vector_Sl_CdiVariable_Sg__pop(std::vector<CdiVariable > *self){
       if (self->size() == 0)
 	throw std::out_of_range("pop from empty container");
-      std::vector<CdiVariable,std::allocator< CdiVariable > >::value_type x = self->back();
+      std::vector<CdiVariable,std::allocator<CdiVariable > >::value_type x = self->back();
       self->pop_back();
       return x;
     }
-SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg____getslice__(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){
+SWIGINTERN std::vector<CdiVariable,std::allocator<CdiVariable > > *std_vector_Sl_CdiVariable_Sg____getslice__(std::vector<CdiVariable > *self,std::vector<CdiVariable >::difference_type i,std::vector<CdiVariable >::difference_type j){
       return swig::getslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setslice____SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j,std::vector< CdiVariable,std::allocator< CdiVariable > > const &v=std::vector< CdiVariable,std::allocator< CdiVariable > >()){
+SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setslice__(std::vector<CdiVariable > *self,std::vector<CdiVariable >::difference_type i,std::vector<CdiVariable >::difference_type j,std::vector<CdiVariable,std::allocator<CdiVariable > > const &v){
       swig::setslice(self, i, j, v);
     }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delslice__(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){
+SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delslice__(std::vector<CdiVariable > *self,std::vector<CdiVariable >::difference_type i,std::vector<CdiVariable >::difference_type j){
       swig::delslice(self, i, j);
     }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delitem____SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i){
+SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delitem__(std::vector<CdiVariable > *self,std::vector<CdiVariable >::difference_type i){
       self->erase(swig::getpos(self,i));
     }
-SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0(std::vector< CdiVariable > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return NULL;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      return swig::getslice(self, i, j);
-    }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(std::vector< CdiVariable > *self,PySliceObject *slice,std::vector< CdiVariable,std::allocator< CdiVariable > > const &v){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::setslice(self, i, j, v);
-    }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(std::vector< CdiVariable > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delitem____SWIG_1(std::vector< CdiVariable > *self,PySliceObject *slice){
-      Py_ssize_t i, j, step;
-      if( !PySlice_Check(slice) ) {
-        SWIG_Error(SWIG_TypeError, "Slice object expected.");
-        return;
-      }
-      PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), self->size(), &i, &j, &step);
-      swig::delslice(self, i,j);
-    }
-SWIGINTERN std::vector< CdiVariable >::value_type const &std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1(std::vector< CdiVariable > const *self,std::vector< CdiVariable >::difference_type i){
+SWIGINTERN std::vector<CdiVariable >::value_type const &std_vector_Sl_CdiVariable_Sg____getitem__(std::vector<CdiVariable > const *self,std::vector<CdiVariable >::difference_type i){
       return *(swig::cgetpos(self, i));
     }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_2(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::value_type const &x){
+SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem__(std::vector<CdiVariable > *self,std::vector<CdiVariable >::difference_type i,std::vector<CdiVariable >::value_type const &x){
       *(swig::getpos(self,i)) = x;
     }
-SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable > *self,std::vector< CdiVariable >::value_type const &x){
+SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector<CdiVariable > *self,std::vector<CdiVariable >::value_type const &x){
       self->push_back(x);
     }
 
@@ -5249,8 +4525,8 @@ SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable >
 	  }
 	} else if (PySequence_Check(obj)) {
 	  if (PySequence_Size(obj) == 2) {
-	    swig::SwigVar_PyObject first = PySequence_GetItem(obj,0);
-	    swig::SwigVar_PyObject second = PySequence_GetItem(obj,1);
+	    swig::PyObject_var first = PySequence_GetItem(obj,0);
+	    swig::PyObject_var second = PySequence_GetItem(obj,1);
 	    res = get_pair(first, second, val);
 	  }
 	} else {
@@ -5275,41 +4551,6 @@ SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable >
   }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
       namespace swig {
 	template <>  struct traits<std::pair< std::string, CdiVariable > > {
 	  typedef pointer_category category;
@@ -5321,12 +4562,12 @@ SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable >
     
 
   namespace swig {
-    template <class SwigPySeq, class K, class T >
+    template <class PySeq, class K, class T >
     inline void
-    assign(const SwigPySeq& swigpyseq, std::map<K,T > *map) {
+    assign(const PySeq& pyseq, std::map<K,T > *map) {
       typedef typename std::map<K,T>::value_type value_type;
-      typename SwigPySeq::const_iterator it = swigpyseq.begin();
-      for (;it != swigpyseq.end(); ++it) {
+      typename PySeq::const_iterator it = pyseq.begin();
+      for (;it != pyseq.end(); ++it) {
 	map->insert(value_type(it->first, it->second));
       }
     }
@@ -5336,20 +4577,14 @@ SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable >
       typedef std::map<K,T> map_type;
       static int asptr(PyObject *obj, map_type **val) {
 	int res = SWIG_ERROR;
-	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	if (PyDict_Check(obj)) {
-	  SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
-#if PY_VERSION_HEX >= 0x03000000
-          /* In Python 3.x the ".items()" method returns a dict_items object */
-          items = PySequence_Fast(items, ".items() didn't return a sequence!");
-#endif
+	  PyObject_var items = PyMapping_Items(obj);
 	  res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
 	} else {
 	  map_type *p;
 	  res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
 	  if (SWIG_IsOK(res) && val)  *val = p;
 	}
-	SWIG_PYTHON_THREAD_END_BLOCK;
 	return res;
       }      
     };
@@ -5359,33 +4594,28 @@ SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable >
       typedef std::map<K,T> map_type;
       typedef typename map_type::const_iterator const_iterator;
       typedef typename map_type::size_type size_type;
-
-      static PyObject *asdict(const map_type& map) {
-	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-	size_type size = map.size();
-	int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
-	if (pysize < 0) {
-	  PyErr_SetString(PyExc_OverflowError,
-			  "map size not valid in python");
-	  SWIG_PYTHON_THREAD_END_BLOCK;
-	  return NULL;
-	}
-	PyObject *obj = PyDict_New();
-	for (const_iterator i= map.begin(); i!= map.end(); ++i) {
-	  swig::SwigVar_PyObject key = swig::from(i->first);
-	  swig::SwigVar_PyObject val = swig::from(i->second);
-	  PyDict_SetItem(obj, key, val);
-	}
-	SWIG_PYTHON_THREAD_END_BLOCK;
-	return obj;
-      }
-                
+            
       static PyObject *from(const map_type& map) {
 	swig_type_info *desc = swig::type_info<map_type>();
 	if (desc && desc->clientdata) {
-	  return SWIG_InternalNewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN);
+	  return SWIG_NewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN);
 	} else {
-	  return asdict(map);
+	  size_type size = map.size();
+	  int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
+	  if (pysize < 0) {
+	    SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+	    PyErr_SetString(PyExc_OverflowError,
+			    "map size not valid in python");
+	    SWIG_PYTHON_THREAD_END_BLOCK;
+	    return NULL;
+	  }
+	  PyObject *obj = PyDict_New();
+	  for (const_iterator i= map.begin(); i!= map.end(); ++i) {
+	    swig::PyObject_var key = swig::from(i->first);
+	    swig::PyObject_var val = swig::from(i->second);
+	    PyDict_SetItem(obj, key, val);
+	  }
+	  return obj;
 	}
       }
     };
@@ -5413,10 +4643,10 @@ SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable >
     };
 
     template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type>
-    struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper>
+    struct PyMapIterator_T : PySwigIteratorClosed_T<OutIterator, ValueType, FromOper>
     {
-      SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
-	: SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
+      PyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
+	: PySwigIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq)
       {
       }
     };
@@ -5424,153 +4654,140 @@ SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable >
 
     template<class OutIterator,
 	     class FromOper = from_key_oper<typename OutIterator::value_type> >
-    struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper>
+    struct PyMapKeyIterator_T : PyMapIterator_T<OutIterator, FromOper>
     {
-      SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
-	: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
+      PyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
+	: PyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
       {
       }
     };
 
     template<typename OutIter>
-    inline SwigPyIterator*
+    inline PySwigIterator*
     make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
     {
-      return new SwigPyMapKeyIterator_T<OutIter>(current, begin, end, seq);
+      return new PyMapKeyIterator_T<OutIter>(current, begin, end, seq);
     }
 
     template<class OutIterator,
 	     class FromOper = from_value_oper<typename OutIterator::value_type> >
-    struct SwigPyMapValueITerator_T : SwigPyMapIterator_T<OutIterator, FromOper>
+    struct PyMapValueIterator_T : PyMapIterator_T<OutIterator, FromOper>
     {
-      SwigPyMapValueITerator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
-	: SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
+      PyMapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq)
+	: PyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq)
       {
       }
     };
     
 
     template<typename OutIter>
-    inline SwigPyIterator*
+    inline PySwigIterator*
     make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0)
     {
-      return new SwigPyMapValueITerator_T<OutIter>(current, begin, end, seq);
+      return new PyMapValueIterator_T<OutIter>(current, begin, end, seq);
     }
-
   }
 
 
       namespace swig {
-	template <>  struct traits<std::map<std::string, CdiVariable, std::less< std::string >, std::allocator< std::pair< std::string const,CdiVariable > > > > {
+	template <>  struct traits<std::map<std::string, CdiVariable, std::less<std::string >, std::allocator<std::pair<std::string const,CdiVariable > > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::map<" "std::string" "," "CdiVariable" "," "std::less< std::string >" "," "std::allocator< std::pair< std::string const,CdiVariable > >" " >";
+	    return "std::map<" "std::string" "," "CdiVariable" "," "std::less<std::string >" "," "std::allocator<std::pair<std::string const,CdiVariable > >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(std::map<std::string,CdiVariable > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__(std::map< std::string,CdiVariable > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____bool__(std::map< std::string,CdiVariable > const *self){
+SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__(std::map<std::string,CdiVariable > const *self){
       return !(self->empty());
     }
-SWIGINTERN std::map< std::string,CdiVariable >::size_type std_map_Sl_std_string_Sc_CdiVariable_Sg____len__(std::map< std::string,CdiVariable > const *self){
+SWIGINTERN std::map<std::string,CdiVariable >::size_type std_map_Sl_std_string_Sc_CdiVariable_Sg____len__(std::map<std::string,CdiVariable > const *self){
       return self->size();
     }
-SWIGINTERN std::map< std::string,CdiVariable >::mapped_type const &std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key);
+SWIGINTERN std::map<std::string,CdiVariable >::mapped_type std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(std::map<std::string,CdiVariable > const *self,std::map<std::string,CdiVariable >::key_type const &key){
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::const_iterator i = self->find(key);
       if (i != self->end())
 	return i->second;
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____delitem__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->find(key);
+SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____delitem__(std::map<std::string,CdiVariable > *self,std::map<std::string,CdiVariable >::key_type const &key){
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::iterator i = self->find(key);
       if (i != self->end())
 	self->erase(i);
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key(std::map< std::string,CdiVariable > const *self,std::map< std::string,CdiVariable >::key_type const &key){
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key);
+SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key(std::map<std::string,CdiVariable > const *self,std::map<std::string,CdiVariable >::key_type const &key){
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::const_iterator i = self->find(key);
       return i != self->end();
     }
-SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(std::map< std::string,CdiVariable > *self){
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(std::map<std::string,CdiVariable > *self){
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* keyList = PyList_New(pysize);
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin();
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(keyList, j, swig::from(i->first));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return keyList;
     }
-SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__values(std::map< std::string,CdiVariable > *self){
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__values(std::map<std::string,CdiVariable > *self){
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* valList = PyList_New(pysize);
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin();
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(valList, j, swig::from(i->second));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return valList;
     }
-SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__items(std::map< std::string,CdiVariable > *self){
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__items(std::map<std::string,CdiVariable > *self){
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }    
       PyObject* itemList = PyList_New(pysize);
-      std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin();
+      std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(itemList, j, swig::from(*i));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return itemList;
     }
-SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){
+SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(std::map<std::string,CdiVariable > *self,std::map<std::string,CdiVariable >::key_type const &key){
       return self->find(key) != self->end();
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(std::map<std::string,CdiVariable > *self,PyObject **PYTHON_SELF){
       return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(std::map<std::string,CdiVariable > *self,PyObject **PYTHON_SELF){
       return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_0(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){
-      self->erase(key);
-    }
-SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_1(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key,std::map< std::string,CdiVariable >::mapped_type const &x){
+SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem__(std::map<std::string,CdiVariable > *self,std::map<std::string,CdiVariable >::key_type const &key,std::map<std::string,CdiVariable >::mapped_type const &x){
       (*self)[key] = x;
     }
-SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__asdict(std::map< std::string,CdiVariable > *self){
-      return swig::traits_from< std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > >::asdict(*self);
-    }
 
       namespace swig {
 	template <>  struct traits<std::pair< int, CdiVariable > > {
@@ -5583,116 +4800,104 @@ SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__asdict(std::map< s
     
 
       namespace swig {
-	template <>  struct traits<std::map<int, CdiVariable, std::less< int >, std::allocator< std::pair< int const,CdiVariable > > > > {
+	template <>  struct traits<std::map<int, CdiVariable, std::less<int >, std::allocator<std::pair<int const,CdiVariable > > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::map<" "int" "," "CdiVariable" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiVariable > >" " >";
+	    return "std::map<" "int" "," "CdiVariable" "," "std::less<int >" "," "std::allocator<std::pair<int const,CdiVariable > >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiVariable_Sg__iterator(std::map<int,CdiVariable > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__(std::map< int,CdiVariable > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____bool__(std::map< int,CdiVariable > const *self){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__(std::map<int,CdiVariable > const *self){
       return !(self->empty());
     }
-SWIGINTERN std::map< int,CdiVariable >::size_type std_map_Sl_int_Sc_CdiVariable_Sg____len__(std::map< int,CdiVariable > const *self){
+SWIGINTERN std::map<int,CdiVariable >::size_type std_map_Sl_int_Sc_CdiVariable_Sg____len__(std::map<int,CdiVariable > const *self){
       return self->size();
     }
-SWIGINTERN std::map< int,CdiVariable >::mapped_type const &std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key);
+SWIGINTERN std::map<int,CdiVariable >::mapped_type std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(std::map<int,CdiVariable > const *self,std::map<int,CdiVariable >::key_type const &key){
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::const_iterator i = self->find(key);
       if (i != self->end())
 	return i->second;
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____delitem__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->find(key);
+SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____delitem__(std::map<int,CdiVariable > *self,std::map<int,CdiVariable >::key_type const &key){
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::iterator i = self->find(key);
       if (i != self->end())
 	self->erase(i);
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg__has_key(std::map< int,CdiVariable > const *self,std::map< int,CdiVariable >::key_type const &key){
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key);
+SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg__has_key(std::map<int,CdiVariable > const *self,std::map<int,CdiVariable >::key_type const &key){
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::const_iterator i = self->find(key);
       return i != self->end();
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__keys(std::map< int,CdiVariable > *self){
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__keys(std::map<int,CdiVariable > *self){
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* keyList = PyList_New(pysize);
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin();
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(keyList, j, swig::from(i->first));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return keyList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__values(std::map< int,CdiVariable > *self){
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__values(std::map<int,CdiVariable > *self){
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* valList = PyList_New(pysize);
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin();
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(valList, j, swig::from(i->second));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return valList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__items(std::map< int,CdiVariable > *self){
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__items(std::map<int,CdiVariable > *self){
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }    
       PyObject* itemList = PyList_New(pysize);
-      std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin();
+      std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(itemList, j, swig::from(*i));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return itemList;
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____contains__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____contains__(std::map<int,CdiVariable > *self,std::map<int,CdiVariable >::key_type const &key){
       return self->find(key) != self->end();
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(std::map<int,CdiVariable > *self,PyObject **PYTHON_SELF){
       return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(std::map<int,CdiVariable > *self,PyObject **PYTHON_SELF){
       return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_0(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){
-      self->erase(key);
-    }
-SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_1(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key,std::map< int,CdiVariable >::mapped_type const &x){
+SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem__(std::map<int,CdiVariable > *self,std::map<int,CdiVariable >::key_type const &key,std::map<int,CdiVariable >::mapped_type const &x){
       (*self)[key] = x;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__asdict(std::map< int,CdiVariable > *self){
-      return swig::traits_from< std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > >::asdict(*self);
-    }
 
   namespace swig {
     template <>  struct traits<CdiTaxis > {
@@ -5713,116 +4918,104 @@ SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__asdict(std::map< int,CdiV
     
 
       namespace swig {
-	template <>  struct traits<std::map<int, CdiTaxis, std::less< int >, std::allocator< std::pair< int const,CdiTaxis > > > > {
+	template <>  struct traits<std::map<int, CdiTaxis, std::less<int >, std::allocator<std::pair<int const,CdiTaxis > > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::map<" "int" "," "CdiTaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiTaxis > >" " >";
+	    return "std::map<" "int" "," "CdiTaxis" "," "std::less<int >" "," "std::allocator<std::pair<int const,CdiTaxis > >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(std::map<int,CdiTaxis > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__(std::map< int,CdiTaxis > const *self){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__(std::map<int,CdiTaxis > const *self){
       return !(self->empty());
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____bool__(std::map< int,CdiTaxis > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN std::map< int,CdiTaxis >::size_type std_map_Sl_int_Sc_CdiTaxis_Sg____len__(std::map< int,CdiTaxis > const *self){
+SWIGINTERN std::map<int,CdiTaxis >::size_type std_map_Sl_int_Sc_CdiTaxis_Sg____len__(std::map<int,CdiTaxis > const *self){
       return self->size();
     }
-SWIGINTERN std::map< int,CdiTaxis >::mapped_type const &std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key);
+SWIGINTERN std::map<int,CdiTaxis >::mapped_type std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(std::map<int,CdiTaxis > const *self,std::map<int,CdiTaxis >::key_type const &key){
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::const_iterator i = self->find(key);
       if (i != self->end())
 	return i->second;
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____delitem__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->find(key);
+SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____delitem__(std::map<int,CdiTaxis > *self,std::map<int,CdiTaxis >::key_type const &key){
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::iterator i = self->find(key);
       if (i != self->end())
 	self->erase(i);
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg__has_key(std::map< int,CdiTaxis > const *self,std::map< int,CdiTaxis >::key_type const &key){
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key);
+SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg__has_key(std::map<int,CdiTaxis > const *self,std::map<int,CdiTaxis >::key_type const &key){
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::const_iterator i = self->find(key);
       return i != self->end();
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__keys(std::map< int,CdiTaxis > *self){
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__keys(std::map<int,CdiTaxis > *self){
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* keyList = PyList_New(pysize);
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin();
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(keyList, j, swig::from(i->first));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return keyList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__values(std::map< int,CdiTaxis > *self){
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__values(std::map<int,CdiTaxis > *self){
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* valList = PyList_New(pysize);
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin();
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(valList, j, swig::from(i->second));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return valList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__items(std::map< int,CdiTaxis > *self){
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__items(std::map<int,CdiTaxis > *self){
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }    
       PyObject* itemList = PyList_New(pysize);
-      std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin();
+      std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(itemList, j, swig::from(*i));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return itemList;
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(std::map<int,CdiTaxis > *self,std::map<int,CdiTaxis >::key_type const &key){
       return self->find(key) != self->end();
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(std::map<int,CdiTaxis > *self,PyObject **PYTHON_SELF){
       return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(std::map<int,CdiTaxis > *self,PyObject **PYTHON_SELF){
       return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_0(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){
-      self->erase(key);
-    }
-SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_1(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key,std::map< int,CdiTaxis >::mapped_type const &x){
+SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem__(std::map<int,CdiTaxis > *self,std::map<int,CdiTaxis >::key_type const &key,std::map<int,CdiTaxis >::mapped_type const &x){
       (*self)[key] = x;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__asdict(std::map< int,CdiTaxis > *self){
-      return swig::traits_from< std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > >::asdict(*self);
-    }
 
   namespace swig {
     template <>  struct traits<CdiZaxis > {
@@ -5843,116 +5036,104 @@ SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__asdict(std::map< int,CdiTaxi
     
 
       namespace swig {
-	template <>  struct traits<std::map<int, CdiZaxis, std::less< int >, std::allocator< std::pair< int const,CdiZaxis > > > > {
+	template <>  struct traits<std::map<int, CdiZaxis, std::less<int >, std::allocator<std::pair<int const,CdiZaxis > > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::map<" "int" "," "CdiZaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiZaxis > >" " >";
+	    return "std::map<" "int" "," "CdiZaxis" "," "std::less<int >" "," "std::allocator<std::pair<int const,CdiZaxis > >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(std::map<int,CdiZaxis > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__(std::map< int,CdiZaxis > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____bool__(std::map< int,CdiZaxis > const *self){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__(std::map<int,CdiZaxis > const *self){
       return !(self->empty());
     }
-SWIGINTERN std::map< int,CdiZaxis >::size_type std_map_Sl_int_Sc_CdiZaxis_Sg____len__(std::map< int,CdiZaxis > const *self){
+SWIGINTERN std::map<int,CdiZaxis >::size_type std_map_Sl_int_Sc_CdiZaxis_Sg____len__(std::map<int,CdiZaxis > const *self){
       return self->size();
     }
-SWIGINTERN std::map< int,CdiZaxis >::mapped_type const &std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key);
+SWIGINTERN std::map<int,CdiZaxis >::mapped_type std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(std::map<int,CdiZaxis > const *self,std::map<int,CdiZaxis >::key_type const &key){
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::const_iterator i = self->find(key);
       if (i != self->end())
 	return i->second;
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____delitem__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->find(key);
+SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____delitem__(std::map<int,CdiZaxis > *self,std::map<int,CdiZaxis >::key_type const &key){
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::iterator i = self->find(key);
       if (i != self->end())
 	self->erase(i);
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg__has_key(std::map< int,CdiZaxis > const *self,std::map< int,CdiZaxis >::key_type const &key){
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key);
+SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg__has_key(std::map<int,CdiZaxis > const *self,std::map<int,CdiZaxis >::key_type const &key){
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::const_iterator i = self->find(key);
       return i != self->end();
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__keys(std::map< int,CdiZaxis > *self){
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__keys(std::map<int,CdiZaxis > *self){
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* keyList = PyList_New(pysize);
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin();
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(keyList, j, swig::from(i->first));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return keyList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__values(std::map< int,CdiZaxis > *self){
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__values(std::map<int,CdiZaxis > *self){
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* valList = PyList_New(pysize);
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin();
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(valList, j, swig::from(i->second));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return valList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__items(std::map< int,CdiZaxis > *self){
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__items(std::map<int,CdiZaxis > *self){
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }    
       PyObject* itemList = PyList_New(pysize);
-      std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin();
+      std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(itemList, j, swig::from(*i));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return itemList;
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(std::map<int,CdiZaxis > *self,std::map<int,CdiZaxis >::key_type const &key){
       return self->find(key) != self->end();
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(std::map<int,CdiZaxis > *self,PyObject **PYTHON_SELF){
       return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(std::map<int,CdiZaxis > *self,PyObject **PYTHON_SELF){
       return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_0(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){
-      self->erase(key);
-    }
-SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_1(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key,std::map< int,CdiZaxis >::mapped_type const &x){
+SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem__(std::map<int,CdiZaxis > *self,std::map<int,CdiZaxis >::key_type const &key,std::map<int,CdiZaxis >::mapped_type const &x){
       (*self)[key] = x;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__asdict(std::map< int,CdiZaxis > *self){
-      return swig::traits_from< std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > >::asdict(*self);
-    }
 
   namespace swig {
     template <>  struct traits<CdiGrid > {
@@ -5973,125 +5154,120 @@ SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__asdict(std::map< int,CdiZaxi
     
 
       namespace swig {
-	template <>  struct traits<std::map<int, CdiGrid, std::less< int >, std::allocator< std::pair< int const,CdiGrid > > > > {
+	template <>  struct traits<std::map<int, CdiGrid, std::less<int >, std::allocator<std::pair<int const,CdiGrid > > > > {
 	  typedef pointer_category category;
 	  static const char* type_name() {
-	    return "std::map<" "int" "," "CdiGrid" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiGrid > >" " >";
+	    return "std::map<" "int" "," "CdiGrid" "," "std::less<int >" "," "std::allocator<std::pair<int const,CdiGrid > >" " >";
 	  }
 	};
       }
     
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiGrid_Sg__iterator(std::map<int,CdiGrid > *self,PyObject **PYTHON_SELF){
       return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__(std::map< int,CdiGrid > const *self){
-      return !(self->empty());
-    }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____bool__(std::map< int,CdiGrid > const *self){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__(std::map<int,CdiGrid > const *self){
       return !(self->empty());
     }
-SWIGINTERN std::map< int,CdiGrid >::size_type std_map_Sl_int_Sc_CdiGrid_Sg____len__(std::map< int,CdiGrid > const *self){
+SWIGINTERN std::map<int,CdiGrid >::size_type std_map_Sl_int_Sc_CdiGrid_Sg____len__(std::map<int,CdiGrid > const *self){
       return self->size();
     }
-SWIGINTERN std::map< int,CdiGrid >::mapped_type const &std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key);
+SWIGINTERN std::map<int,CdiGrid >::mapped_type std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(std::map<int,CdiGrid > const *self,std::map<int,CdiGrid >::key_type const &key){
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::const_iterator i = self->find(key);
       if (i != self->end())
 	return i->second;
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____delitem__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->find(key);
+SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____delitem__(std::map<int,CdiGrid > *self,std::map<int,CdiGrid >::key_type const &key){
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::iterator i = self->find(key);
       if (i != self->end())
 	self->erase(i);
       else
 	throw std::out_of_range("key not found");
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg__has_key(std::map< int,CdiGrid > const *self,std::map< int,CdiGrid >::key_type const &key){
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key);
+SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg__has_key(std::map<int,CdiGrid > const *self,std::map<int,CdiGrid >::key_type const &key){
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::const_iterator i = self->find(key);
       return i != self->end();
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__keys(std::map< int,CdiGrid > *self){
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__keys(std::map<int,CdiGrid > *self){
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* keyList = PyList_New(pysize);
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin();
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(keyList, j, swig::from(i->first));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return keyList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__values(std::map< int,CdiGrid > *self){
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__values(std::map<int,CdiGrid > *self){
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }
       PyObject* valList = PyList_New(pysize);
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin();
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(valList, j, swig::from(i->second));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return valList;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__items(std::map< int,CdiGrid > *self){
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size();
-      int pysize = (size <= (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1;
-      SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__items(std::map<int,CdiGrid > *self){
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::size_type size = self->size();
+      int pysize = (size <= (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::size_type) INT_MAX) ? (int) size : -1;
       if (pysize < 0) {
+	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
 	PyErr_SetString(PyExc_OverflowError,
 			"map size not valid in python");
 	SWIG_PYTHON_THREAD_END_BLOCK;
 	return NULL;
       }    
       PyObject* itemList = PyList_New(pysize);
-      std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin();
+      std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >::const_iterator i = self->begin();
       for (int j = 0; j < pysize; ++i, ++j) {
 	PyList_SET_ITEM(itemList, j, swig::from(*i));
       }
-      SWIG_PYTHON_THREAD_END_BLOCK;
       return itemList;
     }
-SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____contains__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){
+SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____contains__(std::map<int,CdiGrid > *self,std::map<int,CdiGrid >::key_type const &key){
       return self->find(key) != self->end();
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(std::map<int,CdiGrid > *self,PyObject **PYTHON_SELF){
       return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){
+SWIGINTERN swig::PySwigIterator *std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(std::map<int,CdiGrid > *self,PyObject **PYTHON_SELF){
       return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
     }
-SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_0(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){
-      self->erase(key);
-    }
-SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_1(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key,std::map< int,CdiGrid >::mapped_type const &x){
+SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem__(std::map<int,CdiGrid > *self,std::map<int,CdiGrid >::key_type const &key,std::map<int,CdiGrid >::mapped_type const &x){
       (*self)[key] = x;
     }
-SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__asdict(std::map< int,CdiGrid > *self){
-      return swig::traits_from< std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > >::asdict(*self);
-    }
 
 SWIGINTERN int
 SWIG_AsVal_bool (PyObject *obj, bool *val)
 {
-  int r = PyObject_IsTrue(obj);
-  if (r == -1)
-    return SWIG_ERROR;
-  if (val) *val = r ? true : false;
-  return SWIG_OK;
+  if (obj == Py_True) {
+    if (val) *val = true;
+    return SWIG_OK;
+  } else if (obj == Py_False) {
+    if (val) *val = false;
+    return SWIG_OK;
+  } else {
+    long v = 0;
+    int res = SWIG_AddCast(SWIG_AsVal_long (obj, val ? &v : 0));
+    if (SWIG_IsOK(res) && val) *val = v ? true : false;
+    return res;
+  }
 }
 
 
@@ -6131,20 +5307,21 @@ SWIG_FromCharPtr(const char *cptr)
 #ifdef __cplusplus
 extern "C" {
 #endif
-SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_delete_PySwigIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_SwigPyIterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_PySwigIterator",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySwigIterator" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -6152,22 +5329,22 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_value",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:PySwigIterator_value",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_value" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_value" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   try {
-    result = (PyObject *)((swig::SwigPyIterator const *)arg1)->value();
+    result = (PyObject *)((swig::PySwigIterator const *)arg1)->value();
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6184,31 +5361,31 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   size_t arg2 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_incr",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator_incr",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_incr" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_incr" "', argument " "2"" of type '" "size_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySwigIterator_incr" "', argument " "2"" of type '" "size_t""'");
   } 
   arg2 = static_cast< size_t >(val2);
   try {
-    result = (swig::SwigPyIterator *)(arg1)->incr(arg2);
+    result = (swig::PySwigIterator *)(arg1)->incr(arg2);
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6218,29 +5395,29 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_incr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_incr",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:PySwigIterator_incr",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_incr" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   try {
-    result = (swig::SwigPyIterator *)(arg1)->incr();
+    result = (swig::PySwigIterator *)(arg1)->incr();
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6250,36 +5427,36 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_1(PyObject *SWIGUNUSEDPARM(
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_incr(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_incr(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[3];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 1) {
     int _v;
     void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__PySwigIterator, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_SwigPyIterator_incr__SWIG_1(self, args);
+      return _wrap_PySwigIterator_incr__SWIG_1(self, args);
     }
   }
   if (argc == 2) {
     int _v;
     void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__PySwigIterator, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -6287,45 +5464,42 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator_incr(PyObject *self, PyObject *args) {
         _v = SWIG_CheckState(res);
       }
       if (_v) {
-        return _wrap_SwigPyIterator_incr__SWIG_0(self, args);
+        return _wrap_PySwigIterator_incr__SWIG_0(self, args);
       }
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SwigPyIterator_incr'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    swig::SwigPyIterator::incr(size_t)\n"
-    "    swig::SwigPyIterator::incr()\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'PySwigIterator_incr'.\n  Possible C/C++ prototypes are:\n    incr(size_t)\n    incr()\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_decr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   size_t arg2 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_decr",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator_decr",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_decr" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_decr" "', argument " "2"" of type '" "size_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySwigIterator_decr" "', argument " "2"" of type '" "size_t""'");
   } 
   arg2 = static_cast< size_t >(val2);
   try {
-    result = (swig::SwigPyIterator *)(arg1)->decr(arg2);
+    result = (swig::PySwigIterator *)(arg1)->decr(arg2);
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6335,29 +5509,29 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_0(PyObject *SWIGUNUSEDPARM(
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_decr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_decr",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:PySwigIterator_decr",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_decr" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   try {
-    result = (swig::SwigPyIterator *)(arg1)->decr();
+    result = (swig::PySwigIterator *)(arg1)->decr();
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6367,36 +5541,36 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_1(PyObject *SWIGUNUSEDPARM(
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_decr(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_decr(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[3];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 1) {
     int _v;
     void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__PySwigIterator, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_SwigPyIterator_decr__SWIG_1(self, args);
+      return _wrap_PySwigIterator_decr__SWIG_1(self, args);
     }
   }
   if (argc == 2) {
     int _v;
     void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__PySwigIterator, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -6404,48 +5578,45 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator_decr(PyObject *self, PyObject *args) {
         _v = SWIG_CheckState(res);
       }
       if (_v) {
-        return _wrap_SwigPyIterator_decr__SWIG_0(self, args);
+        return _wrap_PySwigIterator_decr__SWIG_0(self, args);
       }
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SwigPyIterator_decr'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    swig::SwigPyIterator::decr(size_t)\n"
-    "    swig::SwigPyIterator::decr()\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'PySwigIterator_decr'.\n  Possible C/C++ prototypes are:\n    decr(size_t)\n    decr()\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_distance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_distance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
-  swig::SwigPyIterator *arg2 = 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *arg2 = 0 ;
+  ptrdiff_t result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
   int res2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  ptrdiff_t result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_distance",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator_distance",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_distance" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_distance" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__PySwigIterator,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySwigIterator_distance" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySwigIterator_distance" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
-  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
+  arg2 = reinterpret_cast< swig::PySwigIterator * >(argp2);
   try {
-    result = ((swig::SwigPyIterator const *)arg1)->distance((swig::SwigPyIterator const &)*arg2);
+    result = ((swig::PySwigIterator const *)arg1)->distance((swig::PySwigIterator const &)*arg2);
   }
   catch(std::invalid_argument &_e) {
     SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail;
@@ -6458,34 +5629,34 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_equal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_equal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
-  swig::SwigPyIterator *arg2 = 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
   int res2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_equal",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator_equal",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_equal" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_equal" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__PySwigIterator,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySwigIterator_equal" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySwigIterator_equal" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
-  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
+  arg2 = reinterpret_cast< swig::PySwigIterator * >(argp2);
   try {
-    result = (bool)((swig::SwigPyIterator const *)arg1)->equal((swig::SwigPyIterator const &)*arg2);
+    result = (bool)((swig::PySwigIterator const *)arg1)->equal((swig::PySwigIterator const &)*arg2);
   }
   catch(std::invalid_argument &_e) {
     SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail;
@@ -6498,42 +5669,42 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_copy",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:PySwigIterator_copy",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_copy" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_copy" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
-  result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->copy();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
+  result = (swig::PySwigIterator *)((swig::PySwigIterator const *)arg1)->copy();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_next",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:PySwigIterator_next",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_next" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_next" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   try {
     result = (PyObject *)(arg1)->next();
   }
@@ -6552,52 +5723,20 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___next__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_previous(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   PyObject *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator___next__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___next__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
-  }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
-  try {
-    result = (PyObject *)(arg1)->__next__();
-  }
-  catch(swig::stop_iteration &_e) {
-    {
-      (void)_e;
-      SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
-      SWIG_fail;
-    }
-  }
-  
-  resultobj = result;
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_SwigPyIterator_previous(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_previous",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:PySwigIterator_previous",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_previous" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_previous" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   try {
     result = (PyObject *)(arg1)->previous();
   }
@@ -6616,31 +5755,31 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator_advance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator_advance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   ptrdiff_t arg2 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_advance",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator_advance",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_advance" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator_advance" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_advance" "', argument " "2"" of type '" "ptrdiff_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySwigIterator_advance" "', argument " "2"" of type '" "ptrdiff_t""'");
   } 
   arg2 = static_cast< ptrdiff_t >(val2);
   try {
-    result = (swig::SwigPyIterator *)(arg1)->advance(arg2);
+    result = (swig::PySwigIterator *)(arg1)->advance(arg2);
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6650,40 +5789,40 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator_advance(PyObject *SWIGUNUSEDPARM(self)
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
-  swig::SwigPyIterator *arg2 = 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
   int res2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___eq__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator___eq__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___eq__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator___eq__" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__PySwigIterator,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySwigIterator___eq__" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySwigIterator___eq__" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
-  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
-  result = (bool)((swig::SwigPyIterator const *)arg1)->operator ==((swig::SwigPyIterator const &)*arg2);
+  arg2 = reinterpret_cast< swig::PySwigIterator * >(argp2);
+  result = (bool)((swig::PySwigIterator const *)arg1)->operator ==((swig::PySwigIterator const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -6691,33 +5830,33 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
-  swig::SwigPyIterator *arg2 = 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
   int res2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___ne__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator___ne__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___ne__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator___ne__" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__PySwigIterator,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySwigIterator___ne__" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySwigIterator___ne__" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
-  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
-  result = (bool)((swig::SwigPyIterator const *)arg1)->operator !=((swig::SwigPyIterator const &)*arg2);
+  arg2 = reinterpret_cast< swig::PySwigIterator * >(argp2);
+  result = (bool)((swig::PySwigIterator const *)arg1)->operator !=((swig::PySwigIterator const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -6725,31 +5864,34 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   ptrdiff_t arg2 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___iadd__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator___iadd__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___iadd__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator___iadd__" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___iadd__" "', argument " "2"" of type '" "ptrdiff_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySwigIterator___iadd__" "', argument " "2"" of type '" "ptrdiff_t""'");
   } 
   arg2 = static_cast< ptrdiff_t >(val2);
   try {
-    result = (swig::SwigPyIterator *) &(arg1)->operator +=(arg2);
+    {
+      swig::PySwigIterator &_result_ref = (arg1)->operator +=(arg2);
+      result = (swig::PySwigIterator *) &_result_ref;
+    }
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6759,38 +5901,41 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator___iadd__(PyObject *SWIGUNUSEDPARM(self
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___isub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___isub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   ptrdiff_t arg2 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___isub__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator___isub__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___isub__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator___isub__" "', argument " "1"" of type '" "swig::PySwigIterator *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___isub__" "', argument " "2"" of type '" "ptrdiff_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySwigIterator___isub__" "', argument " "2"" of type '" "ptrdiff_t""'");
   } 
   arg2 = static_cast< ptrdiff_t >(val2);
   try {
-    result = (swig::SwigPyIterator *) &(arg1)->operator -=(arg2);
+    {
+      swig::PySwigIterator &_result_ref = (arg1)->operator -=(arg2);
+      result = (swig::PySwigIterator *) &_result_ref;
+    }
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6800,38 +5945,38 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator___isub__(PyObject *SWIGUNUSEDPARM(self
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   ptrdiff_t arg2 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___add__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator___add__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___add__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator___add__" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___add__" "', argument " "2"" of type '" "ptrdiff_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySwigIterator___add__" "', argument " "2"" of type '" "ptrdiff_t""'");
   } 
   arg2 = static_cast< ptrdiff_t >(val2);
   try {
-    result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator +(arg2);
+    result = (swig::PySwigIterator *)((swig::PySwigIterator const *)arg1)->operator +(arg2);
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6841,38 +5986,38 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator___add__(PyObject *SWIGUNUSEDPARM(self)
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___sub____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
   ptrdiff_t arg2 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___sub__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator___sub__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator___sub__" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "ptrdiff_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "PySwigIterator___sub__" "', argument " "2"" of type '" "ptrdiff_t""'");
   } 
   arg2 = static_cast< ptrdiff_t >(val2);
   try {
-    result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator -(arg2);
+    result = (swig::PySwigIterator *)((swig::PySwigIterator const *)arg1)->operator -(arg2);
   }
   catch(swig::stop_iteration &_e) {
     {
@@ -6882,40 +6027,40 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_0(PyObject *SWIGUNUSEDPA
     }
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___sub____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
-  swig::SwigPyIterator *arg2 = 0 ;
+  swig::PySwigIterator *arg1 = (swig::PySwigIterator *) 0 ;
+  swig::PySwigIterator *arg2 = 0 ;
+  ptrdiff_t result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
   int res2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  ptrdiff_t result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___sub__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:PySwigIterator___sub__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__PySwigIterator, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySwigIterator___sub__" "', argument " "1"" of type '" "swig::PySwigIterator const *""'"); 
   }
-  arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator,  0  | 0);
+  arg1 = reinterpret_cast< swig::PySwigIterator * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__PySwigIterator,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySwigIterator___sub__" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySwigIterator___sub__" "', argument " "2"" of type '" "swig::PySwigIterator const &""'"); 
   }
-  arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
-  result = ((swig::SwigPyIterator const *)arg1)->operator -((swig::SwigPyIterator const &)*arg2);
+  arg2 = reinterpret_cast< swig::PySwigIterator * >(argp2);
+  result = ((swig::PySwigIterator const *)arg1)->operator -((swig::PySwigIterator const &)*arg2);
   resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
   return resultobj;
 fail:
@@ -6923,33 +6068,33 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_SwigPyIterator___sub__(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySwigIterator___sub__(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[3];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
     void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__PySwigIterator, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
-      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_swig__SwigPyIterator, 0);
+      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_swig__PySwigIterator, 0);
       _v = SWIG_CheckState(res);
       if (_v) {
-        return _wrap_SwigPyIterator___sub____SWIG_1(self, args);
+        return _wrap_PySwigIterator___sub____SWIG_1(self, args);
       }
     }
   }
   if (argc == 2) {
     int _v;
     void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__PySwigIterator, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -6957,7 +6102,7 @@ SWIGINTERN PyObject *_wrap_SwigPyIterator___sub__(PyObject *self, PyObject *args
         _v = SWIG_CheckState(res);
       }
       if (_v) {
-        return _wrap_SwigPyIterator___sub____SWIG_0(self, args);
+        return _wrap_PySwigIterator___sub____SWIG_0(self, args);
       }
     }
   }
@@ -6968,31 +6113,31 @@ fail:
 }
 
 
-SWIGINTERN PyObject *SwigPyIterator_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *PySwigIterator_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_swig__SwigPyIterator, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_swig__PySwigIterator, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
 SWIGINTERN PyObject *_wrap_IntVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:IntVector_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_iterator" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_iterator" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (swig::SwigPyIterator *)std_vector_Sl_int_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = (swig::PySwigIterator *)std_vector_Sl_int_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -7001,41 +6146,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___nonzero__" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (bool)std_vector_Sl_int_Sg____nonzero__((std::vector< int > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_IntVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___bool__" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___nonzero__" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (bool)std_vector_Sl_int_Sg____bool__((std::vector< int > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = (bool)std_vector_Sl_int_Sg____nonzero__((std::vector<int > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -7045,19 +6168,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:IntVector___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___len__" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___len__" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = std_vector_Sl_int_Sg____len__((std::vector< int > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = std_vector_Sl_int_Sg____len__((std::vector<int > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -7067,20 +6190,20 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::value_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::value_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:IntVector_pop",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   try {
-    result = (std::vector< int >::value_type)std_vector_Sl_int_Sg__pop(arg1);
+    result = (std::vector<int >::value_type)std_vector_Sl_int_Sg__pop(arg1);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -7095,9 +6218,10 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::difference_type arg2 ;
-  std::vector< int >::difference_type arg3 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::difference_type arg2 ;
+  std::vector<int >::difference_type arg3 ;
+  std::vector<int,std::allocator<int > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -7107,44 +6231,43 @@ SWIGINTERN PyObject *_wrap_IntVector___getslice__(PyObject *SWIGUNUSEDPARM(self)
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< int,std::allocator< int > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector___getslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getslice__" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getslice__" "', argument " "2"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::difference_type >(val2);
+  arg2 = static_cast< std::vector<int >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___getslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___getslice__" "', argument " "3"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< int >::difference_type >(val3);
+  arg3 = static_cast< std::vector<int >::difference_type >(val3);
   try {
-    result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg____getslice__(arg1,arg2,arg3);
+    result = (std::vector<int,std::allocator<int > > *)std_vector_Sl_int_Sg____getslice__(arg1,arg2,arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::difference_type arg2 ;
-  std::vector< int >::difference_type arg3 ;
-  std::vector< int,std::allocator< int > > *arg4 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::difference_type arg2 ;
+  std::vector<int >::difference_type arg3 ;
+  std::vector<int,std::allocator<int > > *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -7158,34 +6281,34 @@ SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPA
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:IntVector___setslice__",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setslice__" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setslice__" "', argument " "2"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::difference_type >(val2);
+  arg2 = static_cast< std::vector<int >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setslice__" "', argument " "3"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< int >::difference_type >(val3);
+  arg3 = static_cast< std::vector<int >::difference_type >(val3);
   {
-    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
+    std::vector<int,std::allocator<int > > *ptr = (std::vector<int,std::allocator<int > > *)0;
     res4 = swig::asptr(obj3, &ptr);
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector<int,std::allocator<int > > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector<int,std::allocator<int > > const &""'"); 
     }
     arg4 = ptr;
   }
   try {
-    std_vector_Sl_int_Sg____setslice____SWIG_0(arg1,arg2,arg3,(std::vector< int,std::allocator< int > > const &)*arg4);
+    std_vector_Sl_int_Sg____setslice__(arg1,arg2,arg3,(std::vector<int,std::allocator<int > > const &)*arg4);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -7203,11 +6326,11 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::difference_type arg2 ;
-  std::vector< int >::difference_type arg3 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::difference_type arg2 ;
+  std::vector<int >::difference_type arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -7218,31 +6341,28 @@ SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPA
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector___setslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector___delslice__",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delslice__" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delslice__" "', argument " "2"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::difference_type >(val2);
+  arg2 = static_cast< std::vector<int >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___delslice__" "', argument " "3"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< int >::difference_type >(val3);
+  arg3 = static_cast< std::vector<int >::difference_type >(val3);
   try {
-    std_vector_Sl_int_Sg____setslice____SWIG_0(arg1,arg2,arg3);
+    std_vector_Sl_int_Sg____delslice__(arg1,arg2,arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
   
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -7251,103 +6371,30 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___setslice__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[5];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_IntVector___setslice____SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          int res = swig::asptr(argv[3], (std::vector<int,std::allocator< int > >**)(0));
-          _v = SWIG_CheckState(res);
-          if (_v) {
-            return _wrap_IntVector___setslice____SWIG_0(self, args);
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'IntVector___setslice__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::__setslice__(std::vector< int >::difference_type,std::vector< int >::difference_type,std::vector< int,std::allocator< int > > const &)\n"
-    "    std::vector< int >::__setslice__(std::vector< int >::difference_type,std::vector< int >::difference_type)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_IntVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::difference_type arg2 ;
-  std::vector< int >::difference_type arg3 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::difference_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
-  ptrdiff_t val3 ;
-  int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector___delslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector___delitem__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delitem__" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
-  } 
-  arg2 = static_cast< std::vector< int >::difference_type >(val2);
-  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___delslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delitem__" "', argument " "2"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< int >::difference_type >(val3);
+  arg2 = static_cast< std::vector<int >::difference_type >(val2);
   try {
-    std_vector_Sl_int_Sg____delslice__(arg1,arg2,arg3);
+    std_vector_Sl_int_Sg____delitem__(arg1,arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -7360,10 +6407,11 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::difference_type arg2 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::difference_type arg2 ;
+  std::vector<int >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -7371,362 +6419,246 @@ SWIGINTERN PyObject *_wrap_IntVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPAR
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector___getitem__",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getitem__" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getitem__" "', argument " "2"" of type '" "std::vector<int >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::difference_type >(val2);
+  arg2 = static_cast< std::vector<int >::difference_type >(val2);
   try {
-    std_vector_Sl_int_Sg____delitem____SWIG_0(arg1,arg2);
+    {
+      std::vector<int >::value_type const &_result_ref = std_vector_Sl_int_Sg____getitem__((std::vector<int > const *)arg1,arg2);
+      result = (std::vector<int >::value_type *) &_result_ref;
+    }
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_Py_Void();
+  resultobj = SWIG_From_int(static_cast< int >(*result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::difference_type arg2 ;
+  std::vector<int >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  ptrdiff_t val2 ;
+  int ecode2 = 0 ;
+  std::vector<int >::value_type temp3 ;
+  int val3 ;
+  int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< int,std::allocator< int > > *result = 0 ;
+  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "std::vector<int >::difference_type""'");
+  } 
+  arg2 = static_cast< std::vector<int >::difference_type >(val2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector<int >::value_type""'");
+  } 
+  temp3 = static_cast< std::vector<int >::value_type >(val3);
+  arg3 = &temp3;
   try {
-    result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg____getitem____SWIG_0(arg1,arg2);
+    std_vector_Sl_int_Sg____setitem__(arg1,arg2,(int const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  std::vector< int,std::allocator< int > > *arg3 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  int res3 = SWIG_OLDOBJ ;
+  std::vector<int >::value_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_append",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  {
-    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
-    res3 = swig::asptr(obj2, &ptr);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); 
-    }
-    arg3 = ptr;
-  }
-  try {
-    std_vector_Sl_int_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< int,std::allocator< int > > const &)*arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_append" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_append" "', argument " "2"" of type '" "std::vector<int >::value_type""'");
+  } 
+  temp2 = static_cast< std::vector<int >::value_type >(val2);
+  arg2 = &temp2;
+  std_vector_Sl_int_Sg__append(arg1,(int const &)*arg2);
   resultobj = SWIG_Py_Void();
-  if (SWIG_IsNewObj(res3)) delete arg3;
   return resultobj;
 fail:
-  if (SWIG_IsNewObj(res3)) delete arg3;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
+  std::vector<int > *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    std_vector_Sl_int_Sg____setitem____SWIG_1(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
+  if (!PyArg_ParseTuple(args,(char *)":new_IntVector")) SWIG_fail;
+  result = (std::vector<int > *)new std::vector<int >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
+  std::vector<int > *arg1 = 0 ;
+  std::vector<int > *result = 0 ;
+  int res1 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  if (!PyArg_ParseTuple(args,(char *)"O:new_IntVector",&obj0)) SWIG_fail;
   {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
+    std::vector<int,std::allocator<int > > *ptr = (std::vector<int,std::allocator<int > > *)0;
+    res1 = swig::asptr(obj0, &ptr);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector<int > const &""'"); 
     }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    std_vector_Sl_int_Sg____delitem____SWIG_1(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector<int > const &""'"); 
+    }
+    arg1 = ptr;
   }
-  
-  resultobj = SWIG_Py_Void();
+  result = (std::vector<int > *)new std::vector<int >((std::vector<int > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, SWIG_POINTER_NEW |  0 );
+  if (SWIG_IsNewObj(res1)) delete arg1;
   return resultobj;
 fail:
+  if (SWIG_IsNewObj(res1)) delete arg1;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___delitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
+SWIGINTERN PyObject *_wrap_IntVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
   
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_IntVector___delitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_IntVector___delitem____SWIG_0(self, args);
-      }
-    }
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_empty",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_empty" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = (bool)((std::vector<int > const *)arg1)->empty();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'IntVector___delitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::__delitem__(std::vector< int >::difference_type)\n"
-    "    std::vector< int >::__delitem__(PySliceObject *)\n");
-  return 0;
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::difference_type arg2 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  ptrdiff_t val2 ;
-  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  std::vector< int >::value_type *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_size",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getitem__" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
-  } 
-  arg2 = static_cast< std::vector< int >::difference_type >(val2);
-  try {
-    result = (std::vector< int >::value_type *) &std_vector_Sl_int_Sg____getitem____SWIG_1((std::vector< int > const *)arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_size" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  
-  resultobj = SWIG_From_int(static_cast< int >(*result));
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = ((std::vector<int > const *)arg1)->size();
+  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___getitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
+SWIGINTERN PyObject *_wrap_IntVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
   
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_IntVector___getitem____SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_IntVector___getitem____SWIG_1(self, args);
-      }
-    }
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_clear",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_clear" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  (arg1)->clear();
+  resultobj = SWIG_Py_Void();
+  return resultobj;
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'IntVector___getitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::__getitem__(PySliceObject *)\n"
-    "    std::vector< int >::__getitem__(std::vector< int >::difference_type) const\n");
-  return 0;
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::difference_type arg2 ;
-  std::vector< int >::value_type *arg3 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  ptrdiff_t val2 ;
-  int ecode2 = 0 ;
-  std::vector< int >::value_type temp3 ;
-  int val3 ;
-  int ecode3 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_swap",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_swap" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'");
-  } 
-  arg2 = static_cast< std::vector< int >::difference_type >(val2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
-  } 
-  temp3 = static_cast< std::vector< int >::value_type >(val3);
-  arg3 = &temp3;
-  try {
-    std_vector_Sl_int_Sg____setitem____SWIG_2(arg1,arg2,(int const &)*arg3);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector<int > &""'"); 
   }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector<int > &""'"); 
   }
-  
+  arg2 = reinterpret_cast< std::vector<int > * >(argp2);
+  (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -7734,379 +6666,360 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector___setitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
+SWIGINTERN PyObject *_wrap_IntVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  SwigValueWrapper<std::allocator<int > > result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
   
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_IntVector___setitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<int,std::allocator< int > >**)(0));
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_IntVector___setitem____SWIG_0(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_int(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_IntVector___setitem____SWIG_2(self, args);
-        }
-      }
-    }
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_get_allocator",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_get_allocator" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = ((std::vector<int > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::vector<int >::allocator_type(static_cast< const std::vector<int >::allocator_type& >(result))), SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
+  return resultobj;
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'IntVector___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::__setitem__(PySliceObject *,std::vector< int,std::allocator< int > > const &)\n"
-    "    std::vector< int >::__setitem__(PySliceObject *)\n"
-    "    std::vector< int >::__setitem__(std::vector< int >::difference_type,std::vector< int >::value_type const &)\n");
-  return 0;
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::value_type *arg2 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::vector< int >::value_type temp2 ;
-  int val2 ;
-  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_append",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_append" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_begin" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_append" "', argument " "2"" of type '" "std::vector< int >::value_type""'");
-  } 
-  temp2 = static_cast< std::vector< int >::value_type >(val2);
-  arg2 = &temp2;
-  std_vector_Sl_int_Sg__append(arg1,(int const &)*arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = (arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *result = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)":new_IntVector")) SWIG_fail;
-  result = (std::vector< int > *)new std::vector< int >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_begin" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = ((std::vector<int > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< int > *arg1 = 0 ;
-  int res1 = SWIG_OLDOBJ ;
-  PyObject * obj0 = 0 ;
-  std::vector< int > *result = 0 ;
+SWIGINTERN PyObject *_wrap_IntVector_begin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:new_IntVector",&obj0)) SWIG_fail;
-  {
-    std::vector<int,std::allocator< int > > *ptr = (std::vector<int,std::allocator< int > > *)0;
-    res1 = swig::asptr(obj0, &ptr);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int > const &""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_begin__SWIG_0(self, args);
     }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int > const &""'"); 
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_begin__SWIG_1(self, args);
     }
-    arg1 = ptr;
   }
-  result = (std::vector< int > *)new std::vector< int >((std::vector< int > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW |  0 );
-  if (SWIG_IsNewObj(res1)) delete arg1;
-  return resultobj;
+  
 fail:
-  if (SWIG_IsNewObj(res1)) delete arg1;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'IntVector_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_empty" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_end" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (bool)((std::vector< int > const *)arg1)->empty();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = (arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::size_type result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_size" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_end" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = ((std::vector< int > const *)arg1)->size();
-  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = ((std::vector<int > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+SWIGINTERN PyObject *_wrap_IntVector_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_clear" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  (arg1)->clear();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_end__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'IntVector_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int > *arg2 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_swap" "', argument " "1"" of type '" "std::vector< int > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t,  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector< int > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rbegin" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector< int > &""'"); 
-  }
-  arg2 = reinterpret_cast< std::vector< int > * >(argp2);
-  (arg1)->swap(*arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = (arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< int > > result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_get_allocator" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rbegin" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = ((std::vector< int > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::vector< int >::allocator_type(static_cast< const std::vector< int >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_int_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = ((std::vector<int > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::vector< int >::iterator result;
+SWIGINTERN PyObject *_wrap_IntVector_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_begin" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_rbegin__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'IntVector_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_end" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rend" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = (arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_IntVector_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::reverse_iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rbegin" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rend" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = ((std::vector<int > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_IntVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::vector< int >::reverse_iterator result;
+SWIGINTERN PyObject *_wrap_IntVector_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:IntVector_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rend" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_IntVector_rend__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'IntVector_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
   return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int >::size_type arg1 ;
+  std::vector<int >::size_type arg1 ;
+  std::vector<int > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_IntVector",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector<int >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< int >::size_type >(val1);
-  result = (std::vector< int > *)new std::vector< int >(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW |  0 );
+  arg1 = static_cast< std::vector<int >::size_type >(val1);
+  result = (std::vector<int > *)new std::vector<int >(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -8115,17 +7028,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:IntVector_pop_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop_back" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop_back" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   (arg1)->pop_back();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -8136,8 +7049,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::size_type arg2 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -8146,16 +7059,16 @@ SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(sel
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_resize",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector<int >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::size_type >(val2);
+  arg2 = static_cast< std::vector<int >::size_type >(val2);
   (arg1)->resize(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -8166,36 +7079,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::iterator arg2 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::iterator arg2 ;
+  std::vector<int >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< int >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<int >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -8204,51 +7117,51 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::iterator arg2 ;
-  std::vector< int >::iterator arg3 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::iterator arg2 ;
+  std::vector<int >::iterator arg3 ;
+  std::vector<int >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< int >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<int >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector<int >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::vector<int >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector<int >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2,arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -8261,18 +7174,18 @@ SWIGINTERN PyObject *_wrap_IntVector_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_IntVector_erase__SWIG_0(self, args);
       }
@@ -8280,16 +7193,16 @@ SWIGINTERN PyObject *_wrap_IntVector_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_IntVector_erase__SWIG_1(self, args);
         }
@@ -8298,41 +7211,38 @@ SWIGINTERN PyObject *_wrap_IntVector_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'IntVector_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::erase(std::vector< int >::iterator)\n"
-    "    std::vector< int >::erase(std::vector< int >::iterator,std::vector< int >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'IntVector_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::vector<int >::iterator)\n    erase(std::vector<int >::iterator,std::vector<int >::iterator)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int >::size_type arg1 ;
-  std::vector< int >::value_type *arg2 = 0 ;
+  std::vector<int >::size_type arg1 ;
+  std::vector<int >::value_type *arg2 = 0 ;
+  std::vector<int > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
-  std::vector< int >::value_type temp2 ;
+  std::vector<int >::value_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< int > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:new_IntVector",&obj0,&obj1)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector<int >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< int >::size_type >(val1);
+  arg1 = static_cast< std::vector<int >::size_type >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_IntVector" "', argument " "2"" of type '" "std::vector< int >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_IntVector" "', argument " "2"" of type '" "std::vector<int >::value_type""'");
   } 
-  temp2 = static_cast< std::vector< int >::value_type >(val2);
+  temp2 = static_cast< std::vector<int >::value_type >(val2);
   arg2 = &temp2;
-  result = (std::vector< int > *)new std::vector< int >(arg1,(std::vector< int >::value_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<int > *)new std::vector<int >(arg1,(std::vector<int >::value_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -8345,8 +7255,8 @@ SWIGINTERN PyObject *_wrap_new_IntVector(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -8364,7 +7274,7 @@ SWIGINTERN PyObject *_wrap_new_IntVector(PyObject *self, PyObject *args) {
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       return _wrap_new_IntVector__SWIG_1(self, args);
@@ -8388,41 +7298,36 @@ SWIGINTERN PyObject *_wrap_new_IntVector(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_IntVector'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::vector()\n"
-    "    std::vector< int >::vector(std::vector< int > const &)\n"
-    "    std::vector< int >::vector(std::vector< int >::size_type)\n"
-    "    std::vector< int >::vector(std::vector< int >::size_type,std::vector< int >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_IntVector'.\n  Possible C/C++ prototypes are:\n    std::vector<(int)>()\n    std::vector<(int)>(std::vector<int > const &)\n    std::vector<(int)>(std::vector<int >::size_type)\n    std::vector<(int)>(std::vector<int >::size_type,std::vector<int >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_IntVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::value_type *arg2 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::vector< int >::value_type temp2 ;
+  std::vector<int >::value_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_push_back",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_push_back" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_push_back" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_push_back" "', argument " "2"" of type '" "std::vector< int >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_push_back" "', argument " "2"" of type '" "std::vector<int >::value_type""'");
   } 
-  temp2 = static_cast< std::vector< int >::value_type >(val2);
+  temp2 = static_cast< std::vector<int >::value_type >(val2);
   arg2 = &temp2;
-  (arg1)->push_back((std::vector< int >::value_type const &)*arg2);
+  (arg1)->push_back((std::vector<int >::value_type const &)*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -8432,19 +7337,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:IntVector_front",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_front" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_front" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  {
+    std::vector<int >::value_type const &_result_ref = ((std::vector<int > const *)arg1)->front();
+    result = (std::vector<int >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->front();
   resultobj = SWIG_From_int(static_cast< int >(*result));
   return resultobj;
 fail:
@@ -8454,19 +7362,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:IntVector_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_back" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_back" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  {
+    std::vector<int >::value_type const &_result_ref = ((std::vector<int > const *)arg1)->back();
+    result = (std::vector<int >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->back();
   resultobj = SWIG_From_int(static_cast< int >(*result));
   return resultobj;
 fail:
@@ -8476,14 +7387,14 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::size_type arg2 ;
-  std::vector< int >::value_type *arg3 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::size_type arg2 ;
+  std::vector<int >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
   int ecode2 = 0 ;
-  std::vector< int >::value_type temp3 ;
+  std::vector<int >::value_type temp3 ;
   int val3 ;
   int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
@@ -8491,23 +7402,23 @@ SWIGINTERN PyObject *_wrap_IntVector_assign(PyObject *SWIGUNUSEDPARM(self), PyOb
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector_assign",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_assign" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_assign" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_assign" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_assign" "', argument " "2"" of type '" "std::vector<int >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::size_type >(val2);
+  arg2 = static_cast< std::vector<int >::size_type >(val2);
   ecode3 = SWIG_AsVal_int(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_assign" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_assign" "', argument " "3"" of type '" "std::vector<int >::value_type""'");
   } 
-  temp3 = static_cast< std::vector< int >::value_type >(val3);
+  temp3 = static_cast< std::vector<int >::value_type >(val3);
   arg3 = &temp3;
-  (arg1)->assign(arg2,(std::vector< int >::value_type const &)*arg3);
+  (arg1)->assign(arg2,(std::vector<int >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -8517,14 +7428,14 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::size_type arg2 ;
-  std::vector< int >::value_type *arg3 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::size_type arg2 ;
+  std::vector<int >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
   int ecode2 = 0 ;
-  std::vector< int >::value_type temp3 ;
+  std::vector<int >::value_type temp3 ;
   int val3 ;
   int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
@@ -8532,23 +7443,23 @@ SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(sel
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector_resize",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector<int >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::size_type >(val2);
+  arg2 = static_cast< std::vector<int >::size_type >(val2);
   ecode3 = SWIG_AsVal_int(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_resize" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_resize" "', argument " "3"" of type '" "std::vector<int >::value_type""'");
   } 
-  temp3 = static_cast< std::vector< int >::value_type >(val3);
+  temp3 = static_cast< std::vector<int >::value_type >(val3);
   arg3 = &temp3;
-  (arg1)->resize(arg2,(std::vector< int >::value_type const &)*arg3);
+  (arg1)->resize(arg2,(std::vector<int >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -8562,13 +7473,13 @@ SWIGINTERN PyObject *_wrap_IntVector_resize(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -8582,7 +7493,7 @@ SWIGINTERN PyObject *_wrap_IntVector_resize(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -8602,57 +7513,54 @@ SWIGINTERN PyObject *_wrap_IntVector_resize(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'IntVector_resize'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::resize(std::vector< int >::size_type)\n"
-    "    std::vector< int >::resize(std::vector< int >::size_type,std::vector< int >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'IntVector_resize'.\n  Possible C/C++ prototypes are:\n    resize(std::vector<int >::size_type)\n    resize(std::vector<int >::size_type,std::vector<int >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_IntVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::iterator arg2 ;
-  std::vector< int >::value_type *arg3 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::iterator arg2 ;
+  std::vector<int >::value_type *arg3 = 0 ;
+  std::vector<int >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  std::vector< int >::value_type temp3 ;
+  std::vector<int >::value_type temp3 ;
   int val3 ;
   int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< int >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:IntVector_insert",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<int >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
     }
   }
   ecode3 = SWIG_AsVal_int(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector< int >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector<int >::value_type""'");
   } 
-  temp3 = static_cast< std::vector< int >::value_type >(val3);
+  temp3 = static_cast< std::vector<int >::value_type >(val3);
   arg3 = &temp3;
-  result = (arg1)->insert(arg2,(std::vector< int >::value_type const &)*arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->insert(arg2,(std::vector<int >::value_type const &)*arg3);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<int >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -8661,17 +7569,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::iterator arg2 ;
-  std::vector< int >::size_type arg3 ;
-  std::vector< int >::value_type *arg4 = 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::iterator arg2 ;
+  std::vector<int >::size_type arg3 ;
+  std::vector<int >::value_type *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   size_t val3 ;
   int ecode3 = 0 ;
-  std::vector< int >::value_type temp4 ;
+  std::vector<int >::value_type temp4 ;
   int val4 ;
   int ecode4 = 0 ;
   PyObject * obj0 = 0 ;
@@ -8680,34 +7588,34 @@ SWIGINTERN PyObject *_wrap_IntVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(sel
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:IntVector_insert",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<int >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector<int >::iterator""'");
     }
   }
   ecode3 = SWIG_AsVal_size_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector< int >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector<int >::size_type""'");
   } 
-  arg3 = static_cast< std::vector< int >::size_type >(val3);
+  arg3 = static_cast< std::vector<int >::size_type >(val3);
   ecode4 = SWIG_AsVal_int(obj3, &val4);
   if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "IntVector_insert" "', argument " "4"" of type '" "std::vector< int >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "IntVector_insert" "', argument " "4"" of type '" "std::vector<int >::value_type""'");
   } 
-  temp4 = static_cast< std::vector< int >::value_type >(val4);
+  temp4 = static_cast< std::vector<int >::value_type >(val4);
   arg4 = &temp4;
-  (arg1)->insert(arg2,arg3,(std::vector< int >::value_type const &)*arg4);
+  (arg1)->insert(arg2,arg3,(std::vector<int >::value_type const &)*arg4);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -8721,18 +7629,18 @@ SWIGINTERN PyObject *_wrap_IntVector_insert(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter) != 0));
       if (_v) {
         {
           int res = SWIG_AsVal_int(argv[2], NULL);
@@ -8746,12 +7654,12 @@ SWIGINTERN PyObject *_wrap_IntVector_insert(PyObject *self, PyObject *args) {
   }
   if (argc == 4) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<int,std::allocator< int > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<int,std::allocator<int > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<int >::iterator > *>(iter) != 0));
       if (_v) {
         {
           int res = SWIG_AsVal_size_t(argv[2], NULL);
@@ -8771,18 +7679,15 @@ SWIGINTERN PyObject *_wrap_IntVector_insert(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'IntVector_insert'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< int >::insert(std::vector< int >::iterator,std::vector< int >::value_type const &)\n"
-    "    std::vector< int >::insert(std::vector< int >::iterator,std::vector< int >::size_type,std::vector< int >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'IntVector_insert'.\n  Possible C/C++ prototypes are:\n    insert(std::vector<int >::iterator,std::vector<int >::value_type const &)\n    insert(std::vector<int >::iterator,std::vector<int >::size_type,std::vector<int >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_IntVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
-  std::vector< int >::size_type arg2 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -8791,16 +7696,16 @@ SWIGINTERN PyObject *_wrap_IntVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyO
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:IntVector_reserve",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_reserve" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_reserve" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_reserve" "', argument " "2"" of type '" "std::vector< int >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_reserve" "', argument " "2"" of type '" "std::vector<int >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< int >::size_type >(val2);
+  arg2 = static_cast< std::vector<int >::size_type >(val2);
   (arg1)->reserve(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -8811,19 +7716,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_IntVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
+  std::vector<int >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:IntVector_capacity",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_capacity" "', argument " "1"" of type '" "std::vector< int > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_capacity" "', argument " "1"" of type '" "std::vector<int > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
-  result = ((std::vector< int > const *)arg1)->capacity();
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
+  result = ((std::vector<int > const *)arg1)->capacity();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -8833,18 +7738,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_delete_IntVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< int > *arg1 = (std::vector< int > *) 0 ;
+  std::vector<int > *arg1 = (std::vector<int > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_IntVector",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IntVector" "', argument " "1"" of type '" "std::vector< int > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IntVector" "', argument " "1"" of type '" "std::vector<int > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< int > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<int > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -8854,29 +7760,29 @@ fail:
 
 SWIGINTERN PyObject *IntVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
 SWIGINTERN PyObject *_wrap_DoubleVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_iterator" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_iterator" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = (swig::SwigPyIterator *)std_vector_Sl_double_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = (swig::PySwigIterator *)std_vector_Sl_double_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -8885,41 +7791,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = (bool)std_vector_Sl_double_Sg____nonzero__((std::vector< double > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___bool__" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = (bool)std_vector_Sl_double_Sg____bool__((std::vector< double > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = (bool)std_vector_Sl_double_Sg____nonzero__((std::vector<double > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -8929,19 +7813,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___len__" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___len__" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = std_vector_Sl_double_Sg____len__((std::vector< double > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = std_vector_Sl_double_Sg____len__((std::vector<double > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -8951,20 +7835,20 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::value_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::value_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_pop",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   try {
-    result = (std::vector< double >::value_type)std_vector_Sl_double_Sg__pop(arg1);
+    result = (std::vector<double >::value_type)std_vector_Sl_double_Sg__pop(arg1);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -8979,9 +7863,10 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::difference_type arg2 ;
-  std::vector< double >::difference_type arg3 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::difference_type arg2 ;
+  std::vector<double >::difference_type arg3 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -8991,44 +7876,43 @@ SWIGINTERN PyObject *_wrap_DoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector___getslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getslice__" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getslice__" "', argument " "2"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::difference_type >(val2);
+  arg2 = static_cast< std::vector<double >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___getslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___getslice__" "', argument " "3"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< double >::difference_type >(val3);
+  arg3 = static_cast< std::vector<double >::difference_type >(val3);
   try {
-    result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getslice__(arg1,arg2,arg3);
+    result = (std::vector<double,std::allocator<double > > *)std_vector_Sl_double_Sg____getslice__(arg1,arg2,arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::difference_type arg2 ;
-  std::vector< double >::difference_type arg3 ;
-  std::vector< double,std::allocator< double > > *arg4 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::difference_type arg2 ;
+  std::vector<double >::difference_type arg3 ;
+  std::vector<double,std::allocator<double > > *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -9042,34 +7926,34 @@ SWIGINTERN PyObject *_wrap_DoubleVector___setslice____SWIG_0(PyObject *SWIGUNUSE
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:DoubleVector___setslice__",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::difference_type >(val2);
+  arg2 = static_cast< std::vector<double >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< double >::difference_type >(val3);
+  arg3 = static_cast< std::vector<double >::difference_type >(val3);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res4 = swig::asptr(obj3, &ptr);
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector<double,std::allocator<double > > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector<double,std::allocator<double > > const &""'"); 
     }
     arg4 = ptr;
   }
   try {
-    std_vector_Sl_double_Sg____setslice____SWIG_0(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4);
+    std_vector_Sl_double_Sg____setslice__(arg1,arg2,arg3,(std::vector<double,std::allocator<double > > const &)*arg4);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -9087,123 +7971,11 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::difference_type arg2 ;
-  std::vector< double >::difference_type arg3 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  ptrdiff_t val2 ;
-  int ecode2 = 0 ;
-  ptrdiff_t val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector___setslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
-  } 
-  arg2 = static_cast< std::vector< double >::difference_type >(val2);
-  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
-  } 
-  arg3 = static_cast< std::vector< double >::difference_type >(val3);
-  try {
-    std_vector_Sl_double_Sg____setslice____SWIG_0(arg1,arg2,arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___setslice__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[5];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_DoubleVector___setslice____SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          int res = swig::asptr(argv[3], (std::vector<double,std::allocator< double > >**)(0));
-          _v = SWIG_CheckState(res);
-          if (_v) {
-            return _wrap_DoubleVector___setslice____SWIG_0(self, args);
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector___setslice__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type,std::vector< double,std::allocator< double > > const &)\n"
-    "    std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_DoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::difference_type arg2 ;
-  std::vector< double >::difference_type arg3 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::difference_type arg2 ;
+  std::vector<double >::difference_type arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -9215,21 +7987,21 @@ SWIGINTERN PyObject *_wrap_DoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector___delslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delslice__" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delslice__" "', argument " "2"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::difference_type >(val2);
+  arg2 = static_cast< std::vector<double >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___delslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___delslice__" "', argument " "3"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< double >::difference_type >(val3);
+  arg3 = static_cast< std::vector<double >::difference_type >(val3);
   try {
     std_vector_Sl_double_Sg____delslice__(arg1,arg2,arg3);
   }
@@ -9244,10 +8016,10 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::difference_type arg2 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::difference_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -9256,178 +8028,18 @@ SWIGINTERN PyObject *_wrap_DoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSED
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::difference_type >(val2);
-  try {
-    std_vector_Sl_double_Sg____delitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  std::vector< double,std::allocator< double > > *arg3 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res3 = SWIG_OLDOBJ ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
-    res3 = swig::asptr(obj2, &ptr);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); 
-    }
-    arg3 = ptr;
-  }
-  try {
-    std_vector_Sl_double_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return resultobj;
-fail:
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    std_vector_Sl_double_Sg____setitem____SWIG_1(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
+  arg2 = static_cast< std::vector<double >::difference_type >(val2);
   try {
-    std_vector_Sl_double_Sg____delitem____SWIG_1(arg1,arg2);
+    std_vector_Sl_double_Sg____delitem__(arg1,arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -9440,78 +8052,34 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector___delitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_DoubleVector___delitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_DoubleVector___delitem____SWIG_0(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector___delitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::__delitem__(std::vector< double >::difference_type)\n"
-    "    std::vector< double >::__delitem__(PySliceObject *)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::difference_type arg2 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::difference_type arg2 ;
+  std::vector<double >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< double >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::difference_type >(val2);
+  arg2 = static_cast< std::vector<double >::difference_type >(val2);
   try {
-    result = (std::vector< double >::value_type *) &std_vector_Sl_double_Sg____getitem____SWIG_1((std::vector< double > const *)arg1,arg2);
+    {
+      std::vector<double >::value_type const &_result_ref = std_vector_Sl_double_Sg____getitem__((std::vector<double > const *)arg1,arg2);
+      result = (std::vector<double >::value_type *) &_result_ref;
+    }
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -9524,63 +8092,16 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector___getitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_DoubleVector___getitem____SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_DoubleVector___getitem____SWIG_1(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector___getitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::__getitem__(PySliceObject *)\n"
-    "    std::vector< double >::__getitem__(std::vector< double >::difference_type) const\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::difference_type arg2 ;
-  std::vector< double >::value_type *arg3 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::difference_type arg2 ;
+  std::vector<double >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
-  std::vector< double >::value_type temp3 ;
+  std::vector<double >::value_type temp3 ;
   double val3 ;
   int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
@@ -9588,24 +8109,24 @@ SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSED
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "std::vector<double >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::difference_type >(val2);
+  arg2 = static_cast< std::vector<double >::difference_type >(val2);
   ecode3 = SWIG_AsVal_double(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp3 = static_cast< std::vector< double >::value_type >(val3);
+  temp3 = static_cast< std::vector<double >::value_type >(val3);
   arg3 = &temp3;
   try {
-    std_vector_Sl_double_Sg____setitem____SWIG_2(arg1,arg2,(double const &)*arg3);
+    std_vector_Sl_double_Sg____setitem__(arg1,arg2,(double const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -9618,100 +8139,29 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector___setitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_DoubleVector___setitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<double,std::allocator< double > >**)(0));
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_DoubleVector___setitem____SWIG_0(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_double(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_DoubleVector___setitem____SWIG_2(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::__setitem__(PySliceObject *,std::vector< double,std::allocator< double > > const &)\n"
-    "    std::vector< double >::__setitem__(PySliceObject *)\n"
-    "    std::vector< double >::__setitem__(std::vector< double >::difference_type,std::vector< double >::value_type const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_DoubleVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::value_type *arg2 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::vector< double >::value_type temp2 ;
+  std::vector<double >::value_type temp2 ;
   double val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector_append",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_append" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_append" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_double(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_append" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_append" "', argument " "2"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp2 = static_cast< std::vector< double >::value_type >(val2);
+  temp2 = static_cast< std::vector<double >::value_type >(val2);
   arg2 = &temp2;
   std_vector_Sl_double_Sg__append(arg1,(double const &)*arg2);
   resultobj = SWIG_Py_Void();
@@ -9723,11 +8173,11 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *result = 0 ;
+  std::vector<double > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)":new_DoubleVector")) SWIG_fail;
-  result = (std::vector< double > *)new std::vector< double >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<double > *)new std::vector<double >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -9736,25 +8186,25 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = 0 ;
+  std::vector<double > *arg1 = 0 ;
+  std::vector<double > *result = 0 ;
   int res1 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
-  std::vector< double > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_DoubleVector",&obj0)) SWIG_fail;
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res1 = swig::asptr(obj0, &ptr);
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector<double > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector<double > const &""'"); 
     }
     arg1 = ptr;
   }
-  result = (std::vector< double > *)new std::vector< double >((std::vector< double > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<double > *)new std::vector<double >((std::vector<double > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res1)) delete arg1;
   return resultobj;
 fail:
@@ -9765,19 +8215,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_empty" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_empty" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = (bool)((std::vector< double > const *)arg1)->empty();
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = (bool)((std::vector<double > const *)arg1)->empty();
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -9787,19 +8237,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_size" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_size" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = ((std::vector< double > const *)arg1)->size();
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = ((std::vector<double > const *)arg1)->size();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -9809,17 +8259,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_clear" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_clear" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   (arg1)->clear();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -9830,8 +8280,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double > *arg2 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -9840,19 +8290,19 @@ SWIGINTERN PyObject *_wrap_DoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyO
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_swap" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_swap" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t,  0 );
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t,  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< double > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector<double > &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< double > &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector<double > &""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double > * >(argp2);
   (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -9863,134 +8313,358 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  SwigValueWrapper<std::allocator<double > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< double > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = ((std::vector< double > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::vector< double >::allocator_type(static_cast< const std::vector< double >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_double_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = ((std::vector<double > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::vector<double >::allocator_type(static_cast< const std::vector<double >::allocator_type& >(result))), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_begin" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_begin" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleVector_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_begin" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = ((std::vector<double > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector_begin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_begin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_begin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleVector_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleVector_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_end" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_end" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleVector_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_end" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = ((std::vector<double > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_end__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleVector_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleVector_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rbegin" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rbegin" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleVector_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rbegin" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = ((std::vector<double > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleVector_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_rbegin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleVector_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleVector_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rend" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rend" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleVector_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rend" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = ((std::vector<double > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_DoubleVector_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleVector_rend__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleVector_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double >::size_type arg1 ;
+  std::vector<double >::size_type arg1 ;
+  std::vector<double > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_DoubleVector",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector<double >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< double >::size_type >(val1);
-  result = (std::vector< double > *)new std::vector< double >(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW |  0 );
+  arg1 = static_cast< std::vector<double >::size_type >(val1);
+  result = (std::vector<double > *)new std::vector<double >(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -9999,17 +8673,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_pop_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop_back" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop_back" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   (arg1)->pop_back();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -10020,8 +8694,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::size_type arg2 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -10030,16 +8704,16 @@ SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector_resize",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector<double >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::size_type >(val2);
+  arg2 = static_cast< std::vector<double >::size_type >(val2);
   (arg1)->resize(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -10050,36 +8724,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::iterator arg2 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::iterator arg2 ;
+  std::vector<double >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< double >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<double >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -10088,51 +8762,51 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::iterator arg2 ;
-  std::vector< double >::iterator arg3 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::iterator arg2 ;
+  std::vector<double >::iterator arg3 ;
+  std::vector<double >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< double >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<double >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector<double >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::vector<double >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector<double >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2,arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -10145,18 +8819,18 @@ SWIGINTERN PyObject *_wrap_DoubleVector_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_DoubleVector_erase__SWIG_0(self, args);
       }
@@ -10164,16 +8838,16 @@ SWIGINTERN PyObject *_wrap_DoubleVector_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_DoubleVector_erase__SWIG_1(self, args);
         }
@@ -10182,41 +8856,38 @@ SWIGINTERN PyObject *_wrap_DoubleVector_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::erase(std::vector< double >::iterator)\n"
-    "    std::vector< double >::erase(std::vector< double >::iterator,std::vector< double >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleVector_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::vector<double >::iterator)\n    erase(std::vector<double >::iterator,std::vector<double >::iterator)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double >::size_type arg1 ;
-  std::vector< double >::value_type *arg2 = 0 ;
+  std::vector<double >::size_type arg1 ;
+  std::vector<double >::value_type *arg2 = 0 ;
+  std::vector<double > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
-  std::vector< double >::value_type temp2 ;
+  std::vector<double >::value_type temp2 ;
   double val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< double > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:new_DoubleVector",&obj0,&obj1)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector<double >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< double >::size_type >(val1);
+  arg1 = static_cast< std::vector<double >::size_type >(val1);
   ecode2 = SWIG_AsVal_double(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DoubleVector" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DoubleVector" "', argument " "2"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp2 = static_cast< std::vector< double >::value_type >(val2);
+  temp2 = static_cast< std::vector<double >::value_type >(val2);
   arg2 = &temp2;
-  result = (std::vector< double > *)new std::vector< double >(arg1,(std::vector< double >::value_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<double > *)new std::vector<double >(arg1,(std::vector<double >::value_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -10229,8 +8900,8 @@ SWIGINTERN PyObject *_wrap_new_DoubleVector(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -10248,7 +8919,7 @@ SWIGINTERN PyObject *_wrap_new_DoubleVector(PyObject *self, PyObject *args) {
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       return _wrap_new_DoubleVector__SWIG_1(self, args);
@@ -10272,41 +8943,36 @@ SWIGINTERN PyObject *_wrap_new_DoubleVector(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_DoubleVector'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::vector()\n"
-    "    std::vector< double >::vector(std::vector< double > const &)\n"
-    "    std::vector< double >::vector(std::vector< double >::size_type)\n"
-    "    std::vector< double >::vector(std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_DoubleVector'.\n  Possible C/C++ prototypes are:\n    std::vector<(double)>()\n    std::vector<(double)>(std::vector<double > const &)\n    std::vector<(double)>(std::vector<double >::size_type)\n    std::vector<(double)>(std::vector<double >::size_type,std::vector<double >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_DoubleVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::value_type *arg2 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::vector< double >::value_type temp2 ;
+  std::vector<double >::value_type temp2 ;
   double val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector_push_back",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_push_back" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_push_back" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_double(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_push_back" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_push_back" "', argument " "2"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp2 = static_cast< std::vector< double >::value_type >(val2);
+  temp2 = static_cast< std::vector<double >::value_type >(val2);
   arg2 = &temp2;
-  (arg1)->push_back((std::vector< double >::value_type const &)*arg2);
+  (arg1)->push_back((std::vector<double >::value_type const &)*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -10316,19 +8982,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_front",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_front" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_front" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  {
+    std::vector<double >::value_type const &_result_ref = ((std::vector<double > const *)arg1)->front();
+    result = (std::vector<double >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->front();
   resultobj = SWIG_From_double(static_cast< double >(*result));
   return resultobj;
 fail:
@@ -10338,19 +9007,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_back" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_back" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  {
+    std::vector<double >::value_type const &_result_ref = ((std::vector<double > const *)arg1)->back();
+    result = (std::vector<double >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->back();
   resultobj = SWIG_From_double(static_cast< double >(*result));
   return resultobj;
 fail:
@@ -10360,14 +9032,14 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::size_type arg2 ;
-  std::vector< double >::value_type *arg3 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::size_type arg2 ;
+  std::vector<double >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
   int ecode2 = 0 ;
-  std::vector< double >::value_type temp3 ;
+  std::vector<double >::value_type temp3 ;
   double val3 ;
   int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
@@ -10375,23 +9047,23 @@ SWIGINTERN PyObject *_wrap_DoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), P
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector_assign",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_assign" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_assign" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_assign" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_assign" "', argument " "2"" of type '" "std::vector<double >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::size_type >(val2);
+  arg2 = static_cast< std::vector<double >::size_type >(val2);
   ecode3 = SWIG_AsVal_double(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_assign" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_assign" "', argument " "3"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp3 = static_cast< std::vector< double >::value_type >(val3);
+  temp3 = static_cast< std::vector<double >::value_type >(val3);
   arg3 = &temp3;
-  (arg1)->assign(arg2,(std::vector< double >::value_type const &)*arg3);
+  (arg1)->assign(arg2,(std::vector<double >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -10401,14 +9073,14 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::size_type arg2 ;
-  std::vector< double >::value_type *arg3 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::size_type arg2 ;
+  std::vector<double >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
   int ecode2 = 0 ;
-  std::vector< double >::value_type temp3 ;
+  std::vector<double >::value_type temp3 ;
   double val3 ;
   int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
@@ -10416,23 +9088,23 @@ SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector_resize",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector<double >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::size_type >(val2);
+  arg2 = static_cast< std::vector<double >::size_type >(val2);
   ecode3 = SWIG_AsVal_double(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_resize" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_resize" "', argument " "3"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp3 = static_cast< std::vector< double >::value_type >(val3);
+  temp3 = static_cast< std::vector<double >::value_type >(val3);
   arg3 = &temp3;
-  (arg1)->resize(arg2,(std::vector< double >::value_type const &)*arg3);
+  (arg1)->resize(arg2,(std::vector<double >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -10446,13 +9118,13 @@ SWIGINTERN PyObject *_wrap_DoubleVector_resize(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -10466,7 +9138,7 @@ SWIGINTERN PyObject *_wrap_DoubleVector_resize(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -10486,57 +9158,54 @@ SWIGINTERN PyObject *_wrap_DoubleVector_resize(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector_resize'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::resize(std::vector< double >::size_type)\n"
-    "    std::vector< double >::resize(std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleVector_resize'.\n  Possible C/C++ prototypes are:\n    resize(std::vector<double >::size_type)\n    resize(std::vector<double >::size_type,std::vector<double >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::iterator arg2 ;
-  std::vector< double >::value_type *arg3 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::iterator arg2 ;
+  std::vector<double >::value_type *arg3 = 0 ;
+  std::vector<double >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  std::vector< double >::value_type temp3 ;
+  std::vector<double >::value_type temp3 ;
   double val3 ;
   int ecode3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< double >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleVector_insert",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<double >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
     }
   }
   ecode3 = SWIG_AsVal_double(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp3 = static_cast< std::vector< double >::value_type >(val3);
+  temp3 = static_cast< std::vector<double >::value_type >(val3);
   arg3 = &temp3;
-  result = (arg1)->insert(arg2,(std::vector< double >::value_type const &)*arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->insert(arg2,(std::vector<double >::value_type const &)*arg3);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<double >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -10545,17 +9214,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::iterator arg2 ;
-  std::vector< double >::size_type arg3 ;
-  std::vector< double >::value_type *arg4 = 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::iterator arg2 ;
+  std::vector<double >::size_type arg3 ;
+  std::vector<double >::value_type *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   size_t val3 ;
   int ecode3 = 0 ;
-  std::vector< double >::value_type temp4 ;
+  std::vector<double >::value_type temp4 ;
   double val4 ;
   int ecode4 = 0 ;
   PyObject * obj0 = 0 ;
@@ -10564,34 +9233,34 @@ SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:DoubleVector_insert",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<double >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector<double >::iterator""'");
     }
   }
   ecode3 = SWIG_AsVal_size_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector<double >::size_type""'");
   } 
-  arg3 = static_cast< std::vector< double >::size_type >(val3);
+  arg3 = static_cast< std::vector<double >::size_type >(val3);
   ecode4 = SWIG_AsVal_double(obj3, &val4);
   if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DoubleVector_insert" "', argument " "4"" of type '" "std::vector< double >::value_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DoubleVector_insert" "', argument " "4"" of type '" "std::vector<double >::value_type""'");
   } 
-  temp4 = static_cast< std::vector< double >::value_type >(val4);
+  temp4 = static_cast< std::vector<double >::value_type >(val4);
   arg4 = &temp4;
-  (arg1)->insert(arg2,arg3,(std::vector< double >::value_type const &)*arg4);
+  (arg1)->insert(arg2,arg3,(std::vector<double >::value_type const &)*arg4);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -10605,18 +9274,18 @@ SWIGINTERN PyObject *_wrap_DoubleVector_insert(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter) != 0));
       if (_v) {
         {
           int res = SWIG_AsVal_double(argv[2], NULL);
@@ -10630,12 +9299,12 @@ SWIGINTERN PyObject *_wrap_DoubleVector_insert(PyObject *self, PyObject *args) {
   }
   if (argc == 4) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<double,std::allocator< double > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<double,std::allocator<double > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<double >::iterator > *>(iter) != 0));
       if (_v) {
         {
           int res = SWIG_AsVal_size_t(argv[2], NULL);
@@ -10655,18 +9324,15 @@ SWIGINTERN PyObject *_wrap_DoubleVector_insert(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleVector_insert'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< double >::insert(std::vector< double >::iterator,std::vector< double >::value_type const &)\n"
-    "    std::vector< double >::insert(std::vector< double >::iterator,std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleVector_insert'.\n  Possible C/C++ prototypes are:\n    insert(std::vector<double >::iterator,std::vector<double >::value_type const &)\n    insert(std::vector<double >::iterator,std::vector<double >::size_type,std::vector<double >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_DoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
-  std::vector< double >::size_type arg2 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -10675,16 +9341,16 @@ SWIGINTERN PyObject *_wrap_DoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self),
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleVector_reserve",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_reserve" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_reserve" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_reserve" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_reserve" "', argument " "2"" of type '" "std::vector<double >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< double >::size_type >(val2);
+  arg2 = static_cast< std::vector<double >::size_type >(val2);
   (arg1)->reserve(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -10695,19 +9361,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
+  std::vector<double >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleVector_capacity",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_capacity" "', argument " "1"" of type '" "std::vector< double > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_capacity" "', argument " "1"" of type '" "std::vector<double > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
-  result = ((std::vector< double > const *)arg1)->capacity();
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
+  result = ((std::vector<double > const *)arg1)->capacity();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -10717,18 +9383,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_delete_DoubleVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< double > *arg1 = (std::vector< double > *) 0 ;
+  std::vector<double > *arg1 = (std::vector<double > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_DoubleVector",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleVector" "', argument " "1"" of type '" "std::vector< double > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleVector" "', argument " "1"" of type '" "std::vector<double > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< double > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<double > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -10738,29 +9405,29 @@ fail:
 
 SWIGINTERN PyObject *DoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_iterator" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_iterator" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = (swig::SwigPyIterator *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = (swig::PySwigIterator *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -10769,41 +9436,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = (bool)std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__((std::vector< std::vector< double > > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___bool__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = (bool)std_vector_Sl_std_vector_Sl_double_Sg__Sg____bool__((std::vector< std::vector< double > > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = (bool)std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__((std::vector<std::vector<double > > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -10813,19 +9458,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___len__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___len__" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__((std::vector< std::vector< double > > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__((std::vector<std::vector<double > > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -10835,18 +9480,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::value_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::value_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_pop",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   try {
     result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(arg1);
   }
@@ -10854,7 +9499,7 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_pop(PyObject *SWIGUNUSEDPARM(self)
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = swig::from(static_cast< std::vector<double,std::allocator< double > > >(result));
+  resultobj = swig::from(static_cast< std::vector<double,std::allocator<double > > >(result));
   return resultobj;
 fail:
   return NULL;
@@ -10863,9 +9508,10 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::difference_type arg2 ;
-  std::vector< std::vector< double > >::difference_type arg3 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::difference_type arg2 ;
+  std::vector<std::vector<double > >::difference_type arg3 ;
+  std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -10875,44 +9521,43 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getslice__(PyObject *SWIGUNUSEDP
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector___getslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getslice__" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getslice__" "', argument " "2"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___getslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___getslice__" "', argument " "3"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3);
+  arg3 = static_cast< std::vector<std::vector<double > >::difference_type >(val3);
   try {
-    result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(arg1,arg2,arg3);
+    result = (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(arg1,arg2,arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::difference_type arg2 ;
-  std::vector< std::vector< double > >::difference_type arg3 ;
-  std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg4 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::difference_type arg2 ;
+  std::vector<std::vector<double > >::difference_type arg3 ;
+  std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -10926,34 +9571,34 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice____SWIG_0(PyObject *SWI
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:DoubleDoubleVector___setslice__",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setslice__" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setslice__" "', argument " "2"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___setslice__" "', argument " "3"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3);
+  arg3 = static_cast< std::vector<std::vector<double > >::difference_type >(val3);
   {
-    std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0;
+    std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *ptr = (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *)0;
     res4 = swig::asptr(obj3, &ptr);
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > const &""'"); 
     }
     arg4 = ptr;
   }
   try {
-    std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_0(arg1,arg2,arg3,(std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)*arg4);
+    std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice__(arg1,arg2,arg3,(std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > const &)*arg4);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -10971,123 +9616,11 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::difference_type arg2 ;
-  std::vector< std::vector< double > >::difference_type arg3 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  ptrdiff_t val2 ;
-  int ecode2 = 0 ;
-  ptrdiff_t val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector___setslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'");
-  } 
-  arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2);
-  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'");
-  } 
-  arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3);
-  try {
-    std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_0(arg1,arg2,arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[5];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_DoubleDoubleVector___setslice____SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          int res = swig::asptr(argv[3], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-          _v = SWIG_CheckState(res);
-          if (_v) {
-            return _wrap_DoubleDoubleVector___setslice____SWIG_0(self, args);
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___setslice__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::__setslice__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)\n"
-    "    std::vector< std::vector< double > >::__setslice__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::difference_type)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::difference_type arg2 ;
-  std::vector< std::vector< double > >::difference_type arg3 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::difference_type arg2 ;
+  std::vector<std::vector<double > >::difference_type arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -11099,21 +9632,21 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delslice__(PyObject *SWIGUNUSEDP
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector___delslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delslice__" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delslice__" "', argument " "2"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___delslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___delslice__" "', argument " "3"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3);
+  arg3 = static_cast< std::vector<std::vector<double > >::difference_type >(val3);
   try {
     std_vector_Sl_std_vector_Sl_double_Sg__Sg____delslice__(arg1,arg2,arg3);
   }
@@ -11128,10 +9661,10 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::difference_type arg2 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::difference_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -11140,178 +9673,18 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_0(PyObject *SWIG
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delitem__" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delitem__" "', argument " "2"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2);
-  try {
-    std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg3 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res3 = SWIG_OLDOBJ ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  {
-    std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0;
-    res3 = swig::asptr(obj2, &ptr);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); 
-    }
-    arg3 = ptr;
-  }
-  try {
-    std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)*arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return resultobj;
-fail:
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
+  arg2 = static_cast< std::vector<std::vector<double > >::difference_type >(val2);
   try {
-    std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_1(arg1,arg2);
+    std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem__(arg1,arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -11320,146 +9693,55 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_1(PyObject *SWIG
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_DoubleDoubleVector___delitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_DoubleDoubleVector___delitem____SWIG_0(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___delitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::__delitem__(std::vector< std::vector< double > >::difference_type)\n"
-    "    std::vector< std::vector< double > >::__delitem__(PySliceObject *)\n");
-  return 0;
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::difference_type arg2 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::difference_type arg2 ;
+  std::vector<std::vector<double > >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< std::vector< double > >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getitem__" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getitem__" "', argument " "2"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::difference_type >(val2);
   try {
-    result = (std::vector< std::vector< double > >::value_type *) &std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1((std::vector< std::vector< double > > const *)arg1,arg2);
+    {
+      std::vector<std::vector<double > >::value_type const &_result_ref = std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem__((std::vector<std::vector<double > > const *)arg1,arg2);
+      result = (std::vector<std::vector<double > >::value_type *) &_result_ref;
+    }
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = swig::from(static_cast< std::vector<double,std::allocator< double > > >(*result));
+  resultobj = swig::from(static_cast< std::vector<double,std::allocator<double > > >(*result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_DoubleDoubleVector___getitem____SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_DoubleDoubleVector___getitem____SWIG_1(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___getitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::__getitem__(PySliceObject *)\n"
-    "    std::vector< std::vector< double > >::__getitem__(std::vector< std::vector< double > >::difference_type) const\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::difference_type arg2 ;
-  std::vector< std::vector< double > >::value_type *arg3 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::difference_type arg2 ;
+  std::vector<std::vector<double > >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -11470,29 +9752,29 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_2(PyObject *SWIG
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "std::vector<std::vector<double > >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::difference_type >(val2);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res3 = swig::asptr(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
   try {
-    std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3);
+    std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem__(arg1,arg2,(std::vector<double,std::allocator<double > > const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -11507,79 +9789,10 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_DoubleDoubleVector___setitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_DoubleDoubleVector___setitem____SWIG_0(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<double,std::allocator< double > >**)(0));
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_DoubleDoubleVector___setitem____SWIG_2(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::__setitem__(PySliceObject *,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)\n"
-    "    std::vector< std::vector< double > >::__setitem__(PySliceObject *)\n"
-    "    std::vector< std::vector< double > >::__setitem__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::value_type const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::value_type *arg2 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
@@ -11587,23 +9800,23 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_append(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector_append",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_append" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_append" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res2 = swig::asptr(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg2 = ptr;
   }
-  std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(arg1,(std::vector< double,std::allocator< double > > const &)*arg2);
+  std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(arg1,(std::vector<double,std::allocator<double > > const &)*arg2);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -11615,11 +9828,11 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *result = 0 ;
+  std::vector<std::vector<double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)":new_DoubleDoubleVector")) SWIG_fail;
-  result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<std::vector<double > > *)new std::vector<std::vector<double > >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -11628,25 +9841,25 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double,std::allocator< double > > > *arg1 = 0 ;
+  std::vector<std::vector<double,std::allocator<double > > > *arg1 = 0 ;
+  std::vector<std::vector<double > > *result = 0 ;
   int res1 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_DoubleDoubleVector",&obj0)) SWIG_fail;
   {
-    std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0;
+    std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *ptr = (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *)0;
     res1 = swig::asptr(obj0, &ptr);
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double,std::allocator< double > > > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector<std::vector<double,std::allocator<double > > > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double,std::allocator< double > > > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector<std::vector<double,std::allocator<double > > > const &""'"); 
     }
     arg1 = ptr;
   }
-  result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >((std::vector< std::vector< double,std::allocator< double > > > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<std::vector<double > > *)new std::vector<std::vector<double > >((std::vector<std::vector<double,std::allocator<double > > > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res1)) delete arg1;
   return resultobj;
 fail:
@@ -11657,19 +9870,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_empty" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_empty" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = (bool)((std::vector< std::vector< double > > const *)arg1)->empty();
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = (bool)((std::vector<std::vector<double > > const *)arg1)->empty();
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -11679,19 +9892,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_size" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_size" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = ((std::vector< std::vector< double > > const *)arg1)->size();
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = ((std::vector<std::vector<double > > const *)arg1)->size();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -11701,17 +9914,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_clear" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_clear" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   (arg1)->clear();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -11722,8 +9935,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double,std::allocator< double > > > *arg2 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double,std::allocator<double > > > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -11732,19 +9945,19 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_swap(PyObject *SWIGUNUSEDPARM(self
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_swap" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_swap" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t,  0 );
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t,  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > > > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector<std::vector<double,std::allocator<double > > > &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > > > &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector<std::vector<double,std::allocator<double > > > &""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<std::vector<double,std::allocator<double > > > * >(argp2);
   (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -11755,134 +9968,358 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  SwigValueWrapper<std::allocator<std::vector<double,std::allocator<double > > > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< std::vector< double,std::allocator< double > > > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = ((std::vector< std::vector< double > > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::vector< std::vector< double > >::allocator_type(static_cast< const std::vector< std::vector< double > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = ((std::vector<std::vector<double > > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::vector<std::vector<double > >::allocator_type(static_cast< const std::vector<std::vector<double > >::allocator_type& >(result))), SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_begin" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_begin" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_begin" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = ((std::vector<std::vector<double > > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_begin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_begin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_begin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleDoubleVector_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_end" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_end" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_end" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = ((std::vector<std::vector<double > > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_end__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleDoubleVector_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rbegin" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rbegin" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rbegin" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = ((std::vector<std::vector<double > > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_rbegin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleDoubleVector_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rend" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rend" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rend" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = ((std::vector<std::vector<double > > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_DoubleDoubleVector_rend__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleDoubleVector_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > >::size_type arg1 ;
+  std::vector<std::vector<double > >::size_type arg1 ;
+  std::vector<std::vector<double > > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_DoubleDoubleVector",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector<std::vector<double > >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1);
-  result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW |  0 );
+  arg1 = static_cast< std::vector<std::vector<double > >::size_type >(val1);
+  result = (std::vector<std::vector<double > > *)new std::vector<std::vector<double > >(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -11891,17 +10328,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_pop_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop_back" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   (arg1)->pop_back();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -11912,8 +10349,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::size_type arg2 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -11922,16 +10359,16 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_0(PyObject *SWIGUNUSE
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector_resize",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector<std::vector<double > >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::size_type >(val2);
   (arg1)->resize(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -11942,36 +10379,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::iterator arg2 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::iterator arg2 ;
+  std::vector<std::vector<double > >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< std::vector< double > >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -11980,51 +10417,51 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::iterator arg2 ;
-  std::vector< std::vector< double > >::iterator arg3 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::iterator arg2 ;
+  std::vector<std::vector<double > >::iterator arg3 ;
+  std::vector<std::vector<double > >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< std::vector< double > >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector< std::vector< double > >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector<std::vector<double > >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector< std::vector< double > >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector<std::vector<double > >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2,arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -12037,18 +10474,18 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase(PyObject *self, PyObject *ar
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_DoubleDoubleVector_erase__SWIG_0(self, args);
       }
@@ -12056,16 +10493,16 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase(PyObject *self, PyObject *ar
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_DoubleDoubleVector_erase__SWIG_1(self, args);
         }
@@ -12074,44 +10511,41 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase(PyObject *self, PyObject *ar
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::erase(std::vector< std::vector< double > >::iterator)\n"
-    "    std::vector< std::vector< double > >::erase(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleDoubleVector_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::vector<std::vector<double > >::iterator)\n    erase(std::vector<std::vector<double > >::iterator,std::vector<std::vector<double > >::iterator)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > >::size_type arg1 ;
-  std::vector< std::vector< double > >::value_type *arg2 = 0 ;
+  std::vector<std::vector<double > >::size_type arg1 ;
+  std::vector<std::vector<double > >::value_type *arg2 = 0 ;
+  std::vector<std::vector<double > > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< std::vector< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:new_DoubleDoubleVector",&obj0,&obj1)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector<std::vector<double > >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1);
+  arg1 = static_cast< std::vector<std::vector<double > >::size_type >(val1);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res2 = swig::asptr(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg2 = ptr;
   }
-  result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1,(std::vector< std::vector< double > >::value_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<std::vector<double > > *)new std::vector<std::vector<double > >(arg1,(std::vector<std::vector<double > >::value_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
 fail:
@@ -12126,8 +10560,8 @@ SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector(PyObject *self, PyObject *args
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -12145,7 +10579,7 @@ SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector(PyObject *self, PyObject *args
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       return _wrap_new_DoubleDoubleVector__SWIG_1(self, args);
@@ -12158,7 +10592,7 @@ SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector(PyObject *self, PyObject *args
       _v = SWIG_CheckState(res);
     }
     if (_v) {
-      int res = swig::asptr(argv[1], (std::vector<double,std::allocator< double > >**)(0));
+      int res = swig::asptr(argv[1], (std::vector<double,std::allocator<double > >**)(0));
       _v = SWIG_CheckState(res);
       if (_v) {
         return _wrap_new_DoubleDoubleVector__SWIG_3(self, args);
@@ -12167,20 +10601,15 @@ SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector(PyObject *self, PyObject *args
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_DoubleDoubleVector'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::vector()\n"
-    "    std::vector< std::vector< double > >::vector(std::vector< std::vector< double,std::allocator< double > > > const &)\n"
-    "    std::vector< std::vector< double > >::vector(std::vector< std::vector< double > >::size_type)\n"
-    "    std::vector< std::vector< double > >::vector(std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_DoubleDoubleVector'.\n  Possible C/C++ prototypes are:\n    std::vector<(std::vector<(double)>)>()\n    std::vector<(std::vector<(double)>)>(std::vector<std::vector<double,std::allocator<double > > > const &)\n    std::vector<(std::vector<(double)>)>(std::vector<std::vector<double > >::size_type)\n    std::vector<(std::vector<(double)>)>(std::vector<std::vector<double > >::size_type,std:: [...]
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::value_type *arg2 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
@@ -12188,23 +10617,23 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_push_back(PyObject *SWIGUNUSEDPARM
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector_push_back",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_push_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_push_back" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res2 = swig::asptr(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg2 = ptr;
   }
-  (arg1)->push_back((std::vector< std::vector< double > >::value_type const &)*arg2);
+  (arg1)->push_back((std::vector<std::vector<double > >::value_type const &)*arg2);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -12216,20 +10645,23 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_front",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_front" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_front" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->front();
-  resultobj = swig::from(static_cast< std::vector<double,std::allocator< double > > >(*result));
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  {
+    std::vector<std::vector<double > >::value_type const &_result_ref = ((std::vector<std::vector<double > > const *)arg1)->front();
+    result = (std::vector<std::vector<double > >::value_type *) &_result_ref;
+  }
+  resultobj = swig::from(static_cast< std::vector<double,std::allocator<double > > >(*result));
   return resultobj;
 fail:
   return NULL;
@@ -12238,20 +10670,23 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_back" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  {
+    std::vector<std::vector<double > >::value_type const &_result_ref = ((std::vector<std::vector<double > > const *)arg1)->back();
+    result = (std::vector<std::vector<double > >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->back();
-  resultobj = swig::from(static_cast< std::vector<double,std::allocator< double > > >(*result));
+  resultobj = swig::from(static_cast< std::vector<double,std::allocator<double > > >(*result));
   return resultobj;
 fail:
   return NULL;
@@ -12260,9 +10695,9 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::size_type arg2 ;
-  std::vector< std::vector< double > >::value_type *arg3 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::size_type arg2 ;
+  std::vector<std::vector<double > >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -12273,28 +10708,28 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_assign(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector_assign",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_assign" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_assign" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_assign" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_assign" "', argument " "2"" of type '" "std::vector<std::vector<double > >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::size_type >(val2);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res3 = swig::asptr(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
-  (arg1)->assign(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3);
+  (arg1)->assign(arg2,(std::vector<std::vector<double > >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res3)) delete arg3;
   return resultobj;
@@ -12306,9 +10741,9 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::size_type arg2 ;
-  std::vector< std::vector< double > >::value_type *arg3 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::size_type arg2 ;
+  std::vector<std::vector<double > >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -12319,28 +10754,28 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_1(PyObject *SWIGUNUSE
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector_resize",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector<std::vector<double > >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::size_type >(val2);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res3 = swig::asptr(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
-  (arg1)->resize(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3);
+  (arg1)->resize(arg2,(std::vector<std::vector<double > >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res3)) delete arg3;
   return resultobj;
@@ -12356,13 +10791,13 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize(PyObject *self, PyObject *a
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -12376,7 +10811,7 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize(PyObject *self, PyObject *a
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -12384,7 +10819,7 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize(PyObject *self, PyObject *a
         _v = SWIG_CheckState(res);
       }
       if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<double,std::allocator< double > >**)(0));
+        int res = swig::asptr(argv[2], (std::vector<double,std::allocator<double > >**)(0));
         _v = SWIG_CheckState(res);
         if (_v) {
           return _wrap_DoubleDoubleVector_resize__SWIG_1(self, args);
@@ -12394,60 +10829,57 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize(PyObject *self, PyObject *a
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_resize'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::resize(std::vector< std::vector< double > >::size_type)\n"
-    "    std::vector< std::vector< double > >::resize(std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleDoubleVector_resize'.\n  Possible C/C++ prototypes are:\n    resize(std::vector<std::vector<double > >::size_type)\n    resize(std::vector<std::vector<double > >::size_type,std::vector<std::vector<double > >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::iterator arg2 ;
-  std::vector< std::vector< double > >::value_type *arg3 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::iterator arg2 ;
+  std::vector<std::vector<double > >::value_type *arg3 = 0 ;
+  std::vector<std::vector<double > >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   int res3 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< std::vector< double > >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:DoubleDoubleVector_insert",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
     }
   }
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res3 = swig::asptr(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
-  result = (arg1)->insert(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->insert(arg2,(std::vector<std::vector<double > >::value_type const &)*arg3);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::vector<double > >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   if (SWIG_IsNewObj(res3)) delete arg3;
   return resultobj;
 fail:
@@ -12458,13 +10890,13 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::iterator arg2 ;
-  std::vector< std::vector< double > >::size_type arg3 ;
-  std::vector< std::vector< double > >::value_type *arg4 = 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::iterator arg2 ;
+  std::vector<std::vector<double > >::size_type arg3 ;
+  std::vector<std::vector<double > >::value_type *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   size_t val3 ;
   int ecode3 = 0 ;
@@ -12475,39 +10907,39 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert__SWIG_1(PyObject *SWIGUNUSE
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:DoubleDoubleVector_insert",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector<std::vector<double > >::iterator""'");
     }
   }
   ecode3 = SWIG_AsVal_size_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector<std::vector<double > >::size_type""'");
   } 
-  arg3 = static_cast< std::vector< std::vector< double > >::size_type >(val3);
+  arg3 = static_cast< std::vector<std::vector<double > >::size_type >(val3);
   {
-    std::vector<double,std::allocator< double > > *ptr = (std::vector<double,std::allocator< double > > *)0;
+    std::vector<double,std::allocator<double > > *ptr = (std::vector<double,std::allocator<double > > *)0;
     res4 = swig::asptr(obj3, &ptr);
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector<std::vector<double > >::value_type const &""'"); 
     }
     arg4 = ptr;
   }
-  (arg1)->insert(arg2,arg3,(std::vector< std::vector< double > >::value_type const &)*arg4);
+  (arg1)->insert(arg2,arg3,(std::vector<std::vector<double > >::value_type const &)*arg4);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res4)) delete arg4;
   return resultobj;
@@ -12523,20 +10955,20 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert(PyObject *self, PyObject *a
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter) != 0));
       if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<double,std::allocator< double > >**)(0));
+        int res = swig::asptr(argv[2], (std::vector<double,std::allocator<double > >**)(0));
         _v = SWIG_CheckState(res);
         if (_v) {
           return _wrap_DoubleDoubleVector_insert__SWIG_0(self, args);
@@ -12546,19 +10978,19 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert(PyObject *self, PyObject *a
   }
   if (argc == 4) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::vector<double > >::iterator > *>(iter) != 0));
       if (_v) {
         {
           int res = SWIG_AsVal_size_t(argv[2], NULL);
           _v = SWIG_CheckState(res);
         }
         if (_v) {
-          int res = swig::asptr(argv[3], (std::vector<double,std::allocator< double > >**)(0));
+          int res = swig::asptr(argv[3], (std::vector<double,std::allocator<double > >**)(0));
           _v = SWIG_CheckState(res);
           if (_v) {
             return _wrap_DoubleDoubleVector_insert__SWIG_1(self, args);
@@ -12569,18 +11001,15 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert(PyObject *self, PyObject *a
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_insert'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::vector< double > >::insert(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::value_type const &)\n"
-    "    std::vector< std::vector< double > >::insert(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'DoubleDoubleVector_insert'.\n  Possible C/C++ prototypes are:\n    insert(std::vector<std::vector<double > >::iterator,std::vector<std::vector<double > >::value_type const &)\n    insert(std::vector<std::vector<double > >::iterator,std::vector<std::vector<double > >::size_type,std::vector<std::vector<double > >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
-  std::vector< std::vector< double > >::size_type arg2 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -12589,16 +11018,16 @@ SWIGINTERN PyObject *_wrap_DoubleDoubleVector_reserve(PyObject *SWIGUNUSEDPARM(s
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:DoubleDoubleVector_reserve",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_reserve" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_reserve" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_reserve" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_reserve" "', argument " "2"" of type '" "std::vector<std::vector<double > >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::vector<double > >::size_type >(val2);
   (arg1)->reserve(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -12609,19 +11038,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_DoubleDoubleVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
+  std::vector<std::vector<double > >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double > >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:DoubleDoubleVector_capacity",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_capacity" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_capacity" "', argument " "1"" of type '" "std::vector<std::vector<double > > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
-  result = ((std::vector< std::vector< double > > const *)arg1)->capacity();
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
+  result = ((std::vector<std::vector<double > > const *)arg1)->capacity();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -12631,18 +11060,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_delete_DoubleDoubleVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ;
+  std::vector<std::vector<double > > *arg1 = (std::vector<std::vector<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_DoubleDoubleVector",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector<std::vector<double > > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::vector<double > > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -12652,29 +11082,29 @@ fail:
 
 SWIGINTERN PyObject *DoubleDoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
 SWIGINTERN PyObject *_wrap_StringVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_iterator" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_iterator" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = (swig::SwigPyIterator *)std_vector_Sl_std_string_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = (swig::PySwigIterator *)std_vector_Sl_std_string_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -12683,41 +11113,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:StringVector___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___nonzero__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = (bool)std_vector_Sl_std_string_Sg____nonzero__((std::vector< std::string > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:StringVector___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:StringVector___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___bool__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___nonzero__" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = (bool)std_vector_Sl_std_string_Sg____bool__((std::vector< std::string > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = (bool)std_vector_Sl_std_string_Sg____nonzero__((std::vector<std::string > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -12727,19 +11135,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___len__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___len__" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = std_vector_Sl_std_string_Sg____len__((std::vector< std::string > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = std_vector_Sl_std_string_Sg____len__((std::vector<std::string > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -12749,18 +11157,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::value_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::value_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_pop",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   try {
     result = std_vector_Sl_std_string_Sg__pop(arg1);
   }
@@ -12777,9 +11185,10 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::difference_type arg2 ;
-  std::vector< std::string >::difference_type arg3 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::difference_type arg2 ;
+  std::vector<std::string >::difference_type arg3 ;
+  std::vector<std::string,std::allocator<std::string > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -12789,44 +11198,43 @@ SWIGINTERN PyObject *_wrap_StringVector___getslice__(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< std::string,std::allocator< std::string > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector___getslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getslice__" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getslice__" "', argument " "2"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___getslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___getslice__" "', argument " "3"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< std::string >::difference_type >(val3);
+  arg3 = static_cast< std::vector<std::string >::difference_type >(val3);
   try {
-    result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg____getslice__(arg1,arg2,arg3);
+    result = (std::vector<std::string,std::allocator<std::string > > *)std_vector_Sl_std_string_Sg____getslice__(arg1,arg2,arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::difference_type arg2 ;
-  std::vector< std::string >::difference_type arg3 ;
-  std::vector< std::string,std::allocator< std::string > > *arg4 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::difference_type arg2 ;
+  std::vector<std::string >::difference_type arg3 ;
+  std::vector<std::string,std::allocator<std::string > > *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -12840,34 +11248,34 @@ SWIGINTERN PyObject *_wrap_StringVector___setslice____SWIG_0(PyObject *SWIGUNUSE
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:StringVector___setslice__",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< std::string >::difference_type >(val3);
+  arg3 = static_cast< std::vector<std::string >::difference_type >(val3);
   {
-    std::vector<std::string,std::allocator< std::string > > *ptr = (std::vector<std::string,std::allocator< std::string > > *)0;
+    std::vector<std::string,std::allocator<std::string > > *ptr = (std::vector<std::string,std::allocator<std::string > > *)0;
     res4 = swig::asptr(obj3, &ptr);
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector<std::string,std::allocator<std::string > > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector<std::string,std::allocator<std::string > > const &""'"); 
     }
     arg4 = ptr;
   }
   try {
-    std_vector_Sl_std_string_Sg____setslice____SWIG_0(arg1,arg2,arg3,(std::vector< std::string,std::allocator< std::string > > const &)*arg4);
+    std_vector_Sl_std_string_Sg____setslice__(arg1,arg2,arg3,(std::vector<std::string,std::allocator<std::string > > const &)*arg4);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -12885,123 +11293,11 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::difference_type arg2 ;
-  std::vector< std::string >::difference_type arg3 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  ptrdiff_t val2 ;
-  int ecode2 = 0 ;
-  ptrdiff_t val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector___setslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
-  } 
-  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
-  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'");
-  } 
-  arg3 = static_cast< std::vector< std::string >::difference_type >(val3);
-  try {
-    std_vector_Sl_std_string_Sg____setslice____SWIG_0(arg1,arg2,arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___setslice__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[5];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_StringVector___setslice____SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          int res = swig::asptr(argv[3], (std::vector<std::string,std::allocator< std::string > >**)(0));
-          _v = SWIG_CheckState(res);
-          if (_v) {
-            return _wrap_StringVector___setslice____SWIG_0(self, args);
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector___setslice__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::__setslice__(std::vector< std::string >::difference_type,std::vector< std::string >::difference_type,std::vector< std::string,std::allocator< std::string > > const &)\n"
-    "    std::vector< std::string >::__setslice__(std::vector< std::string >::difference_type,std::vector< std::string >::difference_type)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_StringVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::difference_type arg2 ;
-  std::vector< std::string >::difference_type arg3 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::difference_type arg2 ;
+  std::vector<std::string >::difference_type arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -13013,21 +11309,21 @@ SWIGINTERN PyObject *_wrap_StringVector___delslice__(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector___delslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delslice__" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delslice__" "', argument " "2"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___delslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___delslice__" "', argument " "3"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< std::string >::difference_type >(val3);
+  arg3 = static_cast< std::vector<std::string >::difference_type >(val3);
   try {
     std_vector_Sl_std_string_Sg____delslice__(arg1,arg2,arg3);
   }
@@ -13042,10 +11338,10 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::difference_type arg2 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::difference_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -13054,178 +11350,18 @@ SWIGINTERN PyObject *_wrap_StringVector___delitem____SWIG_0(PyObject *SWIGUNUSED
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
-  try {
-    std_vector_Sl_std_string_Sg____delitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  std::vector< std::string,std::allocator< std::string > > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:StringVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg____getitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  std::vector< std::string,std::allocator< std::string > > *arg3 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res3 = SWIG_OLDOBJ ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  {
-    std::vector<std::string,std::allocator< std::string > > *ptr = (std::vector<std::string,std::allocator< std::string > > *)0;
-    res3 = swig::asptr(obj2, &ptr);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); 
-    }
-    arg3 = ptr;
-  }
-  try {
-    std_vector_Sl_std_string_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::string,std::allocator< std::string > > const &)*arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return resultobj;
-fail:
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:StringVector___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    std_vector_Sl_std_string_Sg____setitem____SWIG_1(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:StringVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
+  arg2 = static_cast< std::vector<std::string >::difference_type >(val2);
   try {
-    std_vector_Sl_std_string_Sg____delitem____SWIG_1(arg1,arg2);
+    std_vector_Sl_std_string_Sg____delitem__(arg1,arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -13238,78 +11374,34 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector___delitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_StringVector___delitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_StringVector___delitem____SWIG_0(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector___delitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::__delitem__(std::vector< std::string >::difference_type)\n"
-    "    std::vector< std::string >::__delitem__(PySliceObject *)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::difference_type arg2 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::difference_type arg2 ;
+  std::vector<std::string >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< std::string >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::difference_type >(val2);
   try {
-    result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg____getitem____SWIG_1((std::vector< std::string > const *)arg1,arg2);
+    {
+      std::vector<std::string >::value_type const &_result_ref = std_vector_Sl_std_string_Sg____getitem__((std::vector<std::string > const *)arg1,arg2);
+      result = (std::vector<std::string >::value_type *) &_result_ref;
+    }
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -13322,58 +11414,11 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector___getitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_StringVector___getitem____SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_StringVector___getitem____SWIG_1(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector___getitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::__getitem__(PySliceObject *)\n"
-    "    std::vector< std::string >::__getitem__(std::vector< std::string >::difference_type) const\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::difference_type arg2 ;
-  std::vector< std::string >::value_type *arg3 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::difference_type arg2 ;
+  std::vector<std::string >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -13384,29 +11429,29 @@ SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_2(PyObject *SWIGUNUSED
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "std::vector<std::string >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::difference_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::difference_type >(val2);
   {
     std::string *ptr = (std::string *)0;
     res3 = SWIG_AsPtr_std_string(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
   try {
-    std_vector_Sl_std_string_Sg____setitem____SWIG_2(arg1,arg2,(std::string const &)*arg3);
+    std_vector_Sl_std_string_Sg____setitem__(arg1,arg2,(std::string const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -13421,79 +11466,10 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector___setitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_StringVector___setitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<std::string,std::allocator< std::string > >**)(0));
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_StringVector___setitem____SWIG_0(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_StringVector___setitem____SWIG_2(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::__setitem__(PySliceObject *,std::vector< std::string,std::allocator< std::string > > const &)\n"
-    "    std::vector< std::string >::__setitem__(PySliceObject *)\n"
-    "    std::vector< std::string >::__setitem__(std::vector< std::string >::difference_type,std::vector< std::string >::value_type const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_StringVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::value_type *arg2 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
@@ -13501,19 +11477,19 @@ SWIGINTERN PyObject *_wrap_StringVector_append(PyObject *SWIGUNUSEDPARM(self), P
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector_append",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_append" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_append" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg2 = ptr;
   }
@@ -13529,11 +11505,11 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *result = 0 ;
+  std::vector<std::string > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)":new_StringVector")) SWIG_fail;
-  result = (std::vector< std::string > *)new std::vector< std::string >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<std::string > *)new std::vector<std::string >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -13542,25 +11518,25 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = 0 ;
+  std::vector<std::string > *arg1 = 0 ;
+  std::vector<std::string > *result = 0 ;
   int res1 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_StringVector",&obj0)) SWIG_fail;
   {
-    std::vector<std::string,std::allocator< std::string > > *ptr = (std::vector<std::string,std::allocator< std::string > > *)0;
+    std::vector<std::string,std::allocator<std::string > > *ptr = (std::vector<std::string,std::allocator<std::string > > *)0;
     res1 = swig::asptr(obj0, &ptr);
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector<std::string > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector<std::string > const &""'"); 
     }
     arg1 = ptr;
   }
-  result = (std::vector< std::string > *)new std::vector< std::string >((std::vector< std::string > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<std::string > *)new std::vector<std::string >((std::vector<std::string > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res1)) delete arg1;
   return resultobj;
 fail:
@@ -13571,19 +11547,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_empty" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_empty" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = (bool)((std::vector< std::string > const *)arg1)->empty();
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = (bool)((std::vector<std::string > const *)arg1)->empty();
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -13593,19 +11569,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_size" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_size" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = ((std::vector< std::string > const *)arg1)->size();
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = ((std::vector<std::string > const *)arg1)->size();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -13615,17 +11591,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_clear" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_clear" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   (arg1)->clear();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -13636,8 +11612,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string > *arg2 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -13646,19 +11622,19 @@ SWIGINTERN PyObject *_wrap_StringVector_swap(PyObject *SWIGUNUSEDPARM(self), PyO
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_swap" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_swap" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t,  0 );
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t,  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector<std::string > &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector<std::string > &""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< std::string > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<std::string > * >(argp2);
   (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -13669,134 +11645,358 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  SwigValueWrapper<std::allocator<std::string > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< std::string > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_get_allocator" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_get_allocator" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = ((std::vector< std::string > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::vector< std::string >::allocator_type(static_cast< const std::vector< std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__string_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = ((std::vector<std::string > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::vector<std::string >::allocator_type(static_cast< const std::vector<std::string >::allocator_type& >(result))), SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_begin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_begin" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_StringVector_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:StringVector_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_begin" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = ((std::vector<std::string > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector_begin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_begin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_begin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'StringVector_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_StringVector_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_end" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_end" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_StringVector_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:StringVector_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_end" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = ((std::vector<std::string > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_end__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'StringVector_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_StringVector_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rbegin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rbegin" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_StringVector_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:StringVector_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rbegin" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = ((std::vector<std::string > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_StringVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_StringVector_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_rbegin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'StringVector_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_StringVector_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rend" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rend" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_StringVector_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:StringVector_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rend" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = ((std::vector<std::string > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_StringVector_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_StringVector_rend__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'StringVector_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string >::size_type arg1 ;
+  std::vector<std::string >::size_type arg1 ;
+  std::vector<std::string > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_StringVector",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector<std::string >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< std::string >::size_type >(val1);
-  result = (std::vector< std::string > *)new std::vector< std::string >(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
+  arg1 = static_cast< std::vector<std::string >::size_type >(val1);
+  result = (std::vector<std::string > *)new std::vector<std::string >(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -13805,17 +12005,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_pop_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop_back" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   (arg1)->pop_back();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -13826,8 +12026,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::size_type arg2 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -13836,16 +12036,16 @@ SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector_resize",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector<std::string >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::size_type >(val2);
   (arg1)->resize(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -13856,36 +12056,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::iterator arg2 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::iterator arg2 ;
+  std::vector<std::string >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< std::string >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::string >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -13894,51 +12094,51 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::iterator arg2 ;
-  std::vector< std::string >::iterator arg3 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::iterator arg2 ;
+  std::vector<std::string >::iterator arg3 ;
+  std::vector<std::string >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< std::string >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::string >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector<std::string >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::vector<std::string >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector<std::string >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2,arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -13951,18 +12151,18 @@ SWIGINTERN PyObject *_wrap_StringVector_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_StringVector_erase__SWIG_0(self, args);
       }
@@ -13970,16 +12170,16 @@ SWIGINTERN PyObject *_wrap_StringVector_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_StringVector_erase__SWIG_1(self, args);
         }
@@ -13988,44 +12188,41 @@ SWIGINTERN PyObject *_wrap_StringVector_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::erase(std::vector< std::string >::iterator)\n"
-    "    std::vector< std::string >::erase(std::vector< std::string >::iterator,std::vector< std::string >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'StringVector_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::vector<std::string >::iterator)\n    erase(std::vector<std::string >::iterator,std::vector<std::string >::iterator)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string >::size_type arg1 ;
-  std::vector< std::string >::value_type *arg2 = 0 ;
+  std::vector<std::string >::size_type arg1 ;
+  std::vector<std::string >::value_type *arg2 = 0 ;
+  std::vector<std::string > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< std::string > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:new_StringVector",&obj0,&obj1)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector<std::string >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< std::string >::size_type >(val1);
+  arg1 = static_cast< std::vector<std::string >::size_type >(val1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg2 = ptr;
   }
-  result = (std::vector< std::string > *)new std::vector< std::string >(arg1,(std::vector< std::string >::value_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<std::string > *)new std::vector<std::string >(arg1,(std::vector<std::string >::value_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
 fail:
@@ -14040,8 +12237,8 @@ SWIGINTERN PyObject *_wrap_new_StringVector(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -14059,7 +12256,7 @@ SWIGINTERN PyObject *_wrap_new_StringVector(PyObject *self, PyObject *args) {
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       return _wrap_new_StringVector__SWIG_1(self, args);
@@ -14081,20 +12278,15 @@ SWIGINTERN PyObject *_wrap_new_StringVector(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_StringVector'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::vector()\n"
-    "    std::vector< std::string >::vector(std::vector< std::string > const &)\n"
-    "    std::vector< std::string >::vector(std::vector< std::string >::size_type)\n"
-    "    std::vector< std::string >::vector(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_StringVector'.\n  Possible C/C++ prototypes are:\n    std::vector<(std::string)>()\n    std::vector<(std::string)>(std::vector<std::string > const &)\n    std::vector<(std::string)>(std::vector<std::string >::size_type)\n    std::vector<(std::string)>(std::vector<std::string >::size_type,std::vector<std::string >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_StringVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::value_type *arg2 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
@@ -14102,23 +12294,23 @@ SWIGINTERN PyObject *_wrap_StringVector_push_back(PyObject *SWIGUNUSEDPARM(self)
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector_push_back",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_push_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_push_back" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg2 = ptr;
   }
-  (arg1)->push_back((std::vector< std::string >::value_type const &)*arg2);
+  (arg1)->push_back((std::vector<std::string >::value_type const &)*arg2);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -14130,19 +12322,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_front",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_front" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_front" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  {
+    std::vector<std::string >::value_type const &_result_ref = ((std::vector<std::string > const *)arg1)->front();
+    result = (std::vector<std::string >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->front();
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -14152,19 +12347,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_back" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_back" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  {
+    std::vector<std::string >::value_type const &_result_ref = ((std::vector<std::string > const *)arg1)->back();
+    result = (std::vector<std::string >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->back();
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -14174,9 +12372,9 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::size_type arg2 ;
-  std::vector< std::string >::value_type *arg3 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::size_type arg2 ;
+  std::vector<std::string >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -14187,28 +12385,28 @@ SWIGINTERN PyObject *_wrap_StringVector_assign(PyObject *SWIGUNUSEDPARM(self), P
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector_assign",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_assign" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_assign" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_assign" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_assign" "', argument " "2"" of type '" "std::vector<std::string >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::size_type >(val2);
   {
     std::string *ptr = (std::string *)0;
     res3 = SWIG_AsPtr_std_string(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
-  (arg1)->assign(arg2,(std::vector< std::string >::value_type const &)*arg3);
+  (arg1)->assign(arg2,(std::vector<std::string >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res3)) delete arg3;
   return resultobj;
@@ -14220,9 +12418,9 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::size_type arg2 ;
-  std::vector< std::string >::value_type *arg3 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::size_type arg2 ;
+  std::vector<std::string >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -14233,28 +12431,28 @@ SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector_resize",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector<std::string >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::size_type >(val2);
   {
     std::string *ptr = (std::string *)0;
     res3 = SWIG_AsPtr_std_string(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
-  (arg1)->resize(arg2,(std::vector< std::string >::value_type const &)*arg3);
+  (arg1)->resize(arg2,(std::vector<std::string >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res3)) delete arg3;
   return resultobj;
@@ -14270,13 +12468,13 @@ SWIGINTERN PyObject *_wrap_StringVector_resize(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -14290,7 +12488,7 @@ SWIGINTERN PyObject *_wrap_StringVector_resize(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -14308,60 +12506,57 @@ SWIGINTERN PyObject *_wrap_StringVector_resize(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector_resize'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::resize(std::vector< std::string >::size_type)\n"
-    "    std::vector< std::string >::resize(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'StringVector_resize'.\n  Possible C/C++ prototypes are:\n    resize(std::vector<std::string >::size_type)\n    resize(std::vector<std::string >::size_type,std::vector<std::string >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::iterator arg2 ;
-  std::vector< std::string >::value_type *arg3 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::iterator arg2 ;
+  std::vector<std::string >::value_type *arg3 = 0 ;
+  std::vector<std::string >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   int res3 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< std::string >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:StringVector_insert",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::string >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
     }
   }
   {
     std::string *ptr = (std::string *)0;
     res3 = SWIG_AsPtr_std_string(obj2, &ptr);
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg3 = ptr;
   }
-  result = (arg1)->insert(arg2,(std::vector< std::string >::value_type const &)*arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->insert(arg2,(std::vector<std::string >::value_type const &)*arg3);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<std::string >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   if (SWIG_IsNewObj(res3)) delete arg3;
   return resultobj;
 fail:
@@ -14372,13 +12567,13 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::iterator arg2 ;
-  std::vector< std::string >::size_type arg3 ;
-  std::vector< std::string >::value_type *arg4 = 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::iterator arg2 ;
+  std::vector<std::string >::size_type arg3 ;
+  std::vector<std::string >::value_type *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   size_t val3 ;
   int ecode3 = 0 ;
@@ -14389,39 +12584,39 @@ SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:StringVector_insert",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<std::string >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector<std::string >::iterator""'");
     }
   }
   ecode3 = SWIG_AsVal_size_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector<std::string >::size_type""'");
   } 
-  arg3 = static_cast< std::vector< std::string >::size_type >(val3);
+  arg3 = static_cast< std::vector<std::string >::size_type >(val3);
   {
     std::string *ptr = (std::string *)0;
     res4 = SWIG_AsPtr_std_string(obj3, &ptr);
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector<std::string >::value_type const &""'"); 
     }
     arg4 = ptr;
   }
-  (arg1)->insert(arg2,arg3,(std::vector< std::string >::value_type const &)*arg4);
+  (arg1)->insert(arg2,arg3,(std::vector<std::string >::value_type const &)*arg4);
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res4)) delete arg4;
   return resultobj;
@@ -14437,18 +12632,18 @@ SWIGINTERN PyObject *_wrap_StringVector_insert(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter) != 0));
       if (_v) {
         int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
         _v = SWIG_CheckState(res);
@@ -14460,12 +12655,12 @@ SWIGINTERN PyObject *_wrap_StringVector_insert(PyObject *self, PyObject *args) {
   }
   if (argc == 4) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator< std::string > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<std::string,std::allocator<std::string > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<std::string >::iterator > *>(iter) != 0));
       if (_v) {
         {
           int res = SWIG_AsVal_size_t(argv[2], NULL);
@@ -14483,18 +12678,15 @@ SWIGINTERN PyObject *_wrap_StringVector_insert(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'StringVector_insert'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::value_type const &)\n"
-    "    std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'StringVector_insert'.\n  Possible C/C++ prototypes are:\n    insert(std::vector<std::string >::iterator,std::vector<std::string >::value_type const &)\n    insert(std::vector<std::string >::iterator,std::vector<std::string >::size_type,std::vector<std::string >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_StringVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
-  std::vector< std::string >::size_type arg2 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -14503,16 +12695,16 @@ SWIGINTERN PyObject *_wrap_StringVector_reserve(PyObject *SWIGUNUSEDPARM(self),
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:StringVector_reserve",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_reserve" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_reserve" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_reserve" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_reserve" "', argument " "2"" of type '" "std::vector<std::string >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< std::string >::size_type >(val2);
+  arg2 = static_cast< std::vector<std::string >::size_type >(val2);
   (arg1)->reserve(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -14523,19 +12715,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_StringVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
+  std::vector<std::string >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:StringVector_capacity",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_capacity" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_capacity" "', argument " "1"" of type '" "std::vector<std::string > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
-  result = ((std::vector< std::string > const *)arg1)->capacity();
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
+  result = ((std::vector<std::string > const *)arg1)->capacity();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -14545,18 +12737,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_delete_StringVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ;
+  std::vector<std::string > *arg1 = (std::vector<std::string > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_StringVector",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringVector" "', argument " "1"" of type '" "std::vector< std::string > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringVector" "', argument " "1"" of type '" "std::vector<std::string > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< std::string > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<std::string > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -14566,29 +12759,29 @@ fail:
 
 SWIGINTERN PyObject *StringVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
 SWIGINTERN PyObject *_wrap_VarsVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_iterator" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_iterator" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = (swig::SwigPyIterator *)std_vector_Sl_CdiVariable_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = (swig::PySwigIterator *)std_vector_Sl_CdiVariable_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -14597,41 +12790,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsVector___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___nonzero__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = (bool)std_vector_Sl_CdiVariable_Sg____nonzero__((std::vector< CdiVariable > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsVector___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsVector___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___bool__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___nonzero__" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = (bool)std_vector_Sl_CdiVariable_Sg____bool__((std::vector< CdiVariable > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = (bool)std_vector_Sl_CdiVariable_Sg____nonzero__((std::vector<CdiVariable > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -14641,19 +12812,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___len__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___len__" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = std_vector_Sl_CdiVariable_Sg____len__((std::vector< CdiVariable > const *)arg1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = std_vector_Sl_CdiVariable_Sg____len__((std::vector<CdiVariable > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -14663,18 +12834,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::value_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::value_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_pop",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   try {
     result = std_vector_Sl_CdiVariable_Sg__pop(arg1);
   }
@@ -14682,7 +12853,7 @@ SWIGINTERN PyObject *_wrap_VarsVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObje
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj((new std::vector< CdiVariable >::value_type(static_cast< const std::vector< CdiVariable >::value_type& >(result))), SWIGTYPE_p_CdiVariable, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj((new std::vector<CdiVariable >::value_type(static_cast< const std::vector<CdiVariable >::value_type& >(result))), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -14691,9 +12862,10 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::difference_type arg2 ;
-  std::vector< CdiVariable >::difference_type arg3 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::difference_type arg2 ;
+  std::vector<CdiVariable >::difference_type arg3 ;
+  std::vector<CdiVariable,std::allocator<CdiVariable > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -14703,44 +12875,43 @@ SWIGINTERN PyObject *_wrap_VarsVector___getslice__(PyObject *SWIGUNUSEDPARM(self
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector___getslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getslice__" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getslice__" "', argument " "2"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2);
+  arg2 = static_cast< std::vector<CdiVariable >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___getslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___getslice__" "', argument " "3"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3);
+  arg3 = static_cast< std::vector<CdiVariable >::difference_type >(val3);
   try {
-    result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg____getslice__(arg1,arg2,arg3);
+    result = (std::vector<CdiVariable,std::allocator<CdiVariable > > *)std_vector_Sl_CdiVariable_Sg____getslice__(arg1,arg2,arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector___setslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::difference_type arg2 ;
-  std::vector< CdiVariable >::difference_type arg3 ;
-  std::vector< CdiVariable,std::allocator< CdiVariable > > *arg4 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::difference_type arg2 ;
+  std::vector<CdiVariable >::difference_type arg3 ;
+  std::vector<CdiVariable,std::allocator<CdiVariable > > *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -14754,34 +12925,34 @@ SWIGINTERN PyObject *_wrap_VarsVector___setslice____SWIG_0(PyObject *SWIGUNUSEDP
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:VarsVector___setslice__",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setslice__" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setslice__" "', argument " "2"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2);
+  arg2 = static_cast< std::vector<CdiVariable >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___setslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___setslice__" "', argument " "3"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3);
+  arg3 = static_cast< std::vector<CdiVariable >::difference_type >(val3);
   {
-    std::vector<CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector<CdiVariable,std::allocator< CdiVariable > > *)0;
+    std::vector<CdiVariable,std::allocator<CdiVariable > > *ptr = (std::vector<CdiVariable,std::allocator<CdiVariable > > *)0;
     res4 = swig::asptr(obj3, &ptr);
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector<CdiVariable,std::allocator<CdiVariable > > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector<CdiVariable,std::allocator<CdiVariable > > const &""'"); 
     }
     arg4 = ptr;
   }
   try {
-    std_vector_Sl_CdiVariable_Sg____setslice____SWIG_0(arg1,arg2,arg3,(std::vector< CdiVariable,std::allocator< CdiVariable > > const &)*arg4);
+    std_vector_Sl_CdiVariable_Sg____setslice__(arg1,arg2,arg3,(std::vector<CdiVariable,std::allocator<CdiVariable > > const &)*arg4);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -14799,123 +12970,11 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::difference_type arg2 ;
-  std::vector< CdiVariable >::difference_type arg3 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  ptrdiff_t val2 ;
-  int ecode2 = 0 ;
-  ptrdiff_t val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector___setslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'");
-  } 
-  arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2);
-  ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___setslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'");
-  } 
-  arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3);
-  try {
-    std_vector_Sl_CdiVariable_Sg____setslice____SWIG_0(arg1,arg2,arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___setslice__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[5];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_VarsVector___setslice____SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 4) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        {
-          int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          int res = swig::asptr(argv[3], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-          _v = SWIG_CheckState(res);
-          if (_v) {
-            return _wrap_VarsVector___setslice____SWIG_0(self, args);
-          }
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsVector___setslice__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::__setslice__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::difference_type,std::vector< CdiVariable,std::allocator< CdiVariable > > const &)\n"
-    "    std::vector< CdiVariable >::__setslice__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::difference_type)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_VarsVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::difference_type arg2 ;
-  std::vector< CdiVariable >::difference_type arg3 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::difference_type arg2 ;
+  std::vector<CdiVariable >::difference_type arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -14927,21 +12986,21 @@ SWIGINTERN PyObject *_wrap_VarsVector___delslice__(PyObject *SWIGUNUSEDPARM(self
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector___delslice__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delslice__" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delslice__" "', argument " "2"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2);
+  arg2 = static_cast< std::vector<CdiVariable >::difference_type >(val2);
   ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___delslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___delslice__" "', argument " "3"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3);
+  arg3 = static_cast< std::vector<CdiVariable >::difference_type >(val3);
   try {
     std_vector_Sl_CdiVariable_Sg____delslice__(arg1,arg2,arg3);
   }
@@ -14956,10 +13015,10 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::difference_type arg2 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::difference_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -14968,326 +13027,75 @@ SWIGINTERN PyObject *_wrap_VarsVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPA
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delitem__" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delitem__" "', argument " "2"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2);
-  try {
-    std_vector_Sl_CdiVariable_Sg____delitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  std::vector< CdiVariable,std::allocator< CdiVariable > > *arg3 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res3 = SWIG_OLDOBJ ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  {
-    std::vector<CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector<CdiVariable,std::allocator< CdiVariable > > *)0;
-    res3 = swig::asptr(obj2, &ptr);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); 
-    }
-    arg3 = ptr;
-  }
-  try {
-    std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< CdiVariable,std::allocator< CdiVariable > > const &)*arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  catch(std::invalid_argument &_e) {
-    SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return resultobj;
-fail:
-  if (SWIG_IsNewObj(res3)) delete arg3;
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
-  try {
-    std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(arg1,arg2);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  PySliceObject *arg2 = (PySliceObject *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  {
-    if (!PySlice_Check(obj1)) {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
-    }
-    arg2 = (PySliceObject *) obj1;
-  }
+  arg2 = static_cast< std::vector<CdiVariable >::difference_type >(val2);
   try {
-    std_vector_Sl_CdiVariable_Sg____delitem____SWIG_1(arg1,arg2);
+    std_vector_Sl_CdiVariable_Sg____delitem__(arg1,arg2);
   }
   catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___delitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_VarsVector___delitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_VarsVector___delitem____SWIG_0(self, args);
-      }
-    }
+    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
+  resultobj = SWIG_Py_Void();
+  return resultobj;
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsVector___delitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::__delitem__(std::vector< CdiVariable >::difference_type)\n"
-    "    std::vector< CdiVariable >::__delitem__(PySliceObject *)\n");
-  return 0;
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::difference_type arg2 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::difference_type arg2 ;
+  std::vector<CdiVariable >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< CdiVariable >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getitem__" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getitem__" "', argument " "2"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2);
+  arg2 = static_cast< std::vector<CdiVariable >::difference_type >(val2);
   try {
-    result = (std::vector< CdiVariable >::value_type *) &std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1((std::vector< CdiVariable > const *)arg1,arg2);
+    {
+      std::vector<CdiVariable >::value_type const &_result_ref = std_vector_Sl_CdiVariable_Sg____getitem__((std::vector<CdiVariable > const *)arg1,arg2);
+      result = (std::vector<CdiVariable >::value_type *) &_result_ref;
+    }
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector___getitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[3];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_VarsVector___getitem____SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_VarsVector___getitem____SWIG_1(self, args);
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsVector___getitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::__getitem__(PySliceObject *)\n"
-    "    std::vector< CdiVariable >::__getitem__(std::vector< CdiVariable >::difference_type) const\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::difference_type arg2 ;
-  std::vector< CdiVariable >::value_type *arg3 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::difference_type arg2 ;
+  std::vector<CdiVariable >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   ptrdiff_t val2 ;
@@ -15299,26 +13107,26 @@ SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPA
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "std::vector<CdiVariable >::difference_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2);
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiVariable,  0  | 0);
+  arg2 = static_cast< std::vector<CdiVariable >::difference_type >(val2);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3);
+  arg3 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp3);
   try {
-    std_vector_Sl_CdiVariable_Sg____setitem____SWIG_2(arg1,arg2,(CdiVariable const &)*arg3);
+    std_vector_Sl_CdiVariable_Sg____setitem__(arg1,arg2,(CdiVariable const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -15331,79 +13139,10 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector___setitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        return _wrap_VarsVector___setitem____SWIG_1(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        _v = PySlice_Check(argv[1]);
-      }
-      if (_v) {
-        int res = swig::asptr(argv[2], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_VarsVector___setitem____SWIG_0(self, args);
-        }
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_VarsVector___setitem____SWIG_2(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsVector___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::__setitem__(PySliceObject *,std::vector< CdiVariable,std::allocator< CdiVariable > > const &)\n"
-    "    std::vector< CdiVariable >::__setitem__(PySliceObject *)\n"
-    "    std::vector< CdiVariable >::__setitem__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::value_type const &)\n");
-  return 0;
-}
-
-
 SWIGINTERN PyObject *_wrap_VarsVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::value_type *arg2 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -15412,19 +13151,19 @@ SWIGINTERN PyObject *_wrap_VarsVector_append(PyObject *SWIGUNUSEDPARM(self), PyO
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector_append",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_append" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_append" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CdiVariable,  0  | 0);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2);
+  arg2 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp2);
   std_vector_Sl_CdiVariable_Sg__append(arg1,(CdiVariable const &)*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -15435,11 +13174,11 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *result = 0 ;
+  std::vector<CdiVariable > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)":new_VarsVector")) SWIG_fail;
-  result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<CdiVariable > *)new std::vector<CdiVariable >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -15448,25 +13187,25 @@ fail:
 
 SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = 0 ;
+  std::vector<CdiVariable > *arg1 = 0 ;
+  std::vector<CdiVariable > *result = 0 ;
   int res1 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_VarsVector",&obj0)) SWIG_fail;
   {
-    std::vector<CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector<CdiVariable,std::allocator< CdiVariable > > *)0;
+    std::vector<CdiVariable,std::allocator<CdiVariable > > *ptr = (std::vector<CdiVariable,std::allocator<CdiVariable > > *)0;
     res1 = swig::asptr(obj0, &ptr);
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector<CdiVariable > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector<CdiVariable > const &""'"); 
     }
     arg1 = ptr;
   }
-  result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >((std::vector< CdiVariable > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::vector<CdiVariable > *)new std::vector<CdiVariable >((std::vector<CdiVariable > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res1)) delete arg1;
   return resultobj;
 fail:
@@ -15477,19 +13216,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_empty" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_empty" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = (bool)((std::vector< CdiVariable > const *)arg1)->empty();
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = (bool)((std::vector<CdiVariable > const *)arg1)->empty();
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -15499,19 +13238,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_size" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_size" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = ((std::vector< CdiVariable > const *)arg1)->size();
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = ((std::vector<CdiVariable > const *)arg1)->size();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -15521,17 +13260,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_clear" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_clear" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   (arg1)->clear();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -15542,8 +13281,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable > *arg2 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -15552,19 +13291,19 @@ SWIGINTERN PyObject *_wrap_VarsVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObj
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_swap" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_swap" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t,  0 );
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t,  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector< CdiVariable > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector<CdiVariable > &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector< CdiVariable > &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector<CdiVariable > &""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< CdiVariable > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<CdiVariable > * >(argp2);
   (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -15575,134 +13314,358 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  SwigValueWrapper<std::allocator<CdiVariable > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< CdiVariable > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_get_allocator" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_get_allocator" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = ((std::vector< CdiVariable > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::vector< CdiVariable >::allocator_type(static_cast< const std::vector< CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_CdiVariable_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = ((std::vector<CdiVariable > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::vector<CdiVariable >::allocator_type(static_cast< const std::vector<CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_begin" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_begin" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsVector_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_begin" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = ((std::vector<CdiVariable > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector_begin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_begin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_begin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsVector_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsVector_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_end" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_end" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsVector_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_end" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = ((std::vector<CdiVariable > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_end__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsVector_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsVector_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rbegin" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rbegin" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsVector_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rbegin" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = ((std::vector<CdiVariable > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsVector_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_rbegin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsVector_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsVector_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rend" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rend" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsVector_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::const_reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rend" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = ((std::vector<CdiVariable > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_VarsVector_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsVector_rend__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsVector_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable >::size_type arg1 ;
+  std::vector<CdiVariable >::size_type arg1 ;
+  std::vector<CdiVariable > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_VarsVector",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector<CdiVariable >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1);
-  result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW |  0 );
+  arg1 = static_cast< std::vector<CdiVariable >::size_type >(val1);
+  result = (std::vector<CdiVariable > *)new std::vector<CdiVariable >(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -15711,17 +13674,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_pop_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop_back" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop_back" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   (arg1)->pop_back();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -15732,8 +13695,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::size_type arg2 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -15742,16 +13705,16 @@ SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector_resize",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector<CdiVariable >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2);
+  arg2 = static_cast< std::vector<CdiVariable >::size_type >(val2);
   (arg1)->resize(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -15762,36 +13725,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::iterator arg2 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::iterator arg2 ;
+  std::vector<CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -15800,51 +13763,51 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::iterator arg2 ;
-  std::vector< CdiVariable >::iterator arg3 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::iterator arg2 ;
+  std::vector<CdiVariable >::iterator arg3 ;
+  std::vector<CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector< CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector<CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector< CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector<CdiVariable >::iterator""'");
     }
   }
   result = (arg1)->erase(arg2,arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -15857,18 +13820,18 @@ SWIGINTERN PyObject *_wrap_VarsVector_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_VarsVector_erase__SWIG_0(self, args);
       }
@@ -15876,16 +13839,16 @@ SWIGINTERN PyObject *_wrap_VarsVector_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_VarsVector_erase__SWIG_1(self, args);
         }
@@ -15894,42 +13857,39 @@ SWIGINTERN PyObject *_wrap_VarsVector_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsVector_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::erase(std::vector< CdiVariable >::iterator)\n"
-    "    std::vector< CdiVariable >::erase(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsVector_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::vector<CdiVariable >::iterator)\n    erase(std::vector<CdiVariable >::iterator,std::vector<CdiVariable >::iterator)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable >::size_type arg1 ;
-  std::vector< CdiVariable >::value_type *arg2 = 0 ;
+  std::vector<CdiVariable >::size_type arg1 ;
+  std::vector<CdiVariable >::value_type *arg2 = 0 ;
+  std::vector<CdiVariable > *result = 0 ;
   size_t val1 ;
   int ecode1 = 0 ;
   void *argp2 = 0 ;
   int res2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::vector< CdiVariable > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:new_VarsVector",&obj0,&obj1)) SWIG_fail;
   ecode1 = SWIG_AsVal_size_t(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector<CdiVariable >::size_type""'");
   } 
-  arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CdiVariable,  0  | 0);
+  arg1 = static_cast< std::vector<CdiVariable >::size_type >(val1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2);
-  result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1,(std::vector< CdiVariable >::value_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW |  0 );
+  arg2 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp2);
+  result = (std::vector<CdiVariable > *)new std::vector<CdiVariable >(arg1,(std::vector<CdiVariable >::value_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -15942,8 +13902,8 @@ SWIGINTERN PyObject *_wrap_new_VarsVector(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -15961,7 +13921,7 @@ SWIGINTERN PyObject *_wrap_new_VarsVector(PyObject *self, PyObject *args) {
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       return _wrap_new_VarsVector__SWIG_1(self, args);
@@ -15974,7 +13934,7 @@ SWIGINTERN PyObject *_wrap_new_VarsVector(PyObject *self, PyObject *args) {
       _v = SWIG_CheckState(res);
     }
     if (_v) {
-      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_CdiVariable, 0);
+      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0);
       _v = SWIG_CheckState(res);
       if (_v) {
         return _wrap_new_VarsVector__SWIG_3(self, args);
@@ -15983,20 +13943,15 @@ SWIGINTERN PyObject *_wrap_new_VarsVector(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VarsVector'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::vector()\n"
-    "    std::vector< CdiVariable >::vector(std::vector< CdiVariable > const &)\n"
-    "    std::vector< CdiVariable >::vector(std::vector< CdiVariable >::size_type)\n"
-    "    std::vector< CdiVariable >::vector(std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_VarsVector'.\n  Possible C/C++ prototypes are:\n    std::vector<(CdiVariable)>()\n    std::vector<(CdiVariable)>(std::vector<CdiVariable > const &)\n    std::vector<(CdiVariable)>(std::vector<CdiVariable >::size_type)\n    std::vector<(CdiVariable)>(std::vector<CdiVariable >::size_type,std::vector<CdiVariable >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_VarsVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::value_type *arg2 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::value_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -16005,20 +13960,20 @@ SWIGINTERN PyObject *_wrap_VarsVector_push_back(PyObject *SWIGUNUSEDPARM(self),
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector_push_back",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_push_back" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_push_back" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CdiVariable,  0  | 0);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2);
-  (arg1)->push_back((std::vector< CdiVariable >::value_type const &)*arg2);
+  arg2 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp2);
+  (arg1)->push_back((std::vector<CdiVariable >::value_type const &)*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -16028,20 +13983,23 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_front",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_front" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_front" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  {
+    std::vector<CdiVariable >::value_type const &_result_ref = ((std::vector<CdiVariable > const *)arg1)->front();
+    result = (std::vector<CdiVariable >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->front();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -16050,20 +14008,23 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::value_type *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::value_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_back",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_back" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_back" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  {
+    std::vector<CdiVariable >::value_type const &_result_ref = ((std::vector<CdiVariable > const *)arg1)->back();
+    result = (std::vector<CdiVariable >::value_type *) &_result_ref;
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->back();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 |  0 );
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -16072,9 +14033,9 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::size_type arg2 ;
-  std::vector< CdiVariable >::value_type *arg3 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::size_type arg2 ;
+  std::vector<CdiVariable >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -16086,25 +14047,25 @@ SWIGINTERN PyObject *_wrap_VarsVector_assign(PyObject *SWIGUNUSEDPARM(self), PyO
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector_assign",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_assign" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_assign" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_assign" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_assign" "', argument " "2"" of type '" "std::vector<CdiVariable >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2);
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiVariable,  0  | 0);
+  arg2 = static_cast< std::vector<CdiVariable >::size_type >(val2);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3);
-  (arg1)->assign(arg2,(std::vector< CdiVariable >::value_type const &)*arg3);
+  arg3 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp3);
+  (arg1)->assign(arg2,(std::vector<CdiVariable >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -16114,9 +14075,9 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::size_type arg2 ;
-  std::vector< CdiVariable >::value_type *arg3 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::size_type arg2 ;
+  std::vector<CdiVariable >::value_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -16128,25 +14089,25 @@ SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector_resize",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector<CdiVariable >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2);
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiVariable,  0  | 0);
+  arg2 = static_cast< std::vector<CdiVariable >::size_type >(val2);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3);
-  (arg1)->resize(arg2,(std::vector< CdiVariable >::value_type const &)*arg3);
+  arg3 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp3);
+  (arg1)->resize(arg2,(std::vector<CdiVariable >::value_type const &)*arg3);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -16160,13 +14121,13 @@ SWIGINTERN PyObject *_wrap_VarsVector_resize(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -16180,7 +14141,7 @@ SWIGINTERN PyObject *_wrap_VarsVector_resize(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -16188,7 +14149,7 @@ SWIGINTERN PyObject *_wrap_VarsVector_resize(PyObject *self, PyObject *args) {
         _v = SWIG_CheckState(res);
       }
       if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, 0);
+        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0);
         _v = SWIG_CheckState(res);
         if (_v) {
           return _wrap_VarsVector_resize__SWIG_1(self, args);
@@ -16198,58 +14159,55 @@ SWIGINTERN PyObject *_wrap_VarsVector_resize(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsVector_resize'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::resize(std::vector< CdiVariable >::size_type)\n"
-    "    std::vector< CdiVariable >::resize(std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsVector_resize'.\n  Possible C/C++ prototypes are:\n    resize(std::vector<CdiVariable >::size_type)\n    resize(std::vector<CdiVariable >::size_type,std::vector<CdiVariable >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_VarsVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::iterator arg2 ;
-  std::vector< CdiVariable >::value_type *arg3 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::iterator arg2 ;
+  std::vector<CdiVariable >::value_type *arg3 = 0 ;
+  std::vector<CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   void *argp3 = 0 ;
   int res3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  std::vector< CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsVector_insert",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiVariable,  0  | 0);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3);
-  result = (arg1)->insert(arg2,(std::vector< CdiVariable >::value_type const &)*arg3);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg3 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp3);
+  result = (arg1)->insert(arg2,(std::vector<CdiVariable >::value_type const &)*arg3);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector<CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
@@ -16258,13 +14216,13 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::iterator arg2 ;
-  std::vector< CdiVariable >::size_type arg3 ;
-  std::vector< CdiVariable >::value_type *arg4 = 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::iterator arg2 ;
+  std::vector<CdiVariable >::size_type arg3 ;
+  std::vector<CdiVariable >::value_type *arg4 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   size_t val3 ;
   int ecode3 = 0 ;
@@ -16276,36 +14234,36 @@ SWIGINTERN PyObject *_wrap_VarsVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(se
   PyObject * obj3 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOOO:VarsVector_insert",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector<CdiVariable >::iterator""'");
     }
   }
   ecode3 = SWIG_AsVal_size_t(obj2, &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector<CdiVariable >::size_type""'");
   } 
-  arg3 = static_cast< std::vector< CdiVariable >::size_type >(val3);
-  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_CdiVariable,  0  | 0);
+  arg3 = static_cast< std::vector<CdiVariable >::size_type >(val3);
+  res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,  0  | 0);
   if (!SWIG_IsOK(res4)) {
-    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
   if (!argp4) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector< CdiVariable >::value_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector<CdiVariable >::value_type const &""'"); 
   }
-  arg4 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp4);
-  (arg1)->insert(arg2,arg3,(std::vector< CdiVariable >::value_type const &)*arg4);
+  arg4 = reinterpret_cast< std::vector<CdiVariable >::value_type * >(argp4);
+  (arg1)->insert(arg2,arg3,(std::vector<CdiVariable >::value_type const &)*arg4);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -16319,20 +14277,20 @@ SWIGINTERN PyObject *_wrap_VarsVector_insert(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 4) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, 0);
+        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0);
         _v = SWIG_CheckState(res);
         if (_v) {
           return _wrap_VarsVector_insert__SWIG_0(self, args);
@@ -16342,19 +14300,19 @@ SWIGINTERN PyObject *_wrap_VarsVector_insert(PyObject *self, PyObject *args) {
   }
   if (argc == 4) {
     int _v;
-    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator< CdiVariable > >**)(0));
+    int res = swig::asptr(argv[0], (std::vector<CdiVariable,std::allocator<CdiVariable > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::vector<CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
         {
           int res = SWIG_AsVal_size_t(argv[2], NULL);
           _v = SWIG_CheckState(res);
         }
         if (_v) {
-          int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_CdiVariable, 0);
+          int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0);
           _v = SWIG_CheckState(res);
           if (_v) {
             return _wrap_VarsVector_insert__SWIG_1(self, args);
@@ -16365,18 +14323,15 @@ SWIGINTERN PyObject *_wrap_VarsVector_insert(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsVector_insert'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::vector< CdiVariable >::insert(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::value_type const &)\n"
-    "    std::vector< CdiVariable >::insert(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsVector_insert'.\n  Possible C/C++ prototypes are:\n    insert(std::vector<CdiVariable >::iterator,std::vector<CdiVariable >::value_type const &)\n    insert(std::vector<CdiVariable >::iterator,std::vector<CdiVariable >::size_type,std::vector<CdiVariable >::value_type const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_VarsVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
-  std::vector< CdiVariable >::size_type arg2 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::size_type arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   size_t val2 ;
@@ -16385,16 +14340,16 @@ SWIGINTERN PyObject *_wrap_VarsVector_reserve(PyObject *SWIGUNUSEDPARM(self), Py
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsVector_reserve",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_reserve" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_reserve" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_size_t(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_reserve" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_reserve" "', argument " "2"" of type '" "std::vector<CdiVariable >::size_type""'");
   } 
-  arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2);
+  arg2 = static_cast< std::vector<CdiVariable >::size_type >(val2);
   (arg1)->reserve(arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -16405,19 +14360,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
+  std::vector<CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsVector_capacity",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_capacity" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_capacity" "', argument " "1"" of type '" "std::vector<CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
-  result = ((std::vector< CdiVariable > const *)arg1)->capacity();
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
+  result = ((std::vector<CdiVariable > const *)arg1)->capacity();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -16427,18 +14382,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_delete_VarsVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ;
+  std::vector<CdiVariable > *arg1 = (std::vector<CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_VarsVector",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsVector" "', argument " "1"" of type '" "std::vector<CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::vector<CdiVariable > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -16448,54 +14404,29 @@ fail:
 
 SWIGINTERN PyObject *VarsVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::less< std::string > *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_VarsMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__lessT_std__string_t,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); 
-  }
-  arg1 = reinterpret_cast< std::less< std::string > * >(argp1);
-  result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::less< std::string > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_VarsMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_iterator" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -16504,41 +14435,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___nonzero__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__((std::map< std::string,CdiVariable > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___bool__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___nonzero__" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____bool__((std::map< std::string,CdiVariable > const *)arg1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__((std::map<std::string,CdiVariable > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -16548,19 +14457,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___len__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___len__" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = std_map_Sl_std_string_Sc_CdiVariable_Sg____len__((std::map< std::string,CdiVariable > const *)arg1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = std_map_Sl_std_string_Sc_CdiVariable_Sg____len__((std::map<std::string,CdiVariable > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -16570,40 +14479,40 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::mapped_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< std::string,CdiVariable >::mapped_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___getitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___getitem__" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
   try {
-    result = (std::map< std::string,CdiVariable >::mapped_type *) &std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(arg1,(std::string const &)*arg2);
+    result = std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__((std::map<std::string,CdiVariable > const *)arg1,(std::string const &)*arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 |  0 );
+  resultobj = SWIG_NewPointerObj((new std::map<std::string,CdiVariable >::mapped_type(static_cast< const std::map<std::string,CdiVariable >::mapped_type& >(result))), SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type, SWIG_POINTER_OWN |  0 );
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
 fail:
@@ -16614,8 +14523,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
@@ -16623,19 +14532,19 @@ SWIGINTERN PyObject *_wrap_VarsMap___delitem__(PyObject *SWIGUNUSEDPARM(self), P
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___delitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___delitem__" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
@@ -16657,33 +14566,33 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_has_key",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_has_key" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_has_key" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
-  result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key((std::map< std::string,CdiVariable > const *)arg1,(std::string const &)*arg2);
+  result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key((std::map<std::string,CdiVariable > const *)arg1,(std::string const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -16695,18 +14604,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_keys",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_keys" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_keys" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(arg1);
   resultobj = result;
   return resultobj;
@@ -16717,18 +14626,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_values",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_values" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_values" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__values(arg1);
   resultobj = result;
   return resultobj;
@@ -16739,18 +14648,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_items",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_items" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_items" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__items(arg1);
   resultobj = result;
   return resultobj;
@@ -16761,29 +14670,29 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap___contains__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___contains__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___contains__" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
@@ -16799,22 +14708,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_key_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_key_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_key_iterator" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -16823,70 +14732,33 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_value_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_value_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 = SWIG_OLDOBJ ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  {
-    std::string *ptr = (std::string *)0;
-    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
-    }
-    arg2 = ptr;
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_value_iterator" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_0(arg1,(std::string const &)*arg2);
-  resultobj = SWIG_Py_Void();
-  if (SWIG_IsNewObj(res2)) delete arg2;
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
-  if (SWIG_IsNewObj(res2)) delete arg2;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
-  std::map< std::string,CdiVariable >::mapped_type *arg3 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::mapped_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
@@ -16897,32 +14769,32 @@ SWIGINTERN PyObject *_wrap_VarsMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsMap___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___setitem__" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiVariable,  0  | 0);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map<std::string,CdiVariable >::mapped_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map<std::string,CdiVariable >::mapped_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::map< std::string,CdiVariable >::mapped_type * >(argp3);
+  arg3 = reinterpret_cast< std::map<std::string,CdiVariable >::mapped_type * >(argp3);
   try {
-    std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_1(arg1,(std::string const &)*arg2,(CdiVariable const &)*arg3);
+    std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem__(arg1,(std::string const &)*arg2,(CdiVariable const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -16937,399 +14809,541 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap___setitem__(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)":new_VarsMap")) SWIG_fail;
+  result = (std::map<std::string,CdiVariable > *)new std::map<std::string,CdiVariable >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = 0 ;
+  std::map<std::string,CdiVariable > *result = 0 ;
+  int res1 = SWIG_OLDOBJ ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_VarsMap",&obj0)) SWIG_fail;
+  {
+    std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *ptr = (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *)0;
+    res1 = swig::asptr(obj0, &ptr);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const &""'"); 
+    }
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const &""'"); 
+    }
+    arg1 = ptr;
+  }
+  result = (std::map<std::string,CdiVariable > *)new std::map<std::string,CdiVariable >((std::map<std::string,CdiVariable > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
+  if (SWIG_IsNewObj(res1)) delete arg1;
+  return resultobj;
+fail:
+  if (SWIG_IsNewObj(res1)) delete arg1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_VarsMap(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[4];
+  PyObject *argv[2];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_VarsMap___setitem____SWIG_0(self, args);
-      }
-    }
+  if (argc == 0) {
+    return _wrap_new_VarsMap__SWIG_0(self, args);
   }
-  if (argc == 3) {
+  if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_VarsMap___setitem____SWIG_1(self, args);
-        }
-      }
+      return _wrap_new_VarsMap__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsMap___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< std::string,CdiVariable >::__setitem__(std::map< std::string,CdiVariable >::key_type const &)\n"
-    "    std::map< std::string,CdiVariable >::__setitem__(std::map< std::string,CdiVariable >::key_type const &,std::map< std::string,CdiVariable >::mapped_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_VarsMap'.\n  Possible C/C++ prototypes are:\n    std::map<(std::string,CdiVariable)>()\n    std::map<(std::string,CdiVariable)>(std::map<std::string,CdiVariable > const &)\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_asdict",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_empty",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_asdict" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_empty" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__asdict(arg1);
-  resultobj = result;
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (bool)((std::map<std::string,CdiVariable > const *)arg1)->empty();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *result = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::size_type result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)":new_VarsMap")) SWIG_fail;
-  result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_size",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_size" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->size();
+  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = 0 ;
-  int res1 = SWIG_OLDOBJ ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable > *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:new_VarsMap",&obj0)) SWIG_fail;
-  {
-    std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *ptr = (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)0;
-    res1 = swig::asptr(obj0, &ptr);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const &""'"); 
-    }
-    arg1 = ptr;
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_clear",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_clear" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::map< std::string,CdiVariable > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
-  if (SWIG_IsNewObj(res1)) delete arg1;
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  (arg1)->clear();
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
-  if (SWIG_IsNewObj(res1)) delete arg1;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_VarsMap(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_swap",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_swap" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map<std::string,CdiVariable > &""'"); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map<std::string,CdiVariable > &""'"); 
+  }
+  arg2 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp2);
+  (arg1)->swap(*arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  SwigValueWrapper<std::allocator<std::pair<std::string const,CdiVariable > > > result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_get_allocator",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_get_allocator" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::map<std::string,CdiVariable >::allocator_type(static_cast< const std::map<std::string,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_begin" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_begin" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_begin(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[2];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 0) {
-    return _wrap_new_VarsMap__SWIG_1(self, args);
-  }
   if (argc == 1) {
     int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_std__string_t, 0);
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_VarsMap__SWIG_0(self, args);
+      return _wrap_VarsMap_begin__SWIG_0(self, args);
     }
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_VarsMap__SWIG_2(self, args);
+      return _wrap_VarsMap_begin__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VarsMap'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< std::string,CdiVariable >::map(std::less< std::string > const &)\n"
-    "    std::map< std::string,CdiVariable >::map()\n"
-    "    std::map< std::string,CdiVariable >::map(std::map< std::string,CdiVariable > const &)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_empty" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (bool)((std::map< std::string,CdiVariable > const *)arg1)->empty();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable >::size_type result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_size" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_end" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = ((std::map< std::string,CdiVariable > const *)arg1)->size();
-  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_clear" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_end" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  (arg1)->clear();
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable > *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
+SWIGINTERN PyObject *_wrap_VarsMap_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_swap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t,  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map< std::string,CdiVariable > &""'"); 
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsMap_end__SWIG_0(self, args);
+    }
   }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map< std::string,CdiVariable > &""'"); 
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsMap_end__SWIG_1(self, args);
+    }
   }
-  arg2 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp2);
-  (arg1)->swap(*arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< std::pair< std::string const,CdiVariable > > > result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_get_allocator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rbegin" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = ((std::map< std::string,CdiVariable > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::allocator_type(static_cast< const std::map< std::string,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_begin" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rbegin" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable >::iterator result;
+SWIGINTERN PyObject *_wrap_VarsMap_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_end" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsMap_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsMap_rbegin__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable >::reverse_iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rbegin" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rend" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = (arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsMap_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rend" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rend" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_VarsMap_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsMap_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsMap_rend__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< std::string,CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
-  result = (arg1)->erase((std::map< std::string,CdiVariable >::key_type const &)*arg2);
+  result = (arg1)->erase((std::map<std::string,CdiVariable >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -17341,33 +15355,33 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< std::string,CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_count",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_count" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_count" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
-  result = ((std::map< std::string,CdiVariable > const *)arg1)->count((std::map< std::string,CdiVariable >::key_type const &)*arg2);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->count((std::map<std::string,CdiVariable >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -17379,30 +15393,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::iterator arg2 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::iterator arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::iterator""'");
     }
   }
   (arg1)->erase(arg2);
@@ -17415,45 +15429,45 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::iterator arg2 ;
-  std::map< std::string,CdiVariable >::iterator arg3 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::iterator arg2 ;
+  std::map<std::string,CdiVariable >::iterator arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsMap_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map<std::string,CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map<std::string,CdiVariable >::iterator""'");
     }
   }
   (arg1)->erase(arg2,arg3);
@@ -17470,18 +15484,18 @@ SWIGINTERN PyObject *_wrap_VarsMap_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_VarsMap_erase__SWIG_1(self, args);
       }
@@ -17489,7 +15503,7 @@ SWIGINTERN PyObject *_wrap_VarsMap_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
@@ -17501,16 +15515,16 @@ SWIGINTERN PyObject *_wrap_VarsMap_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<std::string,CdiVariable >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_VarsMap_erase__SWIG_2(self, args);
         }
@@ -17519,85 +15533,280 @@ SWIGINTERN PyObject *_wrap_VarsMap_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsMap_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::key_type const &)\n"
-    "    std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::iterator)\n"
-    "    std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::iterator,std::map< std::string,CdiVariable >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::map<std::string,CdiVariable >::key_type const &)\n    erase(std::map<std::string,CdiVariable >::iterator)\n    erase(std::map<std::string,CdiVariable >::iterator,std::map<std::string,CdiVariable >::iterator)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_find__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 = SWIG_OLDOBJ ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_find",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_find" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  {
+    std::string *ptr = (std::string *)0;
+    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
+    }
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
+    }
+    arg2 = ptr;
+  }
+  result = (arg1)->find((std::map<std::string,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return resultobj;
+fail:
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_find__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< std::string,CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_find",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_find" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  {
+    std::string *ptr = (std::string *)0;
+    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
+    }
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
+    }
+    arg2 = ptr;
+  }
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->find((std::map<std::string,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return resultobj;
+fail:
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_find(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_VarsMap_find__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_VarsMap_find__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_find'.\n  Possible C/C++ prototypes are:\n    find(std::map<std::string,CdiVariable >::key_type const &)\n    find(std::map<std::string,CdiVariable >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_lower_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 = SWIG_OLDOBJ ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_lower_bound" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
+  {
+    std::string *ptr = (std::string *)0;
+    res2 = SWIG_AsPtr_std_string(obj1, &ptr);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
+    }
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
+    }
+    arg2 = ptr;
+  }
+  result = (arg1)->lower_bound((std::map<std::string,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return resultobj;
+fail:
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_lower_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 = SWIG_OLDOBJ ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_find" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_lower_bound" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
+    }
+    arg2 = ptr;
+  }
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->lower_bound((std::map<std::string,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return resultobj;
+fail:
+  if (SWIG_IsNewObj(res2)) delete arg2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsMap_lower_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_VarsMap_lower_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_VarsMap_lower_bound__SWIG_1(self, args);
+      }
     }
-    arg2 = ptr;
   }
-  result = (arg1)->find((std::map< std::string,CdiVariable >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  if (SWIG_IsNewObj(res2)) delete arg2;
-  return resultobj;
+  
 fail:
-  if (SWIG_IsNewObj(res2)) delete arg2;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_lower_bound'.\n  Possible C/C++ prototypes are:\n    lower_bound(std::map<std::string,CdiVariable >::key_type const &)\n    lower_bound(std::map<std::string,CdiVariable >::key_type const &)\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_upper_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< std::string,CdiVariable >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_lower_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_upper_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_lower_bound" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_upper_bound" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
-  result = (arg1)->lower_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->upper_bound((std::map<std::string,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
 fail:
@@ -17606,37 +15815,37 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsMap_upper_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
-  std::map< std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<std::string,CdiVariable >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< std::string,CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsMap_upper_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_upper_bound" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_upper_bound" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   {
     std::string *ptr = (std::string *)0;
     res2 = SWIG_AsPtr_std_string(obj1, &ptr);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map<std::string,CdiVariable >::key_type const &""'"); 
     }
     arg2 = ptr;
   }
-  result = (arg1)->upper_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = ((std::map<std::string,CdiVariable > const *)arg1)->upper_bound((std::map<std::string,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<std::string,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
 fail:
@@ -17645,20 +15854,62 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_VarsMap_upper_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_VarsMap_upper_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_VarsMap_upper_bound__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsMap_upper_bound'.\n  Possible C/C++ prototypes are:\n    upper_bound(std::map<std::string,CdiVariable >::key_type const &)\n    upper_bound(std::map<std::string,CdiVariable >::key_type const &)\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_delete_VarsMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ;
+  std::map<std::string,CdiVariable > *arg1 = (std::map<std::string,CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_VarsMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsMap" "', argument " "1"" of type '" "std::map<std::string,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<std::string,CdiVariable > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -17668,54 +15919,29 @@ fail:
 
 SWIGINTERN PyObject *VarsMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::less< int > *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_VarsByCode",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__lessT_int_t,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::less< int > const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::less< int > const &""'"); 
-  }
-  arg1 = reinterpret_cast< std::less< int > * >(argp1);
-  result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::less< int > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_VarsByCode_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_iterator" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -17724,41 +15950,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__((std::map< int,CdiVariable > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsByCode___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___bool__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___nonzero__" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____bool__((std::map< int,CdiVariable > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__((std::map<int,CdiVariable > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -17768,19 +15972,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___len__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___len__" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = std_map_Sl_int_Sc_CdiVariable_Sg____len__((std::map< int,CdiVariable > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = std_map_Sl_int_Sc_CdiVariable_Sg____len__((std::map<int,CdiVariable > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -17790,37 +15994,37 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::mapped_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiVariable >::mapped_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___getitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___getitem__" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___getitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___getitem__" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
   try {
-    result = (std::map< int,CdiVariable >::mapped_type *) &std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(arg1,(int const &)*arg2);
+    result = std_map_Sl_int_Sc_CdiVariable_Sg____getitem__((std::map<int,CdiVariable > const *)arg1,(int const &)*arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 |  0 );
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiVariable >::mapped_type(static_cast< const std::map<int,CdiVariable >::mapped_type& >(result))), SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -17829,27 +16033,27 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___delitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___delitem__" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___delitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___delitem__" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
   try {
     std_map_Sl_int_Sc_CdiVariable_Sg____delitem__(arg1,(int const &)*arg2);
@@ -17867,30 +16071,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_has_key",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_has_key" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_has_key" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_has_key" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_has_key" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
-  result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg__has_key((std::map< int,CdiVariable > const *)arg1,(int const &)*arg2);
+  result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg__has_key((std::map<int,CdiVariable > const *)arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -17900,18 +16104,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_keys",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_keys" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_keys" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__keys(arg1);
   resultobj = result;
   return resultobj;
@@ -17922,18 +16126,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_values",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_values" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_values" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__values(arg1);
   resultobj = result;
   return resultobj;
@@ -17944,18 +16148,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_items",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_items" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_items" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__items(arg1);
   resultobj = result;
   return resultobj;
@@ -17966,28 +16170,28 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode___contains__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___contains__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___contains__" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___contains__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___contains__" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
   result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____contains__(arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
@@ -17999,22 +16203,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_key_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_key_iterator" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -18023,68 +16227,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_value_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsByCode___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___setitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_value_iterator" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___setitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
-  } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
-  arg2 = &temp2;
-  std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_0(arg1,(int const &)*arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
-  std::map< int,CdiVariable >::mapped_type *arg3 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::mapped_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   void *argp3 = 0 ;
@@ -18094,27 +16266,27 @@ SWIGINTERN PyObject *_wrap_VarsByCode___setitem____SWIG_1(PyObject *SWIGUNUSEDPA
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsByCode___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___setitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___setitem__" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___setitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___setitem__" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiVariable,  0  | 0);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map< int,CdiVariable >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map<int,CdiVariable >::mapped_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map< int,CdiVariable >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map<int,CdiVariable >::mapped_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::map< int,CdiVariable >::mapped_type * >(argp3);
+  arg3 = reinterpret_cast< std::map<int,CdiVariable >::mapped_type * >(argp3);
   try {
-    std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiVariable const &)*arg3);
+    std_map_Sl_int_Sc_CdiVariable_Sg____setitem__(arg1,(int const &)*arg2,(CdiVariable const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -18127,114 +16299,40 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode___setitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_VarsByCode___setitem____SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_VarsByCode___setitem____SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsByCode___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiVariable >::__setitem__(std::map< int,CdiVariable >::key_type const &)\n"
-    "    std::map< int,CdiVariable >::__setitem__(std::map< int,CdiVariable >::key_type const &,std::map< int,CdiVariable >::mapped_type const &)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_VarsByCode_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_asdict",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_asdict" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__asdict(arg1);
-  resultobj = result;
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *result = 0 ;
+  std::map<int,CdiVariable > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)":new_VarsByCode")) SWIG_fail;
-  result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::map<int,CdiVariable > *)new std::map<int,CdiVariable >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = 0 ;
+  std::map<int,CdiVariable > *arg1 = 0 ;
+  std::map<int,CdiVariable > *result = 0 ;
   int res1 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_VarsByCode",&obj0)) SWIG_fail;
   {
-    std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *ptr = (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)0;
+    std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *ptr = (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *)0;
     res1 = swig::asptr(obj0, &ptr);
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map<int,CdiVariable > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map<int,CdiVariable > const &""'"); 
     }
     arg1 = ptr;
   }
-  result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::map< int,CdiVariable > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::map<int,CdiVariable > *)new std::map<int,CdiVariable >((std::map<int,CdiVariable > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res1)) delete arg1;
   return resultobj;
 fail:
@@ -18249,55 +16347,43 @@ SWIGINTERN PyObject *_wrap_new_VarsByCode(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
-    return _wrap_new_VarsByCode__SWIG_1(self, args);
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_VarsByCode__SWIG_0(self, args);
-    }
+    return _wrap_new_VarsByCode__SWIG_0(self, args);
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_VarsByCode__SWIG_2(self, args);
+      return _wrap_new_VarsByCode__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VarsByCode'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiVariable >::map(std::less< int > const &)\n"
-    "    std::map< int,CdiVariable >::map()\n"
-    "    std::map< int,CdiVariable >::map(std::map< int,CdiVariable > const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_VarsByCode'.\n  Possible C/C++ prototypes are:\n    std::map<(int,CdiVariable)>()\n    std::map<(int,CdiVariable)>(std::map<int,CdiVariable > const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_VarsByCode_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_empty" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_empty" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (bool)((std::map< int,CdiVariable > const *)arg1)->empty();
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (bool)((std::map<int,CdiVariable > const *)arg1)->empty();
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -18307,19 +16393,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_size" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_size" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = ((std::map< int,CdiVariable > const *)arg1)->size();
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = ((std::map<int,CdiVariable > const *)arg1)->size();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -18329,17 +16415,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_clear" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_clear" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   (arg1)->clear();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -18350,8 +16436,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable > *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -18360,19 +16446,19 @@ SWIGINTERN PyObject *_wrap_VarsByCode_swap(PyObject *SWIGUNUSEDPARM(self), PyObj
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_swap" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_swap" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t,  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t,  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map< int,CdiVariable > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map<int,CdiVariable > &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map< int,CdiVariable > &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map<int,CdiVariable > &""'"); 
   }
-  arg2 = reinterpret_cast< std::map< int,CdiVariable > * >(argp2);
+  arg2 = reinterpret_cast< std::map<int,CdiVariable > * >(argp2);
   (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -18381,146 +16467,370 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  SwigValueWrapper<std::allocator<std::pair<int const,CdiVariable > > > result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_get_allocator",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_get_allocator" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = ((std::map<int,CdiVariable > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiVariable >::allocator_type(static_cast< const std::map<int,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_begin" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_begin" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = ((std::map<int,CdiVariable > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_begin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_begin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_begin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_end" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< std::pair< int const,CdiVariable > > > result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_end" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = ((std::map< int,CdiVariable > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::map< int,CdiVariable >::allocator_type(static_cast< const std::map< int,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = ((std::map<int,CdiVariable > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_end__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_begin" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rbegin" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_end" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rbegin" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = ((std::map<int,CdiVariable > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_rbegin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable >::reverse_iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rbegin" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rend" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = (arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:VarsByCode_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rend" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rend" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  result = ((std::map<int,CdiVariable > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_VarsByCode_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_VarsByCode_rend__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->erase((std::map< int,CdiVariable >::key_type const &)*arg2);
+  result = (arg1)->erase((std::map<int,CdiVariable >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -18530,30 +16840,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiVariable >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_count",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_count" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_count" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_count" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_count" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
-  result = ((std::map< int,CdiVariable > const *)arg1)->count((std::map< int,CdiVariable >::key_type const &)*arg2);
+  result = ((std::map<int,CdiVariable > const *)arg1)->count((std::map<int,CdiVariable >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -18563,30 +16873,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::iterator arg2 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::iterator arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map<int,CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map<int,CdiVariable >::iterator""'");
     }
   }
   (arg1)->erase(arg2);
@@ -18599,45 +16909,45 @@ fail:
 
 SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::iterator arg2 ;
-  std::map< int,CdiVariable >::iterator arg3 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::iterator arg2 ;
+  std::map<int,CdiVariable >::iterator arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:VarsByCode_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map<int,CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map<int,CdiVariable >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map< int,CdiVariable >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map<int,CdiVariable >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map< int,CdiVariable >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map<int,CdiVariable >::iterator""'");
     }
   }
   (arg1)->erase(arg2,arg3);
@@ -18654,18 +16964,18 @@ SWIGINTERN PyObject *_wrap_VarsByCode_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_VarsByCode_erase__SWIG_1(self, args);
       }
@@ -18673,7 +16983,7 @@ SWIGINTERN PyObject *_wrap_VarsByCode_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -18687,16 +16997,16 @@ SWIGINTERN PyObject *_wrap_VarsByCode_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiVariable >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_VarsByCode_erase__SWIG_2(self, args);
         }
@@ -18705,188 +17015,397 @@ SWIGINTERN PyObject *_wrap_VarsByCode_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VarsByCode_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::key_type const &)\n"
-    "    std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::iterator)\n"
-    "    std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::iterator,std::map< int,CdiVariable >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::map<int,CdiVariable >::key_type const &)\n    erase(std::map<int,CdiVariable >::iterator)\n    erase(std::map<int,CdiVariable >::iterator,std::map<int,CdiVariable >::iterator)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_find__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_find",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_find" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_find" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
+  arg2 = &temp2;
+  result = (arg1)->find((std::map<int,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_find__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_find",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_find" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_find" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiVariable > const *)arg1)->find((std::map<int,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_find(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_VarsByCode_find__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_VarsByCode_find__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_find'.\n  Possible C/C++ prototypes are:\n    find(std::map<int,CdiVariable >::key_type const &)\n    find(std::map<int,CdiVariable >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_lower_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_find" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_find" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->find((std::map< int,CdiVariable >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->lower_bound((std::map<int,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_lower_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_lower_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->lower_bound((std::map< int,CdiVariable >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = ((std::map<int,CdiVariable > const *)arg1)->lower_bound((std::map<int,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_VarsByCode_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_lower_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_VarsByCode_lower_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_VarsByCode_lower_bound__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_lower_bound'.\n  Possible C/C++ prototypes are:\n    lower_bound(std::map<int,CdiVariable >::key_type const &)\n    lower_bound(std::map<int,CdiVariable >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_VarsByCode_upper_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
-  std::map< int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiVariable >::key_type temp2 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiVariable >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_upper_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->upper_bound((std::map< int,CdiVariable >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->upper_bound((std::map<int,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_delete_VarsByCode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_VarsByCode_upper_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
+  std::map<int,CdiVariable >::key_type *arg2 = 0 ;
+  std::map<int,CdiVariable >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  std::map<int,CdiVariable >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_VarsByCode",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:VarsByCode_upper_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiVariable > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1);
-  delete arg1;
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiVariable >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiVariable >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiVariable > const *)arg1)->upper_bound((std::map<int,CdiVariable >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiVariable >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *VarsByCode_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
+SWIGINTERN PyObject *_wrap_VarsByCode_upper_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_VarsByCode_upper_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_VarsByCode_upper_bound__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'VarsByCode_upper_bound'.\n  Possible C/C++ prototypes are:\n    upper_bound(std::map<int,CdiVariable >::key_type const &)\n    upper_bound(std::map<int,CdiVariable >::key_type const &)\n");
+  return NULL;
 }
 
-SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+
+SWIGINTERN PyObject *_wrap_delete_VarsByCode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::less< int > *arg1 = 0 ;
+  std::map<int,CdiVariable > *arg1 = (std::map<int,CdiVariable > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis > *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:new_TaxesMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__lessT_int_t,  0  | 0);
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_VarsByCode",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsByCode" "', argument " "1"" of type '" "std::map<int,CdiVariable > *""'"); 
   }
-  arg1 = reinterpret_cast< std::less< int > * >(argp1);
-  result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::less< int > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiVariable > * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *VarsByCode_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
 SWIGINTERN PyObject *_wrap_TaxesMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_iterator" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -18895,41 +17414,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__((std::map< int,CdiTaxis > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_TaxesMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___nonzero__" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____bool__((std::map< int,CdiTaxis > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__((std::map<int,CdiTaxis > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -18939,19 +17436,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___len__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___len__" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = std_map_Sl_int_Sc_CdiTaxis_Sg____len__((std::map< int,CdiTaxis > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = std_map_Sl_int_Sc_CdiTaxis_Sg____len__((std::map<int,CdiTaxis > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -18961,37 +17458,37 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::mapped_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiTaxis >::mapped_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___getitem__" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___getitem__" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
   try {
-    result = (std::map< int,CdiTaxis >::mapped_type *) &std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(arg1,(int const &)*arg2);
+    result = std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__((std::map<int,CdiTaxis > const *)arg1,(int const &)*arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, 0 |  0 );
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiTaxis >::mapped_type(static_cast< const std::map<int,CdiTaxis >::mapped_type& >(result))), SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -19000,27 +17497,27 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___delitem__" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___delitem__" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
   try {
     std_map_Sl_int_Sc_CdiTaxis_Sg____delitem__(arg1,(int const &)*arg2);
@@ -19038,30 +17535,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_has_key",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_has_key" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_has_key" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg__has_key((std::map< int,CdiTaxis > const *)arg1,(int const &)*arg2);
+  result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg__has_key((std::map<int,CdiTaxis > const *)arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -19071,18 +17568,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_keys",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_keys" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_keys" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__keys(arg1);
   resultobj = result;
   return resultobj;
@@ -19093,18 +17590,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_values",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_values" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_values" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__values(arg1);
   resultobj = result;
   return resultobj;
@@ -19115,18 +17612,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_items",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_items" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_items" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__items(arg1);
   resultobj = result;
   return resultobj;
@@ -19137,28 +17634,28 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap___contains__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___contains__" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___contains__" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
   result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
@@ -19170,22 +17667,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_key_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_key_iterator" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -19194,68 +17691,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_value_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_TaxesMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_value_iterator" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
-  } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
-  arg2 = &temp2;
-  std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_0(arg1,(int const &)*arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_TaxesMap___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
-  std::map< int,CdiTaxis >::mapped_type *arg3 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::mapped_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   void *argp3 = 0 ;
@@ -19265,27 +17730,27 @@ SWIGINTERN PyObject *_wrap_TaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:TaxesMap___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___setitem__" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___setitem__" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiTaxis,  0  | 0);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map<int,CdiTaxis >::mapped_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map<int,CdiTaxis >::mapped_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::map< int,CdiTaxis >::mapped_type * >(argp3);
+  arg3 = reinterpret_cast< std::map<int,CdiTaxis >::mapped_type * >(argp3);
   try {
-    std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiTaxis const &)*arg3);
+    std_map_Sl_int_Sc_CdiTaxis_Sg____setitem__(arg1,(int const &)*arg2,(CdiTaxis const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -19298,114 +17763,40 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap___setitem__(PyObject *self, PyObject *args) {
-  int argc;
-  PyObject *argv[4];
-  int ii;
-  
-  if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
-    argv[ii] = PyTuple_GET_ITEM(args,ii);
-  }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_TaxesMap___setitem____SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiTaxis, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_TaxesMap___setitem____SWIG_1(self, args);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'TaxesMap___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiTaxis >::__setitem__(std::map< int,CdiTaxis >::key_type const &)\n"
-    "    std::map< int,CdiTaxis >::__setitem__(std::map< int,CdiTaxis >::key_type const &,std::map< int,CdiTaxis >::mapped_type const &)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_TaxesMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_asdict",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__asdict(arg1);
-  resultobj = result;
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *result = 0 ;
+  std::map<int,CdiTaxis > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)":new_TaxesMap")) SWIG_fail;
-  result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::map<int,CdiTaxis > *)new std::map<int,CdiTaxis >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = 0 ;
+  std::map<int,CdiTaxis > *result = 0 ;
   int res1 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_TaxesMap",&obj0)) SWIG_fail;
   {
-    std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *ptr = (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)0;
+    std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *ptr = (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *)0;
     res1 = swig::asptr(obj0, &ptr);
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const &""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const &""'"); 
     }
     if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const &""'"); 
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const &""'"); 
     }
     arg1 = ptr;
   }
-  result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::map< int,CdiTaxis > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW |  0 );
+  result = (std::map<int,CdiTaxis > *)new std::map<int,CdiTaxis >((std::map<int,CdiTaxis > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW |  0 );
   if (SWIG_IsNewObj(res1)) delete arg1;
   return resultobj;
 fail:
@@ -19420,55 +17811,43 @@ SWIGINTERN PyObject *_wrap_new_TaxesMap(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
-    return _wrap_new_TaxesMap__SWIG_1(self, args);
-  }
-  if (argc == 1) {
-    int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      return _wrap_new_TaxesMap__SWIG_0(self, args);
-    }
+    return _wrap_new_TaxesMap__SWIG_0(self, args);
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_TaxesMap__SWIG_2(self, args);
+      return _wrap_new_TaxesMap__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_TaxesMap'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiTaxis >::map(std::less< int > const &)\n"
-    "    std::map< int,CdiTaxis >::map()\n"
-    "    std::map< int,CdiTaxis >::map(std::map< int,CdiTaxis > const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_TaxesMap'.\n  Possible C/C++ prototypes are:\n    std::map<(int,CdiTaxis)>()\n    std::map<(int,CdiTaxis)>(std::map<int,CdiTaxis > const &)\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_TaxesMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_empty" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_empty" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (bool)((std::map< int,CdiTaxis > const *)arg1)->empty();
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (bool)((std::map<int,CdiTaxis > const *)arg1)->empty();
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -19478,19 +17857,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_size" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_size" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = ((std::map< int,CdiTaxis > const *)arg1)->size();
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = ((std::map<int,CdiTaxis > const *)arg1)->size();
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -19500,17 +17879,17 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_clear" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_clear" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   (arg1)->clear();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -19521,8 +17900,8 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis > *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -19531,19 +17910,19 @@ SWIGINTERN PyObject *_wrap_TaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObjec
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_swap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_swap" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t,  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t,  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiTaxis > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map<int,CdiTaxis > &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiTaxis > &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map<int,CdiTaxis > &""'"); 
   }
-  arg2 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp2);
+  arg2 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp2);
   (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -19554,144 +17933,368 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  SwigValueWrapper<std::allocator<std::pair<int const,CdiTaxis > > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< std::pair< int const,CdiTaxis > > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_get_allocator" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = ((std::map<int,CdiTaxis > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiTaxis >::allocator_type(static_cast< const std::map<int,CdiTaxis >::allocator_type& >(result))), SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_begin" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_begin" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = ((std::map<int,CdiTaxis > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_begin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_begin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_begin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_end" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_end" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = ((std::map<int,CdiTaxis > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_end__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::reverse_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rbegin" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = ((std::map< int,CdiTaxis > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::allocator_type(static_cast< const std::map< int,CdiTaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_TaxesMap_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_begin" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rbegin" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = ((std::map<int,CdiTaxis > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis >::iterator result;
+SWIGINTERN PyObject *_wrap_TaxesMap_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_end" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_rbegin__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_TaxesMap_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis >::reverse_iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rend" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = (arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_TaxesMap_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis >::reverse_iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:TaxesMap_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rend" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rend" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  result = ((std::map<int,CdiTaxis > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_TaxesMap_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_TaxesMap_rend__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiTaxis >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->erase((std::map< int,CdiTaxis >::key_type const &)*arg2);
+  result = (arg1)->erase((std::map<int,CdiTaxis >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -19701,30 +18304,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiTaxis >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_count",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_count" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_count" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_count" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_count" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = ((std::map< int,CdiTaxis > const *)arg1)->count((std::map< int,CdiTaxis >::key_type const &)*arg2);
+  result = ((std::map<int,CdiTaxis > const *)arg1)->count((std::map<int,CdiTaxis >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -19734,30 +18337,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::iterator arg2 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::iterator arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::iterator""'");
     }
   }
   (arg1)->erase(arg2);
@@ -19770,45 +18373,45 @@ fail:
 
 SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::iterator arg2 ;
-  std::map< int,CdiTaxis >::iterator arg3 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::iterator arg2 ;
+  std::map<int,CdiTaxis >::iterator arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:TaxesMap_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map<int,CdiTaxis >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map<int,CdiTaxis >::iterator""'");
     }
   }
   (arg1)->erase(arg2,arg3);
@@ -19825,18 +18428,18 @@ SWIGINTERN PyObject *_wrap_TaxesMap_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_TaxesMap_erase__SWIG_1(self, args);
       }
@@ -19844,7 +18447,7 @@ SWIGINTERN PyObject *_wrap_TaxesMap_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -19858,16 +18461,16 @@ SWIGINTERN PyObject *_wrap_TaxesMap_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiTaxis >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_TaxesMap_erase__SWIG_2(self, args);
         }
@@ -19876,131 +18479,365 @@ SWIGINTERN PyObject *_wrap_TaxesMap_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'TaxesMap_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::key_type const &)\n"
-    "    std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::iterator)\n"
-    "    std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::iterator,std::map< int,CdiTaxis >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::map<int,CdiTaxis >::key_type const &)\n    erase(std::map<int,CdiTaxis >::iterator)\n    erase(std::map<int,CdiTaxis >::iterator,std::map<int,CdiTaxis >::iterator)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_find__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_find",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_find" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_find" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = (arg1)->find((std::map<int,CdiTaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_TaxesMap_find__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiTaxis >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_find",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_find" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_find" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiTaxis > const *)arg1)->find((std::map<int,CdiTaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_find(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_TaxesMap_find__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_TaxesMap_find__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_find'.\n  Possible C/C++ prototypes are:\n    find(std::map<int,CdiTaxis >::key_type const &)\n    find(std::map<int,CdiTaxis >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_lower_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_find" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_find" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->find((std::map< int,CdiTaxis >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->lower_bound((std::map<int,CdiTaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_TaxesMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_TaxesMap_lower_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiTaxis >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_lower_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiTaxis > const *)arg1)->lower_bound((std::map<int,CdiTaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_lower_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_TaxesMap_lower_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_TaxesMap_lower_bound__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_lower_bound'.\n  Possible C/C++ prototypes are:\n    lower_bound(std::map<int,CdiTaxis >::key_type const &)\n    lower_bound(std::map<int,CdiTaxis >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_upper_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_upper_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = (arg1)->upper_bound((std::map<int,CdiTaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_upper_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiTaxis >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiTaxis >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_upper_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiTaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiTaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiTaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiTaxis > const *)arg1)->upper_bound((std::map<int,CdiTaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiTaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_TaxesMap_upper_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_TaxesMap_upper_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_TaxesMap_upper_bound__SWIG_1(self, args);
+      }
+    }
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
-  } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
-  arg2 = &temp2;
-  result = (arg1)->lower_bound((std::map< int,CdiTaxis >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_TaxesMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
-  std::map< int,CdiTaxis >::key_type *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  std::map< int,CdiTaxis >::key_type temp2 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  std::map< int,CdiTaxis >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:TaxesMap_upper_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'");
-  } 
-  temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2);
-  arg2 = &temp2;
-  result = (arg1)->upper_bound((std::map< int,CdiTaxis >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'TaxesMap_upper_bound'.\n  Possible C/C++ prototypes are:\n    upper_bound(std::map<int,CdiTaxis >::key_type const &)\n    upper_bound(std::map<int,CdiTaxis >::key_type const &)\n");
   return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_delete_TaxesMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ;
+  std::map<int,CdiTaxis > *arg1 = (std::map<int,CdiTaxis > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_TaxesMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_TaxesMap" "', argument " "1"" of type '" "std::map<int,CdiTaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiTaxis > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -20010,54 +18847,29 @@ fail:
 
 SWIGINTERN PyObject *TaxesMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::less< int > *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_ZaxesMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__lessT_int_t,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); 
-  }
-  arg1 = reinterpret_cast< std::less< int > * >(argp1);
-  result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::less< int > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_ZaxesMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_iterator" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -20066,41 +18878,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__((std::map< int,CdiZaxis > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ZaxesMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___nonzero__" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____bool__((std::map< int,CdiZaxis > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__((std::map<int,CdiZaxis > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -20110,19 +18900,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___len__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___len__" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = std_map_Sl_int_Sc_CdiZaxis_Sg____len__((std::map< int,CdiZaxis > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = std_map_Sl_int_Sc_CdiZaxis_Sg____len__((std::map<int,CdiZaxis > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -20132,37 +18922,37 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::mapped_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiZaxis >::mapped_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___getitem__" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___getitem__" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
   try {
-    result = (std::map< int,CdiZaxis >::mapped_type *) &std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(arg1,(int const &)*arg2);
+    result = std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__((std::map<int,CdiZaxis > const *)arg1,(int const &)*arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, 0 |  0 );
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiZaxis >::mapped_type(static_cast< const std::map<int,CdiZaxis >::mapped_type& >(result))), SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -20171,27 +18961,27 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___delitem__" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___delitem__" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
   try {
     std_map_Sl_int_Sc_CdiZaxis_Sg____delitem__(arg1,(int const &)*arg2);
@@ -20209,30 +18999,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_has_key",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_has_key" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_has_key" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg__has_key((std::map< int,CdiZaxis > const *)arg1,(int const &)*arg2);
+  result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg__has_key((std::map<int,CdiZaxis > const *)arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -20242,18 +19032,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_keys",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_keys" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_keys" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__keys(arg1);
   resultobj = result;
   return resultobj;
@@ -20264,18 +19054,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_values",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_values" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_values" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__values(arg1);
   resultobj = result;
   return resultobj;
@@ -20286,18 +19076,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_items",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_items" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_items" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__items(arg1);
   resultobj = result;
   return resultobj;
@@ -20308,28 +19098,28 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap___contains__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___contains__" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___contains__" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
   result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
@@ -20341,22 +19131,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_key_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_key_iterator" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -20365,68 +19155,36 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_value_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ZaxesMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_value_iterator" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
-  } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
-  arg2 = &temp2;
-  std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_0(arg1,(int const &)*arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
-  std::map< int,CdiZaxis >::mapped_type *arg3 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::mapped_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   void *argp3 = 0 ;
@@ -20436,27 +19194,27 @@ SWIGINTERN PyObject *_wrap_ZaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:ZaxesMap___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___setitem__" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___setitem__" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiZaxis,  0  | 0);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type,  0  | 0);
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map<int,CdiZaxis >::mapped_type const &""'"); 
   }
   if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map<int,CdiZaxis >::mapped_type const &""'"); 
   }
-  arg3 = reinterpret_cast< std::map< int,CdiZaxis >::mapped_type * >(argp3);
+  arg3 = reinterpret_cast< std::map<int,CdiZaxis >::mapped_type * >(argp3);
   try {
-    std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiZaxis const &)*arg3);
+    std_map_Sl_int_Sc_CdiZaxis_Sg____setitem__(arg1,(int const &)*arg2,(CdiZaxis const &)*arg3);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
@@ -20469,400 +19227,538 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap___setitem__(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)":new_ZaxesMap")) SWIG_fail;
+  result = (std::map<int,CdiZaxis > *)new std::map<int,CdiZaxis >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = 0 ;
+  std::map<int,CdiZaxis > *result = 0 ;
+  int res1 = SWIG_OLDOBJ ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_ZaxesMap",&obj0)) SWIG_fail;
+  {
+    std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *ptr = (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *)0;
+    res1 = swig::asptr(obj0, &ptr);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const &""'"); 
+    }
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const &""'"); 
+    }
+    arg1 = ptr;
+  }
+  result = (std::map<int,CdiZaxis > *)new std::map<int,CdiZaxis >((std::map<int,CdiZaxis > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW |  0 );
+  if (SWIG_IsNewObj(res1)) delete arg1;
+  return resultobj;
+fail:
+  if (SWIG_IsNewObj(res1)) delete arg1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ZaxesMap(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[4];
+  PyObject *argv[2];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 2) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_ZaxesMap___setitem____SWIG_0(self, args);
-      }
-    }
+  if (argc == 0) {
+    return _wrap_new_ZaxesMap__SWIG_0(self, args);
   }
-  if (argc == 3) {
+  if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiZaxis, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_ZaxesMap___setitem____SWIG_1(self, args);
-        }
-      }
+      return _wrap_new_ZaxesMap__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ZaxesMap___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiZaxis >::__setitem__(std::map< int,CdiZaxis >::key_type const &)\n"
-    "    std::map< int,CdiZaxis >::__setitem__(std::map< int,CdiZaxis >::key_type const &,std::map< int,CdiZaxis >::mapped_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_ZaxesMap'.\n  Possible C/C++ prototypes are:\n    std::map<(int,CdiZaxis)>()\n    std::map<(int,CdiZaxis)>(std::map<int,CdiZaxis > const &)\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_asdict",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_empty",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_empty" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__asdict(arg1);
-  resultobj = result;
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (bool)((std::map<int,CdiZaxis > const *)arg1)->empty();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *result = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::size_type result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)":new_ZaxesMap")) SWIG_fail;
-  result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_size",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_size" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->size();
+  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = 0 ;
-  int res1 = SWIG_OLDOBJ ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis > *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:new_ZaxesMap",&obj0)) SWIG_fail;
-  {
-    std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *ptr = (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)0;
-    res1 = swig::asptr(obj0, &ptr);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const &""'"); 
-    }
-    arg1 = ptr;
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_clear",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_clear" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::map< int,CdiZaxis > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW |  0 );
-  if (SWIG_IsNewObj(res1)) delete arg1;
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  (arg1)->clear();
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_swap",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_swap" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map<int,CdiZaxis > &""'"); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map<int,CdiZaxis > &""'"); 
+  }
+  arg2 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp2);
+  (arg1)->swap(*arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  SwigValueWrapper<std::allocator<std::pair<int const,CdiZaxis > > > result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_get_allocator",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_get_allocator" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiZaxis >::allocator_type(static_cast< const std::map<int,CdiZaxis >::allocator_type& >(result))), SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_begin" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_begin" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
-  if (SWIG_IsNewObj(res1)) delete arg1;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_ZaxesMap(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_begin(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[2];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 0) {
-    return _wrap_new_ZaxesMap__SWIG_1(self, args);
-  }
   if (argc == 1) {
     int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, 0);
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_ZaxesMap__SWIG_0(self, args);
+      return _wrap_ZaxesMap_begin__SWIG_0(self, args);
     }
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_ZaxesMap__SWIG_2(self, args);
+      return _wrap_ZaxesMap_begin__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ZaxesMap'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiZaxis >::map(std::less< int > const &)\n"
-    "    std::map< int,CdiZaxis >::map()\n"
-    "    std::map< int,CdiZaxis >::map(std::map< int,CdiZaxis > const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_empty" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_end" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (bool)((std::map< int,CdiZaxis > const *)arg1)->empty();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis >::size_type result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_size" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_end" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = ((std::map< int,CdiZaxis > const *)arg1)->size();
-  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+SWIGINTERN PyObject *_wrap_ZaxesMap_end(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_clear" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  (arg1)->clear();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ZaxesMap_end__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ZaxesMap_end__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis > *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_swap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t,  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiZaxis > &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rbegin" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiZaxis > &""'"); 
-  }
-  arg2 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp2);
-  (arg1)->swap(*arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< std::pair< int const,CdiZaxis > > > result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rbegin" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = ((std::map< int,CdiZaxis > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::allocator_type(static_cast< const std::map< int,CdiZaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis >::iterator result;
+SWIGINTERN PyObject *_wrap_ZaxesMap_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_begin" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ZaxesMap_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ZaxesMap_rbegin__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_end" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rend" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = (arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis >::reverse_iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rend" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis >::reverse_iterator result;
+SWIGINTERN PyObject *_wrap_ZaxesMap_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:ZaxesMap_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rend" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ZaxesMap_rend__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_ZaxesMap_rend__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
   return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiZaxis >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->erase((std::map< int,CdiZaxis >::key_type const &)*arg2);
+  result = (arg1)->erase((std::map<int,CdiZaxis >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -20872,30 +19768,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiZaxis >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_count",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_count" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_count" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_count" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_count" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = ((std::map< int,CdiZaxis > const *)arg1)->count((std::map< int,CdiZaxis >::key_type const &)*arg2);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->count((std::map<int,CdiZaxis >::key_type const &)*arg2);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -20905,30 +19801,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::iterator arg2 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::iterator arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::iterator""'");
     }
   }
   (arg1)->erase(arg2);
@@ -20941,45 +19837,45 @@ fail:
 
 SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::iterator arg2 ;
-  std::map< int,CdiZaxis >::iterator arg3 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::iterator arg2 ;
+  std::map<int,CdiZaxis >::iterator arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
   int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
+  swig::PySwigIterator *iter3 = 0 ;
   int res3 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:ZaxesMap_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter2);
+    swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *>(iter2);
     if (iter_t) {
       arg2 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::iterator""'");
     }
   }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
   if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::iterator""'");
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map<int,CdiZaxis >::iterator""'");
   } else {
-    swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter3);
+    swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *>(iter3);
     if (iter_t) {
       arg3 = iter_t->get_current();
     } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::iterator""'");
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map<int,CdiZaxis >::iterator""'");
     }
   }
   (arg1)->erase(arg2,arg3);
@@ -20996,18 +19892,18 @@ SWIGINTERN PyObject *_wrap_ZaxesMap_erase(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *>(iter) != 0));
       if (_v) {
         return _wrap_ZaxesMap_erase__SWIG_1(self, args);
       }
@@ -21015,7 +19911,7 @@ SWIGINTERN PyObject *_wrap_ZaxesMap_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -21029,16 +19925,16 @@ SWIGINTERN PyObject *_wrap_ZaxesMap_erase(PyObject *self, PyObject *args) {
   }
   if (argc == 3) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0));
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *>(iter) != 0));
       if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0));
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiZaxis >::iterator > *>(iter) != 0));
         if (_v) {
           return _wrap_ZaxesMap_erase__SWIG_2(self, args);
         }
@@ -21047,131 +19943,365 @@ SWIGINTERN PyObject *_wrap_ZaxesMap_erase(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'ZaxesMap_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::key_type const &)\n"
-    "    std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::iterator)\n"
-    "    std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::iterator,std::map< int,CdiZaxis >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::map<int,CdiZaxis >::key_type const &)\n    erase(std::map<int,CdiZaxis >::iterator)\n    erase(std::map<int,CdiZaxis >::iterator,std::map<int,CdiZaxis >::iterator)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_find__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_find",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_find" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_find" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = (arg1)->find((std::map<int,CdiZaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_find__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiZaxis >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_find",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_find" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_find" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiZaxis > const *)arg1)->find((std::map<int,CdiZaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_find(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ZaxesMap_find__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ZaxesMap_find__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_find'.\n  Possible C/C++ prototypes are:\n    find(std::map<int,CdiZaxis >::key_type const &)\n    find(std::map<int,CdiZaxis >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_lower_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
+  arg2 = &temp2;
+  result = (arg1)->lower_bound((std::map<int,CdiZaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_lower_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_find" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_find" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->find((std::map< int,CdiZaxis >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->lower_bound((std::map<int,CdiZaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_lower_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ZaxesMap_lower_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ZaxesMap_lower_bound__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_lower_bound'.\n  Possible C/C++ prototypes are:\n    lower_bound(std::map<int,CdiZaxis >::key_type const &)\n    lower_bound(std::map<int,CdiZaxis >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ZaxesMap_upper_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiZaxis >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_lower_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_upper_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->lower_bound((std::map< int,CdiZaxis >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->upper_bound((std::map<int,CdiZaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_ZaxesMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_ZaxesMap_upper_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
-  std::map< int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis >::key_type *arg2 = 0 ;
+  std::map<int,CdiZaxis >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiZaxis >::key_type temp2 ;
+  std::map<int,CdiZaxis >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiZaxis >::iterator result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:ZaxesMap_upper_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiZaxis > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiZaxis >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiZaxis >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->upper_bound((std::map< int,CdiZaxis >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = ((std::map<int,CdiZaxis > const *)arg1)->upper_bound((std::map<int,CdiZaxis >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiZaxis >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
+SWIGINTERN PyObject *_wrap_ZaxesMap_upper_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ZaxesMap_upper_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_ZaxesMap_upper_bound__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'ZaxesMap_upper_bound'.\n  Possible C/C++ prototypes are:\n    upper_bound(std::map<int,CdiZaxis >::key_type const &)\n    upper_bound(std::map<int,CdiZaxis >::key_type const &)\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_delete_ZaxesMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ;
+  std::map<int,CdiZaxis > *arg1 = (std::map<int,CdiZaxis > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_ZaxesMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ZaxesMap" "', argument " "1"" of type '" "std::map<int,CdiZaxis > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiZaxis > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -21181,54 +20311,29 @@ fail:
 
 SWIGINTERN PyObject *ZaxesMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::less< int > *arg1 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:new_GridsMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_std__lessT_int_t,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::less< int > const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::less< int > const &""'"); 
-  }
-  arg1 = reinterpret_cast< std::less< int > * >(argp1);
-  result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::less< int > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_GridsMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_iterator" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -21237,41 +20342,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
   bool result;
-  
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap___nonzero__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__((std::map< int,CdiGrid > const *)arg1);
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_GridsMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap___bool__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap___nonzero__",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___nonzero__" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____bool__((std::map< int,CdiGrid > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__((std::map<int,CdiGrid > const *)arg1);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -21281,19 +20364,19 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid >::size_type result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:GridsMap___len__",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___len__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___len__" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = std_map_Sl_int_Sc_CdiGrid_Sg____len__((std::map< int,CdiGrid > const *)arg1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = std_map_Sl_int_Sc_CdiGrid_Sg____len__((std::map<int,CdiGrid > const *)arg1);
   resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
@@ -21303,37 +20386,37 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::mapped_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiGrid >::mapped_type *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap___getitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___getitem__" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___getitem__" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
   try {
-    result = (std::map< int,CdiGrid >::mapped_type *) &std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(arg1,(int const &)*arg2);
+    result = std_map_Sl_int_Sc_CdiGrid_Sg____getitem__((std::map<int,CdiGrid > const *)arg1,(int const &)*arg2);
   }
   catch(std::out_of_range &_e) {
     SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
   }
   
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, 0 |  0 );
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiGrid >::mapped_type(static_cast< const std::map<int,CdiGrid >::mapped_type& >(result))), SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -21342,27 +20425,27 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap___delitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___delitem__" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___delitem__" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
   try {
     std_map_Sl_int_Sc_CdiGrid_Sg____delitem__(arg1,(int const &)*arg2);
@@ -21380,30 +20463,30 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_has_key",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_has_key" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_has_key" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
-  result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg__has_key((std::map< int,CdiGrid > const *)arg1,(int const &)*arg2);
+  result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg__has_key((std::map<int,CdiGrid > const *)arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
@@ -21413,18 +20496,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_keys",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_keys" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_keys" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__keys(arg1);
   resultobj = result;
   return resultobj;
@@ -21435,18 +20518,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_values",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_values" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_values" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__values(arg1);
   resultobj = result;
   return resultobj;
@@ -21457,18 +20540,18 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_items",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_items" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_items" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__items(arg1);
   resultobj = result;
   return resultobj;
@@ -21479,28 +20562,28 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap___contains__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___contains__" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___contains__" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
   result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____contains__(arg1,(int const &)*arg2);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
@@ -21512,22 +20595,22 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_key_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_key_iterator" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -21536,53 +20619,239 @@ fail:
 
 SWIGINTERN PyObject *_wrap_GridsMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
   PyObject **arg2 = (PyObject **) 0 ;
+  swig::PySwigIterator *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  swig::SwigPyIterator *result = 0 ;
   
   arg2 = &obj0;
   if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_value_iterator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_value_iterator" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (swig::PySwigIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__PySwigIterator, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap___setitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::mapped_type *arg3 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
+  void *argp3 = 0 ;
+  int res3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap___setitem__",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OOO:GridsMap___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___setitem__" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___setitem__" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
-  std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_0(arg1,(int const &)*arg2);
+  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type,  0  | 0);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map<int,CdiGrid >::mapped_type const &""'"); 
+  }
+  if (!argp3) {
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map<int,CdiGrid >::mapped_type const &""'"); 
+  }
+  arg3 = reinterpret_cast< std::map<int,CdiGrid >::mapped_type * >(argp3);
+  try {
+    std_map_Sl_int_Sc_CdiGrid_Sg____setitem__(arg1,(int const &)*arg2,(CdiGrid const &)*arg3);
+  }
+  catch(std::out_of_range &_e) {
+    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
+  }
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)":new_GridsMap")) SWIG_fail;
+  result = (std::map<int,CdiGrid > *)new std::map<int,CdiGrid >();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *arg1 = 0 ;
+  std::map<int,CdiGrid > *result = 0 ;
+  int res1 = SWIG_OLDOBJ ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_GridsMap",&obj0)) SWIG_fail;
+  {
+    std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *ptr = (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *)0;
+    res1 = swig::asptr(obj0, &ptr);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map<int,CdiGrid > const &""'"); 
+    }
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map<int,CdiGrid > const &""'"); 
+    }
+    arg1 = ptr;
+  }
+  result = (std::map<int,CdiGrid > *)new std::map<int,CdiGrid >((std::map<int,CdiGrid > const &)*arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, SWIG_POINTER_NEW |  0 );
+  if (SWIG_IsNewObj(res1)) delete arg1;
+  return resultobj;
+fail:
+  if (SWIG_IsNewObj(res1)) delete arg1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_GridsMap(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 0) {
+    return _wrap_new_GridsMap__SWIG_0(self, args);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_GridsMap__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_GridsMap'.\n  Possible C/C++ prototypes are:\n    std::map<(int,CdiGrid)>()\n    std::map<(int,CdiGrid)>(std::map<int,CdiGrid > const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_empty",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_empty" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (bool)((std::map<int,CdiGrid > const *)arg1)->empty();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::size_type result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_size",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_size" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = ((std::map<int,CdiGrid > const *)arg1)->size();
+  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_clear",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_clear" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  (arg1)->clear();
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_swap",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_swap" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map<int,CdiGrid > &""'"); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map<int,CdiGrid > &""'"); 
+  }
+  arg2 = reinterpret_cast< std::map<int,CdiGrid > * >(argp2);
+  (arg1)->swap(*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -21590,603 +20859,767 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  SwigValueWrapper<std::allocator<std::pair<int const,CdiGrid > > > result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_get_allocator",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_get_allocator" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = ((std::map<int,CdiGrid > const *)arg1)->get_allocator();
+  resultobj = SWIG_NewPointerObj((new std::map<int,CdiGrid >::allocator_type(static_cast< const std::map<int,CdiGrid >::allocator_type& >(result))), SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_begin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_begin" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
+  }
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_begin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
-  std::map< int,CdiGrid >::mapped_type *arg3 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:GridsMap___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_begin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
-  } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
-  arg2 = &temp2;
-  res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_CdiGrid,  0  | 0);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiGrid >::mapped_type const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_begin" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  if (!argp3) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiGrid >::mapped_type const &""'"); 
-  }
-  arg3 = reinterpret_cast< std::map< int,CdiGrid >::mapped_type * >(argp3);
-  try {
-    std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiGrid const &)*arg3);
-  }
-  catch(std::out_of_range &_e) {
-    SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
-  }
-  
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = ((std::map<int,CdiGrid > const *)arg1)->begin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap___setitem__(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_begin(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[4];
+  PyObject *argv[2];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 2) {
+  if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        return _wrap_GridsMap___setitem____SWIG_0(self, args);
-      }
+      return _wrap_GridsMap_begin__SWIG_0(self, args);
     }
   }
-  if (argc == 3) {
+  if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      {
-        int res = SWIG_AsVal_int(argv[1], NULL);
-        _v = SWIG_CheckState(res);
-      }
-      if (_v) {
-        int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiGrid, 0);
-        _v = SWIG_CheckState(res);
-        if (_v) {
-          return _wrap_GridsMap___setitem____SWIG_1(self, args);
-        }
-      }
+      return _wrap_GridsMap_begin__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'GridsMap___setitem__'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiGrid >::__setitem__(std::map< int,CdiGrid >::key_type const &)\n"
-    "    std::map< int,CdiGrid >::__setitem__(std::map< int,CdiGrid >::key_type const &,std::map< int,CdiGrid >::mapped_type const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_begin'.\n  Possible C/C++ prototypes are:\n    begin()\n    begin()\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_end__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_asdict",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_end" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__asdict(arg1);
-  resultobj = result;
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *result = 0 ;
-  
-  if (!PyArg_ParseTuple(args,(char *)":new_GridsMap")) SWIG_fail;
-  result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_end__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = 0 ;
-  int res1 = SWIG_OLDOBJ ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::const_iterator result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid > *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:new_GridsMap",&obj0)) SWIG_fail;
-  {
-    std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *ptr = (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)0;
-    res1 = swig::asptr(obj0, &ptr);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > const &""'"); 
-    }
-    if (!ptr) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > const &""'"); 
-    }
-    arg1 = ptr;
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_end",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_end" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::map< int,CdiGrid > const &)*arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW |  0 );
-  if (SWIG_IsNewObj(res1)) delete arg1;
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = ((std::map<int,CdiGrid > const *)arg1)->end();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
-  if (SWIG_IsNewObj(res1)) delete arg1;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_GridsMap(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_end(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[2];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (argc == 0) {
-    return _wrap_new_GridsMap__SWIG_1(self, args);
-  }
   if (argc == 1) {
     int _v;
-    int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, 0);
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_GridsMap__SWIG_0(self, args);
+      return _wrap_GridsMap_end__SWIG_0(self, args);
     }
   }
   if (argc == 1) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_GridsMap__SWIG_2(self, args);
+      return _wrap_GridsMap_end__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_GridsMap'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiGrid >::map(std::less< int > const &)\n"
-    "    std::map< int,CdiGrid >::map()\n"
-    "    std::map< int,CdiGrid >::map(std::map< int,CdiGrid > const &)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_end'.\n  Possible C/C++ prototypes are:\n    end()\n    end()\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_rbegin__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_empty",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_empty" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rbegin" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (bool)((std::map< int,CdiGrid > const *)arg1)->empty();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_rbegin__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid >::size_type result;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_size",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_rbegin",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_size" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rbegin" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = ((std::map< int,CdiGrid > const *)arg1)->size();
-  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = ((std::map<int,CdiGrid > const *)arg1)->rbegin();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_rbegin(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_GridsMap_rbegin__SWIG_0(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_GridsMap_rbegin__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_rbegin'.\n  Possible C/C++ prototypes are:\n    rbegin()\n    rbegin()\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_rend__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_clear",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_clear" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rend" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  (arg1)->clear();
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = (arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_rend__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid > *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::const_reverse_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_swap",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_rend",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_swap" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rend" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t,  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map< int,CdiGrid > &""'"); 
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  result = ((std::map<int,CdiGrid > const *)arg1)->rend();
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::const_reverse_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_rend(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map< int,CdiGrid > &""'"); 
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_GridsMap_rend__SWIG_0(self, args);
+    }
   }
-  arg2 = reinterpret_cast< std::map< int,CdiGrid > * >(argp2);
-  (arg1)->swap(*arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
+  if (argc == 1) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_GridsMap_rend__SWIG_1(self, args);
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_rend'.\n  Possible C/C++ prototypes are:\n    rend()\n    rend()\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::allocator< std::pair< int const,CdiGrid > > > result;
+  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_get_allocator",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_erase",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = ((std::map< int,CdiGrid > const *)arg1)->get_allocator();
-  resultobj = SWIG_NewPointerObj((new std::map< int,CdiGrid >::allocator_type(static_cast< const std::map< int,CdiGrid >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, SWIG_POINTER_OWN |  0 );
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
+  arg2 = &temp2;
+  result = (arg1)->erase((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::size_type result;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid >::iterator result;
+  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_begin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_count",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_begin" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_count" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (arg1)->begin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_count" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiGrid > const *)arg1)->count((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::iterator arg2 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
+  int res2 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid >::iterator result;
+  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_end",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_erase",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_end" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (arg1)->end();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
+  if (!SWIG_IsOK(res2) || !iter2) {
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map<int,CdiGrid >::iterator""'");
+  } else {
+    swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *>(iter2);
+    if (iter_t) {
+      arg2 = iter_t->get_current();
+    } else {
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map<int,CdiGrid >::iterator""'");
+    }
+  }
+  (arg1)->erase(arg2);
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::iterator arg2 ;
+  std::map<int,CdiGrid >::iterator arg3 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  swig::PySwigIterator *iter2 = 0 ;
+  int res2 ;
+  swig::PySwigIterator *iter3 = 0 ;
+  int res3 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid >::reverse_iterator result;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_rbegin",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OOO:GridsMap_erase",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (arg1)->rbegin();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::PySwigIterator::descriptor(), 0);
+  if (!SWIG_IsOK(res2) || !iter2) {
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map<int,CdiGrid >::iterator""'");
+  } else {
+    swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *>(iter2);
+    if (iter_t) {
+      arg2 = iter_t->get_current();
+    } else {
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map<int,CdiGrid >::iterator""'");
+    }
+  }
+  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::PySwigIterator::descriptor(), 0);
+  if (!SWIG_IsOK(res3) || !iter3) {
+    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map<int,CdiGrid >::iterator""'");
+  } else {
+    swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *>(iter3);
+    if (iter_t) {
+      arg3 = iter_t->get_current();
+    } else {
+      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map<int,CdiGrid >::iterator""'");
+    }
+  }
+  (arg1)->erase(arg2,arg3);
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid >::reverse_iterator result;
+SWIGINTERN PyObject *_wrap_GridsMap_erase(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:GridsMap_rend",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rend" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *>(iter) != 0));
+      if (_v) {
+        return _wrap_GridsMap_erase__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_GridsMap_erase__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      swig::PySwigIterator *iter = 0;
+      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *>(iter) != 0));
+      if (_v) {
+        swig::PySwigIterator *iter = 0;
+        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::PySwigIterator::descriptor(), 0);
+        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::PySwigIterator_T<std::map<int,CdiGrid >::iterator > *>(iter) != 0));
+        if (_v) {
+          return _wrap_GridsMap_erase__SWIG_2(self, args);
+        }
+      }
+    }
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  result = (arg1)->rend();
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_erase'.\n  Possible C/C++ prototypes are:\n    erase(std::map<int,CdiGrid >::key_type const &)\n    erase(std::map<int,CdiGrid >::iterator)\n    erase(std::map<int,CdiGrid >::iterator,std::map<int,CdiGrid >::iterator)\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_find__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiGrid >::size_type result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_find",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_find" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_find" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->erase((std::map< int,CdiGrid >::key_type const &)*arg2);
-  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
+  result = (arg1)->find((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_find__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiGrid >::size_type result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_count",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_find",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_count" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_find" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_count" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_find" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
-  result = ((std::map< int,CdiGrid > const *)arg1)->count((std::map< int,CdiGrid >::key_type const &)*arg2);
-  resultobj = SWIG_From_size_t(static_cast< size_t >(result));
+  result = ((std::map<int,CdiGrid > const *)arg1)->find((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_find(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_GridsMap_find__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_GridsMap_find__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_find'.\n  Possible C/C++ prototypes are:\n    find(std::map<int,CdiGrid >::key_type const &)\n    find(std::map<int,CdiGrid >::key_type const &)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_GridsMap_lower_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::iterator arg2 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
-  int res2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_erase",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
-  if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'");
-  } else {
-    swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter2);
-    if (iter_t) {
-      arg2 = iter_t->get_current();
-    } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'");
-    }
-  }
-  (arg1)->erase(arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
+  arg2 = &temp2;
+  result = (arg1)->lower_bound((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_lower_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::iterator arg2 ;
-  std::map< int,CdiGrid >::iterator arg3 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  swig::SwigPyIterator *iter2 = 0 ;
-  int res2 ;
-  swig::SwigPyIterator *iter3 = 0 ;
-  int res3 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
+  int val2 ;
+  int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:GridsMap_erase",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_lower_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
-  }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
-  if (!SWIG_IsOK(res2) || !iter2) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'");
-  } else {
-    swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter2);
-    if (iter_t) {
-      arg2 = iter_t->get_current();
-    } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'");
-    }
-  }
-  res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
-  if (!SWIG_IsOK(res3) || !iter3) {
-    SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map< int,CdiGrid >::iterator""'");
-  } else {
-    swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter3);
-    if (iter_t) {
-      arg3 = iter_t->get_current();
-    } else {
-      SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map< int,CdiGrid >::iterator""'");
-    }
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_lower_bound" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  (arg1)->erase(arg2,arg3);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_lower_bound" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
+  } 
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
+  arg2 = &temp2;
+  result = ((std::map<int,CdiGrid > const *)arg1)->lower_bound((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_erase(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_lower_bound(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[4];
+  PyObject *argv[3];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0));
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
       if (_v) {
-        return _wrap_GridsMap_erase__SWIG_1(self, args);
+        return _wrap_GridsMap_lower_bound__SWIG_0(self, args);
       }
     }
   }
   if (argc == 2) {
     int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0));
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
     _v = SWIG_CheckState(res);
     if (_v) {
       {
@@ -22194,155 +21627,145 @@ SWIGINTERN PyObject *_wrap_GridsMap_erase(PyObject *self, PyObject *args) {
         _v = SWIG_CheckState(res);
       }
       if (_v) {
-        return _wrap_GridsMap_erase__SWIG_0(self, args);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v;
-    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0));
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      swig::SwigPyIterator *iter = 0;
-      int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-      _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0));
-      if (_v) {
-        swig::SwigPyIterator *iter = 0;
-        int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
-        _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0));
-        if (_v) {
-          return _wrap_GridsMap_erase__SWIG_2(self, args);
-        }
+        return _wrap_GridsMap_lower_bound__SWIG_1(self, args);
       }
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'GridsMap_erase'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::key_type const &)\n"
-    "    std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::iterator)\n"
-    "    std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::iterator,std::map< int,CdiGrid >::iterator)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_lower_bound'.\n  Possible C/C++ prototypes are:\n    lower_bound(std::map<int,CdiGrid >::key_type const &)\n    lower_bound(std::map<int,CdiGrid >::key_type const &)\n");
+  return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_upper_bound__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiGrid >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_find",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_upper_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_find" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_find" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->find((std::map< int,CdiGrid >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = (arg1)->upper_bound((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_GridsMap_upper_bound__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid >::key_type *arg2 = 0 ;
+  std::map<int,CdiGrid >::const_iterator result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
+  std::map<int,CdiGrid >::key_type temp2 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  std::map< int,CdiGrid >::iterator result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_lower_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_upper_bound",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_upper_bound" "', argument " "1"" of type '" "std::map<int,CdiGrid > const *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_upper_bound" "', argument " "2"" of type '" "std::map<int,CdiGrid >::key_type""'");
   } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
+  temp2 = static_cast< std::map<int,CdiGrid >::key_type >(val2);
   arg2 = &temp2;
-  result = (arg1)->lower_bound((std::map< int,CdiGrid >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
+  result = ((std::map<int,CdiGrid > const *)arg1)->upper_bound((std::map<int,CdiGrid >::key_type const &)*arg2);
+  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map<int,CdiGrid >::const_iterator & >(result)),
+    swig::PySwigIterator::descriptor(),SWIG_POINTER_OWN);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_GridsMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
-  std::map< int,CdiGrid >::key_type *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  std::map< int,CdiGrid >::key_type temp2 ;
-  int val2 ;
-  int ecode2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  std::map< int,CdiGrid >::iterator result;
+SWIGINTERN PyObject *_wrap_GridsMap_upper_bound(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:GridsMap_upper_bound",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
-  ecode2 = SWIG_AsVal_int(obj1, &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'");
-  } 
-  temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2);
-  arg2 = &temp2;
-  result = (arg1)->upper_bound((std::map< int,CdiGrid >::key_type const &)*arg2);
-  resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)),
-    swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
-  return resultobj;
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_GridsMap_upper_bound__SWIG_0(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = swig::asptr(argv[0], (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > >**)(0));
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_GridsMap_upper_bound__SWIG_1(self, args);
+      }
+    }
+  }
+  
 fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'GridsMap_upper_bound'.\n  Possible C/C++ prototypes are:\n    upper_bound(std::map<int,CdiGrid >::key_type const &)\n    upper_bound(std::map<int,CdiGrid >::key_type const &)\n");
   return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_delete_GridsMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ;
+  std::map<int,CdiGrid > *arg1 = (std::map<int,CdiGrid > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:delete_GridsMap",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_DISOWN |  0 );
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GridsMap" "', argument " "1"" of type '" "std::map<int,CdiGrid > *""'"); 
   }
-  arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1);
+  arg1 = reinterpret_cast< std::map<int,CdiGrid > * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22352,8 +21775,8 @@ fail:
 
 SWIGINTERN PyObject *GridsMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_NewClientData(obj));
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
@@ -22373,10 +21796,10 @@ fail:
 SWIGINTERN PyObject *_wrap_new_CdiGrid__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
+  CdiGrid *result = 0 ;
   int val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  CdiGrid *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_CdiGrid",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
@@ -22398,8 +21821,8 @@ SWIGINTERN PyObject *_wrap_new_CdiGrid(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -22417,11 +21840,8 @@ SWIGINTERN PyObject *_wrap_new_CdiGrid(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_CdiGrid'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    CdiGrid::CdiGrid()\n"
-    "    CdiGrid::CdiGrid(int)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_CdiGrid'.\n  Possible C/C++ prototypes are:\n    CdiGrid()\n    CdiGrid(int)\n");
+  return NULL;
 }
 
 
@@ -22439,6 +21859,7 @@ SWIGINTERN PyObject *_wrap_delete_CdiGrid(PyObject *SWIGUNUSEDPARM(self), PyObje
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22469,6 +21890,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_gridID_set(PyObject *SWIGUNUSEDPARM(self), Py
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->gridID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22479,10 +21901,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_gridID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_gridID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22521,6 +21943,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_type_set(PyObject *SWIGUNUSEDPARM(self), PyOb
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->type = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22531,10 +21954,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_type_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22573,6 +21996,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_size_set(PyObject *SWIGUNUSEDPARM(self), PyOb
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->size = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22583,10 +22007,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_size_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22625,6 +22049,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xsize_set(PyObject *SWIGUNUSEDPARM(self), PyO
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->xsize = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22635,10 +22060,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xsize_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_xsize_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22677,6 +22102,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ysize_set(PyObject *SWIGUNUSEDPARM(self), PyO
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->ysize = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22687,10 +22113,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_ysize_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_ysize_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22729,6 +22155,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_prec_set(PyObject *SWIGUNUSEDPARM(self), PyOb
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->prec = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22739,10 +22166,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_prec_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_prec_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22781,6 +22208,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ncorner_set(PyObject *SWIGUNUSEDPARM(self), P
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->ncorner = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22791,10 +22219,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_ncorner_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_ncorner_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22833,6 +22261,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_hasXValues_set(PyObject *SWIGUNUSEDPARM(self)
   } 
   arg2 = static_cast< bool >(val2);
   if (arg1) (arg1)->hasXValues = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22843,10 +22272,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_hasXValues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_hasXValues_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22885,6 +22314,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_hasYValues_set(PyObject *SWIGUNUSEDPARM(self)
   } 
   arg2 = static_cast< bool >(val2);
   if (arg1) (arg1)->hasYValues = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22895,10 +22325,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_hasYValues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_hasYValues_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22937,6 +22367,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_hasBounds_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< bool >(val2);
   if (arg1) (arg1)->hasBounds = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22947,10 +22378,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_hasBounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_hasBounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -22969,7 +22400,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -22983,12 +22414,13 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_set(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xvalues_set" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xvalues_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xvalues_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->xvalues = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -22999,10 +22431,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_xvalues_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23010,8 +22442,8 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_get(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xvalues_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xvalues);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->xvalues);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -23021,7 +22453,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -23035,12 +22467,13 @@ SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_set(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yvalues_set" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yvalues_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yvalues_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->yvalues = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -23051,10 +22484,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_yvalues_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23062,8 +22495,8 @@ SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_get(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yvalues_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->yvalues);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->yvalues);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -23073,7 +22506,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -23087,12 +22520,13 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_set(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xbounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xbounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xbounds_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->xbounds = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -23103,10 +22537,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_xbounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23114,8 +22548,8 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_get(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xbounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xbounds);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->xbounds);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -23125,7 +22559,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -23139,12 +22573,13 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_set(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ybounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ybounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ybounds_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->ybounds = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -23155,10 +22590,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_ybounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23166,8 +22601,8 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_get(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ybounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ybounds);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->ybounds);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -23202,6 +22637,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xname_set(PyObject *SWIGUNUSEDPARM(self), PyO
     arg2 = ptr;
   }
   if (arg1) (arg1)->xname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23214,10 +22650,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_xname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23225,7 +22661,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xname_get(PyObject *SWIGUNUSEDPARM(self), PyO
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xname_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->xname);
+  {
+    std::string const &_result_ref =  ((arg1)->xname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23261,6 +22700,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xlongname_set(PyObject *SWIGUNUSEDPARM(self),
     arg2 = ptr;
   }
   if (arg1) (arg1)->xlongname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23273,10 +22713,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xlongname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_xlongname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23284,7 +22724,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xlongname_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xlongname_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->xlongname);
+  {
+    std::string const &_result_ref =  ((arg1)->xlongname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23320,6 +22763,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xstdname_set(PyObject *SWIGUNUSEDPARM(self),
     arg2 = ptr;
   }
   if (arg1) (arg1)->xstdname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23332,10 +22776,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xstdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_xstdname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23343,7 +22787,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xstdname_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xstdname_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->xstdname);
+  {
+    std::string const &_result_ref =  ((arg1)->xstdname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23379,6 +22826,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xunits_set(PyObject *SWIGUNUSEDPARM(self), Py
     arg2 = ptr;
   }
   if (arg1) (arg1)->xunits = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23391,10 +22839,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_xunits_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_xunits_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23402,7 +22850,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_xunits_get(PyObject *SWIGUNUSEDPARM(self), Py
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xunits_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->xunits);
+  {
+    std::string const &_result_ref =  ((arg1)->xunits);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23438,6 +22889,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_yname_set(PyObject *SWIGUNUSEDPARM(self), PyO
     arg2 = ptr;
   }
   if (arg1) (arg1)->yname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23450,10 +22902,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_yname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_yname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23461,7 +22913,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_yname_get(PyObject *SWIGUNUSEDPARM(self), PyO
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yname_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->yname);
+  {
+    std::string const &_result_ref =  ((arg1)->yname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23497,6 +22952,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ylongname_set(PyObject *SWIGUNUSEDPARM(self),
     arg2 = ptr;
   }
   if (arg1) (arg1)->ylongname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23509,10 +22965,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_ylongname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_ylongname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23520,7 +22976,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ylongname_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ylongname_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->ylongname);
+  {
+    std::string const &_result_ref =  ((arg1)->ylongname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23556,6 +23015,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ystdname_set(PyObject *SWIGUNUSEDPARM(self),
     arg2 = ptr;
   }
   if (arg1) (arg1)->ystdname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23568,10 +23028,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_ystdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_ystdname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23579,7 +23039,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_ystdname_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ystdname_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->ystdname);
+  {
+    std::string const &_result_ref =  ((arg1)->ystdname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23615,6 +23078,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_yunits_set(PyObject *SWIGUNUSEDPARM(self), Py
     arg2 = ptr;
   }
   if (arg1) (arg1)->yunits = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23627,10 +23091,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_yunits_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_yunits_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23638,7 +23102,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_yunits_get(PyObject *SWIGUNUSEDPARM(self), Py
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yunits_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->yunits);
+  {
+    std::string const &_result_ref =  ((arg1)->yunits);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23674,6 +23141,7 @@ SWIGINTERN PyObject *_wrap_CdiGrid_name_set(PyObject *SWIGUNUSEDPARM(self), PyOb
     arg2 = ptr;
   }
   if (arg1) (arg1)->name = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -23686,10 +23154,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiGrid_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiGrid *arg1 = (CdiGrid *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiGrid_name_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiGrid, 0 |  0 );
@@ -23697,7 +23165,10 @@ SWIGINTERN PyObject *_wrap_CdiGrid_name_get(PyObject *SWIGUNUSEDPARM(self), PyOb
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_name_get" "', argument " "1"" of type '" "CdiGrid *""'"); 
   }
   arg1 = reinterpret_cast< CdiGrid * >(argp1);
-  result = (std::string *) & ((arg1)->name);
+  {
+    std::string const &_result_ref =  ((arg1)->name);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -23905,7 +23376,7 @@ fail:
 
 SWIGINTERN PyObject *CdiGrid_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_CdiGrid, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -23926,10 +23397,10 @@ fail:
 SWIGINTERN PyObject *_wrap_new_CdiTaxis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
+  CdiTaxis *result = 0 ;
   int val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  CdiTaxis *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_CdiTaxis",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
@@ -23951,8 +23422,8 @@ SWIGINTERN PyObject *_wrap_new_CdiTaxis(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -23970,11 +23441,8 @@ SWIGINTERN PyObject *_wrap_new_CdiTaxis(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_CdiTaxis'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    CdiTaxis::CdiTaxis()\n"
-    "    CdiTaxis::CdiTaxis(int)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_CdiTaxis'.\n  Possible C/C++ prototypes are:\n    CdiTaxis()\n    CdiTaxis(int)\n");
+  return NULL;
 }
 
 
@@ -23992,6 +23460,7 @@ SWIGINTERN PyObject *_wrap_delete_CdiTaxis(PyObject *SWIGUNUSEDPARM(self), PyObj
   }
   arg1 = reinterpret_cast< CdiTaxis * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24022,6 +23491,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_taxisID_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->taxisID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24032,10 +23502,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_taxisID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24074,6 +23544,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_ntsteps_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->ntsteps = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24084,10 +23555,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_ntsteps_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_ntsteps_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24126,6 +23597,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_unit_set(PyObject *SWIGUNUSEDPARM(self), PyO
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->unit = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24136,10 +23608,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_unit_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_unit_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24178,6 +23650,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_rdate_set(PyObject *SWIGUNUSEDPARM(self), Py
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->rdate = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24188,10 +23661,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_rdate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_rdate_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24230,6 +23703,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_rtime_set(PyObject *SWIGUNUSEDPARM(self), Py
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->rtime = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24240,10 +23714,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_rtime_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_rtime_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24282,6 +23756,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_vdate_set(PyObject *SWIGUNUSEDPARM(self), Py
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->vdate = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24292,10 +23767,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_vdate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_vdate_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24334,6 +23809,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_vtime_set(PyObject *SWIGUNUSEDPARM(self), Py
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->vtime = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24344,10 +23820,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_vtime_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_vtime_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24386,6 +23862,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_type_set(PyObject *SWIGUNUSEDPARM(self), PyO
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->type = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24396,10 +23873,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_type_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24438,6 +23915,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_calendar_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->calendar = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24448,10 +23926,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_calendar_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_calendar_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24490,6 +23968,7 @@ SWIGINTERN PyObject *_wrap_CdiTaxis_hasBounds_set(PyObject *SWIGUNUSEDPARM(self)
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->hasBounds = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24500,10 +23979,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_hasBounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_hasBounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24553,10 +24032,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  char *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  char *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_name_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24620,10 +24099,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiTaxis_unitname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiTaxis *arg1 = (CdiTaxis *) 0 ;
+  char *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  char *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiTaxis_unitname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiTaxis, 0 |  0 );
@@ -24641,7 +24120,7 @@ fail:
 
 SWIGINTERN PyObject *CdiTaxis_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_CdiTaxis, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -24662,10 +24141,10 @@ fail:
 SWIGINTERN PyObject *_wrap_new_CdiZaxis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
+  CdiZaxis *result = 0 ;
   int val1 ;
   int ecode1 = 0 ;
   PyObject * obj0 = 0 ;
-  CdiZaxis *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_CdiZaxis",&obj0)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
@@ -24687,8 +24166,8 @@ SWIGINTERN PyObject *_wrap_new_CdiZaxis(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 1) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -24706,11 +24185,8 @@ SWIGINTERN PyObject *_wrap_new_CdiZaxis(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_CdiZaxis'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    CdiZaxis::CdiZaxis()\n"
-    "    CdiZaxis::CdiZaxis(int)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_CdiZaxis'.\n  Possible C/C++ prototypes are:\n    CdiZaxis()\n    CdiZaxis(int)\n");
+  return NULL;
 }
 
 
@@ -24728,6 +24204,7 @@ SWIGINTERN PyObject *_wrap_delete_CdiZaxis(PyObject *SWIGUNUSEDPARM(self), PyObj
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24758,6 +24235,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_zaxisID_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->zaxisID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24768,10 +24246,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_zaxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_zaxisID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -24810,6 +24288,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_type_set(PyObject *SWIGUNUSEDPARM(self), PyO
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->type = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24820,10 +24299,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_type_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -24862,6 +24341,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_ltype_set(PyObject *SWIGUNUSEDPARM(self), Py
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->ltype = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24872,10 +24352,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_ltype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_ltype_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -24914,6 +24394,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_size_set(PyObject *SWIGUNUSEDPARM(self), PyO
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->size = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24924,10 +24405,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_size_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -24966,6 +24447,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_prec_set(PyObject *SWIGUNUSEDPARM(self), PyO
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->prec = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -24976,10 +24458,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_prec_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_prec_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25018,6 +24500,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_plevels_set(PyObject *SWIGUNUSEDPARM(self),
   }
   arg2 = reinterpret_cast< double * >(argp2);
   if (arg1) (arg1)->plevels = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25028,10 +24511,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_plevels_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  double *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  double *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_plevels_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25070,6 +24553,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_plbounds_set(PyObject *SWIGUNUSEDPARM(self),
   }
   arg2 = reinterpret_cast< double * >(argp2);
   if (arg1) (arg1)->plbounds = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25080,10 +24564,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_plbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  double *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  double *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_plbounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25122,6 +24606,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_pubounds_set(PyObject *SWIGUNUSEDPARM(self),
   }
   arg2 = reinterpret_cast< double * >(argp2);
   if (arg1) (arg1)->pubounds = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25132,10 +24617,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_pubounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  double *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  double *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_pubounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25174,6 +24659,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_pweights_set(PyObject *SWIGUNUSEDPARM(self),
   }
   arg2 = reinterpret_cast< double * >(argp2);
   if (arg1) (arg1)->pweights = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25184,10 +24670,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_pweights_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  double *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  double *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_pweights_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25206,7 +24692,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_levels_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -25220,12 +24706,13 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_levels_set(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_levels_set" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_levels_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_levels_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->levels = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25236,10 +24723,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_levels_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_levels_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25247,8 +24734,8 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_levels_get(PyObject *SWIGUNUSEDPARM(self), P
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_levels_get" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->levels);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->levels);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -25258,7 +24745,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -25272,12 +24759,13 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_set(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_lbounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_lbounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_lbounds_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->lbounds = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25288,10 +24776,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_lbounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25299,8 +24787,8 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_lbounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->lbounds);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->lbounds);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -25310,7 +24798,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -25324,12 +24812,13 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_set(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ubounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_ubounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_ubounds_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->ubounds = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25340,10 +24829,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_ubounds_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25351,8 +24840,8 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ubounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ubounds);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->ubounds);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -25362,7 +24851,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_weights_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -25376,12 +24865,13 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_weights_set(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_weights_set" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_weights_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_weights_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->weights = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25392,10 +24882,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_weights_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_weights_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25403,8 +24893,8 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_weights_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_weights_get" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->weights);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->weights);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -25439,6 +24929,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_name_set(PyObject *SWIGUNUSEDPARM(self), PyO
     arg2 = ptr;
   }
   if (arg1) (arg1)->name = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -25451,10 +24942,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_name_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25462,7 +24953,10 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_name_get(PyObject *SWIGUNUSEDPARM(self), PyO
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_name_get" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  result = (std::string *) & ((arg1)->name);
+  {
+    std::string const &_result_ref =  ((arg1)->name);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -25498,6 +24992,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_longname_set(PyObject *SWIGUNUSEDPARM(self),
     arg2 = ptr;
   }
   if (arg1) (arg1)->longname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -25510,10 +25005,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_longname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_longname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25521,7 +25016,10 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_longname_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_longname_get" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  result = (std::string *) & ((arg1)->longname);
+  {
+    std::string const &_result_ref =  ((arg1)->longname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -25557,6 +25055,7 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_units_set(PyObject *SWIGUNUSEDPARM(self), Py
     arg2 = ptr;
   }
   if (arg1) (arg1)->units = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -25569,10 +25068,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiZaxis_units_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiZaxis *arg1 = (CdiZaxis *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiZaxis_units_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiZaxis, 0 |  0 );
@@ -25580,7 +25079,10 @@ SWIGINTERN PyObject *_wrap_CdiZaxis_units_get(PyObject *SWIGUNUSEDPARM(self), Py
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_units_get" "', argument " "1"" of type '" "CdiZaxis *""'"); 
   }
   arg1 = reinterpret_cast< CdiZaxis * >(argp1);
-  result = (std::string *) & ((arg1)->units);
+  {
+    std::string const &_result_ref =  ((arg1)->units);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -25590,7 +25092,7 @@ fail:
 
 SWIGINTERN PyObject *CdiZaxis_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_CdiZaxis, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -25613,6 +25115,7 @@ SWIGINTERN PyObject *_wrap_new_CdiVariable__SWIG_1(PyObject *SWIGUNUSEDPARM(self
   int arg1 ;
   int arg2 ;
   int arg3 ;
+  CdiVariable *result = 0 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
@@ -25622,7 +25125,6 @@ SWIGINTERN PyObject *_wrap_new_CdiVariable__SWIG_1(PyObject *SWIGUNUSEDPARM(self
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
-  CdiVariable *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:new_CdiVariable",&obj0,&obj1,&obj2)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
@@ -25654,8 +25156,8 @@ SWIGINTERN PyObject *_wrap_new_CdiVariable(PyObject *self, PyObject *args) {
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 3) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -25685,11 +25187,8 @@ SWIGINTERN PyObject *_wrap_new_CdiVariable(PyObject *self, PyObject *args) {
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_CdiVariable'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    CdiVariable::CdiVariable()\n"
-    "    CdiVariable::CdiVariable(int,int,int)\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_CdiVariable'.\n  Possible C/C++ prototypes are:\n    CdiVariable()\n    CdiVariable(int,int,int)\n");
+  return NULL;
 }
 
 
@@ -25707,6 +25206,7 @@ SWIGINTERN PyObject *_wrap_delete_CdiVariable(PyObject *SWIGUNUSEDPARM(self), Py
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25737,6 +25237,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_varID_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->varID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25747,10 +25248,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_varID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_varID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -25789,6 +25290,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_zaxisID_set(PyObject *SWIGUNUSEDPARM(self
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->zaxisID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25799,10 +25301,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_zaxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_zaxisID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -25841,6 +25343,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_gridID_set(PyObject *SWIGUNUSEDPARM(self)
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->gridID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25851,10 +25354,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_gridID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_gridID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -25893,6 +25396,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_taxisID_set(PyObject *SWIGUNUSEDPARM(self
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->taxisID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25903,10 +25407,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_taxisID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -25945,6 +25449,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_timeID_set(PyObject *SWIGUNUSEDPARM(self)
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->timeID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -25955,10 +25460,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_timeID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_timeID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -25997,6 +25502,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_vlistID_set(PyObject *SWIGUNUSEDPARM(self
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->vlistID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26007,10 +25513,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_vlistID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_vlistID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26049,6 +25555,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_size_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->size = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26059,10 +25566,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_size_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26101,6 +25608,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_code_set(PyObject *SWIGUNUSEDPARM(self),
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->code = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26111,10 +25619,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_code_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_code_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26153,6 +25661,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_datatype_set(PyObject *SWIGUNUSEDPARM(sel
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->datatype = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26163,10 +25672,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_datatype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_datatype_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26205,6 +25714,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_streamID_set(PyObject *SWIGUNUSEDPARM(sel
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->streamID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26215,10 +25725,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_streamID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_streamID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26262,6 +25772,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_name_set(PyObject *SWIGUNUSEDPARM(self),
     arg2 = ptr;
   }
   if (arg1) (arg1)->name = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -26274,10 +25785,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_name_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26285,7 +25796,10 @@ SWIGINTERN PyObject *_wrap_CdiVariable_name_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_name_get" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  result = (std::string *) & ((arg1)->name);
+  {
+    std::string const &_result_ref =  ((arg1)->name);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -26321,6 +25835,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_longname_set(PyObject *SWIGUNUSEDPARM(sel
     arg2 = ptr;
   }
   if (arg1) (arg1)->longname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -26333,10 +25848,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_longname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_longname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26344,7 +25859,10 @@ SWIGINTERN PyObject *_wrap_CdiVariable_longname_get(PyObject *SWIGUNUSEDPARM(sel
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_longname_get" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  result = (std::string *) & ((arg1)->longname);
+  {
+    std::string const &_result_ref =  ((arg1)->longname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -26380,6 +25898,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_units_set(PyObject *SWIGUNUSEDPARM(self),
     arg2 = ptr;
   }
   if (arg1) (arg1)->units = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -26392,10 +25911,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_units_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_units_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26403,7 +25922,10 @@ SWIGINTERN PyObject *_wrap_CdiVariable_units_get(PyObject *SWIGUNUSEDPARM(self),
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_units_get" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  result = (std::string *) & ((arg1)->units);
+  {
+    std::string const &_result_ref =  ((arg1)->units);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -26439,6 +25961,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_stdname_set(PyObject *SWIGUNUSEDPARM(self
     arg2 = ptr;
   }
   if (arg1) (arg1)->stdname = *arg2;
+  
   resultobj = SWIG_Py_Void();
   if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
@@ -26451,10 +25974,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_stdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  std::string *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::string *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_stdname_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26462,7 +25985,10 @@ SWIGINTERN PyObject *_wrap_CdiVariable_stdname_get(PyObject *SWIGUNUSEDPARM(self
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_stdname_get" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  result = (std::string *) & ((arg1)->stdname);
+  {
+    std::string const &_result_ref =  ((arg1)->stdname);
+    result = (std::string *) &_result_ref;
+  }
   resultobj = SWIG_From_std_string(static_cast< std::string >(*result));
   return resultobj;
 fail:
@@ -26493,6 +26019,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_missval_set(PyObject *SWIGUNUSEDPARM(self
   } 
   arg2 = static_cast< double >(val2);
   if (arg1) (arg1)->missval = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26503,10 +26030,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_missval_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  double result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  double result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_missval_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26525,7 +26052,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_values_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
-  std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ;
+  std::vector<double,std::allocator<double > > *arg2 = (std::vector<double,std::allocator<double > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -26539,12 +26066,13 @@ SWIGINTERN PyObject *_wrap_CdiVariable_values_set(PyObject *SWIGUNUSEDPARM(self)
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_values_set" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_values_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_values_set" "', argument " "2"" of type '" "std::vector<double,std::allocator<double > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<double,std::allocator<double > > * >(argp2);
   if (arg1) (arg1)->values = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26555,10 +26083,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_values_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  std::vector<double,std::allocator<double > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< double,std::allocator< double > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_values_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26566,8 +26094,8 @@ SWIGINTERN PyObject *_wrap_CdiVariable_values_get(PyObject *SWIGUNUSEDPARM(self)
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_values_get" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  result = (std::vector< double,std::allocator< double > > *)& ((arg1)->values);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 |  0 );
+  result = (std::vector<double,std::allocator<double > > *)& ((arg1)->values);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTdouble_std__allocatorTdouble_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -26577,7 +26105,7 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
-  std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg2 = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *) 0 ;
+  std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *arg2 = (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -26591,12 +26119,13 @@ SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_set(PyObject *SWIGUNUSEDP
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_valuesWithLevel_set" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_valuesWithLevel_set" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_valuesWithLevel_set" "', argument " "2"" of type '" "std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > * >(argp2);
   if (arg1) (arg1)->valuesWithLevel = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26607,10 +26136,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_valuesWithLevel_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26618,8 +26147,8 @@ SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_get(PyObject *SWIGUNUSEDP
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_valuesWithLevel_get" "', argument " "1"" of type '" "CdiVariable *""'"); 
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
-  result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)& ((arg1)->valuesWithLevel);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 |  0 );
+  result = (std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *)& ((arg1)->valuesWithLevel);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -26649,6 +26178,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_grid_set(PyObject *SWIGUNUSEDPARM(self),
   }
   arg2 = reinterpret_cast< CdiGrid * >(argp2);
   if (arg1) (arg1)->grid = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26659,10 +26189,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_grid_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  CdiGrid *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  CdiGrid *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_grid_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26701,6 +26231,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_zaxis_set(PyObject *SWIGUNUSEDPARM(self),
   }
   arg2 = reinterpret_cast< CdiZaxis * >(argp2);
   if (arg1) (arg1)->zaxis = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26711,10 +26242,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_zaxis_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  CdiZaxis *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  CdiZaxis *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_zaxis_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26753,6 +26284,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_taxis_set(PyObject *SWIGUNUSEDPARM(self),
   }
   arg2 = reinterpret_cast< CdiTaxis * >(argp2);
   if (arg1) (arg1)->taxis = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -26763,10 +26295,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_taxis_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  CdiTaxis *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  CdiTaxis *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_taxis_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26881,8 +26413,8 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel(PyObject *self, PyObje
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 1) {
@@ -26911,21 +26443,18 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel(PyObject *self, PyObje
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'CdiVariable_getValuesWithLevel'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    CdiVariable::getValuesWithLevel(int)\n"
-    "    CdiVariable::getValuesWithLevel()\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CdiVariable_getValuesWithLevel'.\n  Possible C/C++ prototypes are:\n    getValuesWithLevel(int)\n    getValuesWithLevel()\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_CdiVariable_getFValues(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  SwigValueWrapper<std::vector<float,std::allocator<float > > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::vector< float,std::allocator< float > > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_getFValues",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26934,7 +26463,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getFValues(PyObject *SWIGUNUSEDPARM(self)
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
   result = (arg1)->getFValues();
-  resultobj = SWIG_NewPointerObj((new std::vector< float,std::allocator< float > >(static_cast< const std::vector< float,std::allocator< float > >& >(result))), SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj((new std::vector<float,std::allocator<float > >(static_cast< const std::vector<float,std::allocator<float > >& >(result))), SWIGTYPE_p_std__vectorTfloat_std__allocatorTfloat_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -26945,13 +26474,13 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_0(PyObject *SWI
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
   int arg2 ;
+  SwigValueWrapper<std::vector<std::vector<float,std::allocator<float > >,std::allocator<std::vector<float,std::allocator<float > > > > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:CdiVariable_getFValuesWithLevel",&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26965,7 +26494,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_0(PyObject *SWI
   } 
   arg2 = static_cast< int >(val2);
   result = (arg1)->getFValuesWithLevel(arg2);
-  resultobj = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj((new std::vector<std::vector<float,std::allocator<float > >,std::allocator<std::vector<float,std::allocator<float > > > >(static_cast< const std::vector<std::vector<float,std::allocator<float > >,std::allocator<std::vector<float,std::allocator<float > > > >& >(result))), SWIGTYPE_p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -26975,10 +26504,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  SwigValueWrapper<std::vector<std::vector<float,std::allocator<float > >,std::allocator<std::vector<float,std::allocator<float > > > > > result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_getFValuesWithLevel",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -26987,7 +26516,7 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_1(PyObject *SWI
   }
   arg1 = reinterpret_cast< CdiVariable * >(argp1);
   result = (arg1)->getFValuesWithLevel();
-  resultobj = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN |  0 );
+  resultobj = SWIG_NewPointerObj((new std::vector<std::vector<float,std::allocator<float > >,std::allocator<std::vector<float,std::allocator<float > > > >(static_cast< const std::vector<std::vector<float,std::allocator<float > >,std::allocator<std::vector<float,std::allocator<float > > > >& >(result))), SWIGTYPE_p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27000,8 +26529,8 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel(PyObject *self, PyObj
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 1) {
@@ -27030,21 +26559,18 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel(PyObject *self, PyObj
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'CdiVariable_getFValuesWithLevel'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    CdiVariable::getFValuesWithLevel(int)\n"
-    "    CdiVariable::getFValuesWithLevel()\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CdiVariable_getFValuesWithLevel'.\n  Possible C/C++ prototypes are:\n    getFValuesWithLevel(int)\n    getFValuesWithLevel()\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *_wrap_CdiVariable_getValuesAsPointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  double *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  double *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_getValuesAsPointer",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -27064,13 +26590,13 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_0(PyObj
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
   int arg2 ;
+  double **result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int val2 ;
   int ecode2 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
-  double **result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"OO:CdiVariable_getValuesWithLevelAsPointer",&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -27094,10 +26620,10 @@ fail:
 SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CdiVariable *arg1 = (CdiVariable *) 0 ;
+  double **result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  double **result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:CdiVariable_getValuesWithLevelAsPointer",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CdiVariable, 0 |  0 );
@@ -27119,8 +26645,8 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer(PyObject *sel
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
-  argc = args ? (int)PyObject_Length(args) : 0;
-  for (ii = 0; (ii < 2) && (ii < argc); ii++) {
+  argc = PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 1) {
@@ -27149,17 +26675,14 @@ SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer(PyObject *sel
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'CdiVariable_getValuesWithLevelAsPointer'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    CdiVariable::getValuesWithLevelAsPointer(int)\n"
-    "    CdiVariable::getValuesWithLevelAsPointer()\n");
-  return 0;
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CdiVariable_getValuesWithLevelAsPointer'.\n  Possible C/C++ prototypes are:\n    getValuesWithLevelAsPointer(int)\n    getValuesWithLevelAsPointer()\n");
+  return NULL;
 }
 
 
 SWIGINTERN PyObject *CdiVariable_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_CdiVariable, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -27167,11 +26690,11 @@ SWIGINTERN PyObject *CdiVariable_swigregister(PyObject *SWIGUNUSEDPARM(self), Py
 SWIGINTERN PyObject *_wrap_new_Cdi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   char *arg1 = (char *) 0 ;
+  Cdi *result = 0 ;
   int res1 ;
   char *buf1 = 0 ;
   int alloc1 = 0 ;
   PyObject * obj0 = 0 ;
-  Cdi *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:new_Cdi",&obj0)) SWIG_fail;
   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
@@ -27203,6 +26726,7 @@ SWIGINTERN PyObject *_wrap_delete_Cdi(PyObject *SWIGUNUSEDPARM(self), PyObject *
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
   delete arg1;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27233,6 +26757,7 @@ SWIGINTERN PyObject *_wrap_Cdi_streamID_set(PyObject *SWIGUNUSEDPARM(self), PyOb
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->streamID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27243,10 +26768,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_streamID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_streamID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27285,6 +26810,7 @@ SWIGINTERN PyObject *_wrap_Cdi_vlistID_set(PyObject *SWIGUNUSEDPARM(self), PyObj
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->vlistID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27295,10 +26821,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_vlistID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_vlistID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27337,6 +26863,7 @@ SWIGINTERN PyObject *_wrap_Cdi_nvars_set(PyObject *SWIGUNUSEDPARM(self), PyObjec
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->nvars = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27347,10 +26874,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_nvars_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_nvars_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27389,6 +26916,7 @@ SWIGINTERN PyObject *_wrap_Cdi_nzaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObje
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->nzaxes = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27399,10 +26927,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_nzaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_nzaxes_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27441,6 +26969,7 @@ SWIGINTERN PyObject *_wrap_Cdi_ngrids_set(PyObject *SWIGUNUSEDPARM(self), PyObje
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->ngrids = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27451,10 +26980,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_ngrids_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_ngrids_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27493,6 +27022,7 @@ SWIGINTERN PyObject *_wrap_Cdi_ntaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObje
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->ntaxes = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27503,10 +27033,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_ntaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_ntaxes_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27545,6 +27075,7 @@ SWIGINTERN PyObject *_wrap_Cdi_taxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObj
   } 
   arg2 = static_cast< int >(val2);
   if (arg1) (arg1)->taxisID = arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27555,10 +27086,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  int result;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_taxisID_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27577,7 +27108,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_varnames_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::vector< std::string,std::allocator< std::string > > *arg2 = (std::vector< std::string,std::allocator< std::string > > *) 0 ;
+  std::vector<std::string,std::allocator<std::string > > *arg2 = (std::vector<std::string,std::allocator<std::string > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27591,12 +27122,13 @@ SWIGINTERN PyObject *_wrap_Cdi_varnames_set(PyObject *SWIGUNUSEDPARM(self), PyOb
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varnames_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varnames_set" "', argument " "2"" of type '" "std::vector< std::string,std::allocator< std::string > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varnames_set" "', argument " "2"" of type '" "std::vector<std::string,std::allocator<std::string > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< std::string,std::allocator< std::string > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<std::string,std::allocator<std::string > > * >(argp2);
   if (arg1) (arg1)->varnames = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27607,10 +27139,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_varnames_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::vector<std::string,std::allocator<std::string > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< std::string,std::allocator< std::string > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_varnames_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27618,8 +27150,8 @@ SWIGINTERN PyObject *_wrap_Cdi_varnames_get(PyObject *SWIGUNUSEDPARM(self), PyOb
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varnames_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::vector< std::string,std::allocator< std::string > > *)& ((arg1)->varnames);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 |  0 );
+  result = (std::vector<std::string,std::allocator<std::string > > *)& ((arg1)->varnames);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27629,7 +27161,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_codes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::vector< int,std::allocator< int > > *arg2 = (std::vector< int,std::allocator< int > > *) 0 ;
+  std::vector<int,std::allocator<int > > *arg2 = (std::vector<int,std::allocator<int > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27643,12 +27175,13 @@ SWIGINTERN PyObject *_wrap_Cdi_codes_set(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_codes_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_codes_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_codes_set" "', argument " "2"" of type '" "std::vector<int,std::allocator<int > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< int,std::allocator< int > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<int,std::allocator<int > > * >(argp2);
   if (arg1) (arg1)->codes = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27659,10 +27192,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_codes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::vector<int,std::allocator<int > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< int,std::allocator< int > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_codes_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27670,8 +27203,8 @@ SWIGINTERN PyObject *_wrap_Cdi_codes_get(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_codes_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::vector< int,std::allocator< int > > *)& ((arg1)->codes);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 |  0 );
+  result = (std::vector<int,std::allocator<int > > *)& ((arg1)->codes);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTint_std__allocatorTint_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27681,7 +27214,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_variables_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::vector< CdiVariable,std::allocator< CdiVariable > > *arg2 = (std::vector< CdiVariable,std::allocator< CdiVariable > > *) 0 ;
+  std::vector<CdiVariable,std::allocator<CdiVariable > > *arg2 = (std::vector<CdiVariable,std::allocator<CdiVariable > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27695,12 +27228,13 @@ SWIGINTERN PyObject *_wrap_Cdi_variables_set(PyObject *SWIGUNUSEDPARM(self), PyO
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_variables_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_variables_set" "', argument " "2"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_variables_set" "', argument " "2"" of type '" "std::vector<CdiVariable,std::allocator<CdiVariable > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::vector< CdiVariable,std::allocator< CdiVariable > > * >(argp2);
+  arg2 = reinterpret_cast< std::vector<CdiVariable,std::allocator<CdiVariable > > * >(argp2);
   if (arg1) (arg1)->variables = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27711,10 +27245,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_variables_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::vector<CdiVariable,std::allocator<CdiVariable > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_variables_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27722,8 +27256,8 @@ SWIGINTERN PyObject *_wrap_Cdi_variables_get(PyObject *SWIGUNUSEDPARM(self), PyO
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_variables_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)& ((arg1)->variables);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 |  0 );
+  result = (std::vector<CdiVariable,std::allocator<CdiVariable > > *)& ((arg1)->variables);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27733,7 +27267,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_var_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *arg2 = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *) 0 ;
+  std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *arg2 = (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27747,12 +27281,13 @@ SWIGINTERN PyObject *_wrap_Cdi_var_set(PyObject *SWIGUNUSEDPARM(self), PyObject
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_var_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_var_set" "', argument " "2"" of type '" "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_var_set" "', argument " "2"" of type '" "std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > * >(argp2);
+  arg2 = reinterpret_cast< std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > * >(argp2);
   if (arg1) (arg1)->var = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27763,10 +27298,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_var_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_var_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27774,8 +27309,8 @@ SWIGINTERN PyObject *_wrap_Cdi_var_get(PyObject *SWIGUNUSEDPARM(self), PyObject
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_var_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)& ((arg1)->var);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 |  0 );
+  result = (std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *)& ((arg1)->var);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27785,7 +27320,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_varByCode_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *arg2 = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *) 0 ;
+  std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *arg2 = (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27799,12 +27334,13 @@ SWIGINTERN PyObject *_wrap_Cdi_varByCode_set(PyObject *SWIGUNUSEDPARM(self), PyO
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varByCode_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varByCode_set" "', argument " "2"" of type '" "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varByCode_set" "', argument " "2"" of type '" "std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > * >(argp2);
+  arg2 = reinterpret_cast< std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > * >(argp2);
   if (arg1) (arg1)->varByCode = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27815,10 +27351,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_varByCode_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_varByCode_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27826,8 +27362,8 @@ SWIGINTERN PyObject *_wrap_Cdi_varByCode_get(PyObject *SWIGUNUSEDPARM(self), PyO
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varByCode_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)& ((arg1)->varByCode);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 |  0 );
+  result = (std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *)& ((arg1)->varByCode);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27837,7 +27373,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_taxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *arg2 = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *) 0 ;
+  std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *arg2 = (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27851,12 +27387,13 @@ SWIGINTERN PyObject *_wrap_Cdi_taxes_set(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxes_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_taxes_set" "', argument " "2"" of type '" "std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_taxes_set" "', argument " "2"" of type '" "std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > * >(argp2);
+  arg2 = reinterpret_cast< std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > * >(argp2);
   if (arg1) (arg1)->taxes = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27867,10 +27404,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_taxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_taxes_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27878,8 +27415,8 @@ SWIGINTERN PyObject *_wrap_Cdi_taxes_get(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxes_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)& ((arg1)->taxes);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 |  0 );
+  result = (std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *)& ((arg1)->taxes);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27889,7 +27426,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_zaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *arg2 = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *) 0 ;
+  std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *arg2 = (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27903,12 +27440,13 @@ SWIGINTERN PyObject *_wrap_Cdi_zaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_zaxes_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_zaxes_set" "', argument " "2"" of type '" "std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_zaxes_set" "', argument " "2"" of type '" "std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > * >(argp2);
+  arg2 = reinterpret_cast< std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > * >(argp2);
   if (arg1) (arg1)->zaxes = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27919,10 +27457,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_zaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_zaxes_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27930,8 +27468,8 @@ SWIGINTERN PyObject *_wrap_Cdi_zaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_zaxes_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)& ((arg1)->zaxes);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 |  0 );
+  result = (std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *)& ((arg1)->zaxes);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -27941,7 +27479,7 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_grids_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
-  std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *arg2 = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *) 0 ;
+  std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *arg2 = (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   void *argp2 = 0 ;
@@ -27955,12 +27493,13 @@ SWIGINTERN PyObject *_wrap_Cdi_grids_set(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_grids_set" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_grids_set" "', argument " "2"" of type '" "std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_grids_set" "', argument " "2"" of type '" "std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *""'"); 
   }
-  arg2 = reinterpret_cast< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > * >(argp2);
+  arg2 = reinterpret_cast< std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > * >(argp2);
   if (arg1) (arg1)->grids = *arg2;
+  
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -27971,10 +27510,10 @@ fail:
 SWIGINTERN PyObject *_wrap_Cdi_grids_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Cdi *arg1 = (Cdi *) 0 ;
+  std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ;
   
   if (!PyArg_ParseTuple(args,(char *)"O:Cdi_grids_get",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Cdi, 0 |  0 );
@@ -27982,8 +27521,8 @@ SWIGINTERN PyObject *_wrap_Cdi_grids_get(PyObject *SWIGUNUSEDPARM(self), PyObjec
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_grids_get" "', argument " "1"" of type '" "Cdi *""'"); 
   }
   arg1 = reinterpret_cast< Cdi * >(argp1);
-  result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)& ((arg1)->grids);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 |  0 );
+  result = (std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *)& ((arg1)->grids);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0 |  0 );
   return resultobj;
 fail:
   return NULL;
@@ -28013,34 +27552,31 @@ fail:
 
 SWIGINTERN PyObject *Cdi_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_Cdi, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
 static PyMethodDef SwigMethods[] = {
-	 { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
-	 { (char *)"delete_SwigPyIterator", _wrap_delete_SwigPyIterator, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_value", _wrap_SwigPyIterator_value, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_incr", _wrap_SwigPyIterator_incr, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_decr", _wrap_SwigPyIterator_decr, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_distance", _wrap_SwigPyIterator_distance, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_equal", _wrap_SwigPyIterator_equal, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_copy", _wrap_SwigPyIterator_copy, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_next", _wrap_SwigPyIterator_next, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator___next__", _wrap_SwigPyIterator___next__, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_previous", _wrap_SwigPyIterator_previous, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_advance", _wrap_SwigPyIterator_advance, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator___eq__", _wrap_SwigPyIterator___eq__, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator___ne__", _wrap_SwigPyIterator___ne__, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator___iadd__", _wrap_SwigPyIterator___iadd__, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator___isub__", _wrap_SwigPyIterator___isub__, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator___add__", _wrap_SwigPyIterator___add__, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator___sub__", _wrap_SwigPyIterator___sub__, METH_VARARGS, NULL},
-	 { (char *)"SwigPyIterator_swigregister", SwigPyIterator_swigregister, METH_VARARGS, NULL},
+	 { (char *)"delete_PySwigIterator", _wrap_delete_PySwigIterator, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_value", _wrap_PySwigIterator_value, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_incr", _wrap_PySwigIterator_incr, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_decr", _wrap_PySwigIterator_decr, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_distance", _wrap_PySwigIterator_distance, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_equal", _wrap_PySwigIterator_equal, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_copy", _wrap_PySwigIterator_copy, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_next", _wrap_PySwigIterator_next, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_previous", _wrap_PySwigIterator_previous, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_advance", _wrap_PySwigIterator_advance, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator___eq__", _wrap_PySwigIterator___eq__, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator___ne__", _wrap_PySwigIterator___ne__, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator___iadd__", _wrap_PySwigIterator___iadd__, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator___isub__", _wrap_PySwigIterator___isub__, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator___add__", _wrap_PySwigIterator___add__, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator___sub__", _wrap_PySwigIterator___sub__, METH_VARARGS, NULL},
+	 { (char *)"PySwigIterator_swigregister", PySwigIterator_swigregister, METH_VARARGS, NULL},
 	 { (char *)"IntVector_iterator", _wrap_IntVector_iterator, METH_VARARGS, NULL},
 	 { (char *)"IntVector___nonzero__", _wrap_IntVector___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"IntVector___bool__", _wrap_IntVector___bool__, METH_VARARGS, NULL},
 	 { (char *)"IntVector___len__", _wrap_IntVector___len__, METH_VARARGS, NULL},
 	 { (char *)"IntVector_pop", _wrap_IntVector_pop, METH_VARARGS, NULL},
 	 { (char *)"IntVector___getslice__", _wrap_IntVector___getslice__, METH_VARARGS, NULL},
@@ -28074,7 +27610,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"IntVector_swigregister", IntVector_swigregister, METH_VARARGS, NULL},
 	 { (char *)"DoubleVector_iterator", _wrap_DoubleVector_iterator, METH_VARARGS, NULL},
 	 { (char *)"DoubleVector___nonzero__", _wrap_DoubleVector___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"DoubleVector___bool__", _wrap_DoubleVector___bool__, METH_VARARGS, NULL},
 	 { (char *)"DoubleVector___len__", _wrap_DoubleVector___len__, METH_VARARGS, NULL},
 	 { (char *)"DoubleVector_pop", _wrap_DoubleVector_pop, METH_VARARGS, NULL},
 	 { (char *)"DoubleVector___getslice__", _wrap_DoubleVector___getslice__, METH_VARARGS, NULL},
@@ -28108,7 +27643,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"DoubleVector_swigregister", DoubleVector_swigregister, METH_VARARGS, NULL},
 	 { (char *)"DoubleDoubleVector_iterator", _wrap_DoubleDoubleVector_iterator, METH_VARARGS, NULL},
 	 { (char *)"DoubleDoubleVector___nonzero__", _wrap_DoubleDoubleVector___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"DoubleDoubleVector___bool__", _wrap_DoubleDoubleVector___bool__, METH_VARARGS, NULL},
 	 { (char *)"DoubleDoubleVector___len__", _wrap_DoubleDoubleVector___len__, METH_VARARGS, NULL},
 	 { (char *)"DoubleDoubleVector_pop", _wrap_DoubleDoubleVector_pop, METH_VARARGS, NULL},
 	 { (char *)"DoubleDoubleVector___getslice__", _wrap_DoubleDoubleVector___getslice__, METH_VARARGS, NULL},
@@ -28142,7 +27676,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"DoubleDoubleVector_swigregister", DoubleDoubleVector_swigregister, METH_VARARGS, NULL},
 	 { (char *)"StringVector_iterator", _wrap_StringVector_iterator, METH_VARARGS, NULL},
 	 { (char *)"StringVector___nonzero__", _wrap_StringVector___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"StringVector___bool__", _wrap_StringVector___bool__, METH_VARARGS, NULL},
 	 { (char *)"StringVector___len__", _wrap_StringVector___len__, METH_VARARGS, NULL},
 	 { (char *)"StringVector_pop", _wrap_StringVector_pop, METH_VARARGS, NULL},
 	 { (char *)"StringVector___getslice__", _wrap_StringVector___getslice__, METH_VARARGS, NULL},
@@ -28176,7 +27709,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"StringVector_swigregister", StringVector_swigregister, METH_VARARGS, NULL},
 	 { (char *)"VarsVector_iterator", _wrap_VarsVector_iterator, METH_VARARGS, NULL},
 	 { (char *)"VarsVector___nonzero__", _wrap_VarsVector___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"VarsVector___bool__", _wrap_VarsVector___bool__, METH_VARARGS, NULL},
 	 { (char *)"VarsVector___len__", _wrap_VarsVector___len__, METH_VARARGS, NULL},
 	 { (char *)"VarsVector_pop", _wrap_VarsVector_pop, METH_VARARGS, NULL},
 	 { (char *)"VarsVector___getslice__", _wrap_VarsVector___getslice__, METH_VARARGS, NULL},
@@ -28210,7 +27742,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"VarsVector_swigregister", VarsVector_swigregister, METH_VARARGS, NULL},
 	 { (char *)"VarsMap_iterator", _wrap_VarsMap_iterator, METH_VARARGS, NULL},
 	 { (char *)"VarsMap___nonzero__", _wrap_VarsMap___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"VarsMap___bool__", _wrap_VarsMap___bool__, METH_VARARGS, NULL},
 	 { (char *)"VarsMap___len__", _wrap_VarsMap___len__, METH_VARARGS, NULL},
 	 { (char *)"VarsMap___getitem__", _wrap_VarsMap___getitem__, METH_VARARGS, NULL},
 	 { (char *)"VarsMap___delitem__", _wrap_VarsMap___delitem__, METH_VARARGS, NULL},
@@ -28222,7 +27753,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"VarsMap_key_iterator", _wrap_VarsMap_key_iterator, METH_VARARGS, NULL},
 	 { (char *)"VarsMap_value_iterator", _wrap_VarsMap_value_iterator, METH_VARARGS, NULL},
 	 { (char *)"VarsMap___setitem__", _wrap_VarsMap___setitem__, METH_VARARGS, NULL},
-	 { (char *)"VarsMap_asdict", _wrap_VarsMap_asdict, METH_VARARGS, NULL},
 	 { (char *)"new_VarsMap", _wrap_new_VarsMap, METH_VARARGS, NULL},
 	 { (char *)"VarsMap_empty", _wrap_VarsMap_empty, METH_VARARGS, NULL},
 	 { (char *)"VarsMap_size", _wrap_VarsMap_size, METH_VARARGS, NULL},
@@ -28242,7 +27772,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"VarsMap_swigregister", VarsMap_swigregister, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode_iterator", _wrap_VarsByCode_iterator, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode___nonzero__", _wrap_VarsByCode___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"VarsByCode___bool__", _wrap_VarsByCode___bool__, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode___len__", _wrap_VarsByCode___len__, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode___getitem__", _wrap_VarsByCode___getitem__, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode___delitem__", _wrap_VarsByCode___delitem__, METH_VARARGS, NULL},
@@ -28254,7 +27783,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"VarsByCode_key_iterator", _wrap_VarsByCode_key_iterator, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode_value_iterator", _wrap_VarsByCode_value_iterator, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode___setitem__", _wrap_VarsByCode___setitem__, METH_VARARGS, NULL},
-	 { (char *)"VarsByCode_asdict", _wrap_VarsByCode_asdict, METH_VARARGS, NULL},
 	 { (char *)"new_VarsByCode", _wrap_new_VarsByCode, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode_empty", _wrap_VarsByCode_empty, METH_VARARGS, NULL},
 	 { (char *)"VarsByCode_size", _wrap_VarsByCode_size, METH_VARARGS, NULL},
@@ -28274,7 +27802,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"VarsByCode_swigregister", VarsByCode_swigregister, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap_iterator", _wrap_TaxesMap_iterator, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap___nonzero__", _wrap_TaxesMap___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"TaxesMap___bool__", _wrap_TaxesMap___bool__, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap___len__", _wrap_TaxesMap___len__, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap___getitem__", _wrap_TaxesMap___getitem__, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap___delitem__", _wrap_TaxesMap___delitem__, METH_VARARGS, NULL},
@@ -28286,7 +27813,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"TaxesMap_key_iterator", _wrap_TaxesMap_key_iterator, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap_value_iterator", _wrap_TaxesMap_value_iterator, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap___setitem__", _wrap_TaxesMap___setitem__, METH_VARARGS, NULL},
-	 { (char *)"TaxesMap_asdict", _wrap_TaxesMap_asdict, METH_VARARGS, NULL},
 	 { (char *)"new_TaxesMap", _wrap_new_TaxesMap, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap_empty", _wrap_TaxesMap_empty, METH_VARARGS, NULL},
 	 { (char *)"TaxesMap_size", _wrap_TaxesMap_size, METH_VARARGS, NULL},
@@ -28306,7 +27832,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"TaxesMap_swigregister", TaxesMap_swigregister, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap_iterator", _wrap_ZaxesMap_iterator, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap___nonzero__", _wrap_ZaxesMap___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"ZaxesMap___bool__", _wrap_ZaxesMap___bool__, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap___len__", _wrap_ZaxesMap___len__, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap___getitem__", _wrap_ZaxesMap___getitem__, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap___delitem__", _wrap_ZaxesMap___delitem__, METH_VARARGS, NULL},
@@ -28318,7 +27843,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"ZaxesMap_key_iterator", _wrap_ZaxesMap_key_iterator, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap_value_iterator", _wrap_ZaxesMap_value_iterator, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap___setitem__", _wrap_ZaxesMap___setitem__, METH_VARARGS, NULL},
-	 { (char *)"ZaxesMap_asdict", _wrap_ZaxesMap_asdict, METH_VARARGS, NULL},
 	 { (char *)"new_ZaxesMap", _wrap_new_ZaxesMap, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap_empty", _wrap_ZaxesMap_empty, METH_VARARGS, NULL},
 	 { (char *)"ZaxesMap_size", _wrap_ZaxesMap_size, METH_VARARGS, NULL},
@@ -28338,7 +27862,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"ZaxesMap_swigregister", ZaxesMap_swigregister, METH_VARARGS, NULL},
 	 { (char *)"GridsMap_iterator", _wrap_GridsMap_iterator, METH_VARARGS, NULL},
 	 { (char *)"GridsMap___nonzero__", _wrap_GridsMap___nonzero__, METH_VARARGS, NULL},
-	 { (char *)"GridsMap___bool__", _wrap_GridsMap___bool__, METH_VARARGS, NULL},
 	 { (char *)"GridsMap___len__", _wrap_GridsMap___len__, METH_VARARGS, NULL},
 	 { (char *)"GridsMap___getitem__", _wrap_GridsMap___getitem__, METH_VARARGS, NULL},
 	 { (char *)"GridsMap___delitem__", _wrap_GridsMap___delitem__, METH_VARARGS, NULL},
@@ -28350,7 +27873,6 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"GridsMap_key_iterator", _wrap_GridsMap_key_iterator, METH_VARARGS, NULL},
 	 { (char *)"GridsMap_value_iterator", _wrap_GridsMap_value_iterator, METH_VARARGS, NULL},
 	 { (char *)"GridsMap___setitem__", _wrap_GridsMap___setitem__, METH_VARARGS, NULL},
-	 { (char *)"GridsMap_asdict", _wrap_GridsMap_asdict, METH_VARARGS, NULL},
 	 { (char *)"new_GridsMap", _wrap_new_GridsMap, METH_VARARGS, NULL},
 	 { (char *)"GridsMap_empty", _wrap_GridsMap_empty, METH_VARARGS, NULL},
 	 { (char *)"GridsMap_size", _wrap_GridsMap_size, METH_VARARGS, NULL},
@@ -28576,10 +28098,10 @@ static PyMethodDef SwigMethods[] = {
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
 static swig_type_info _swigt__p_Cdi = {"_p_Cdi", "Cdi *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_CdiGrid = {"_p_CdiGrid", "std::map< int,CdiGrid >::mapped_type *|CdiGrid *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_CdiTaxis = {"_p_CdiTaxis", "std::map< int,CdiTaxis >::mapped_type *|CdiTaxis *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_CdiVariable = {"_p_CdiVariable", "std::map< std::string,CdiVariable >::mapped_type *|std::vector< CdiVariable >::value_type *|std::map< int,CdiVariable >::mapped_type *|CdiVariable *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_CdiZaxis = {"_p_CdiZaxis", "std::map< int,CdiZaxis >::mapped_type *|CdiZaxis *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_CdiGrid = {"_p_CdiGrid", "CdiGrid *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_CdiTaxis = {"_p_CdiTaxis", "CdiTaxis *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_CdiVariable = {"_p_CdiVariable", "CdiVariable *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_CdiZaxis = {"_p_CdiZaxis", "CdiZaxis *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocator_type *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0};
@@ -28590,33 +28112,36 @@ static swig_type_info _swigt__p_mapped_type = {"_p_mapped_type", "mapped_type *"
 static swig_type_info _swigt__p_p_PyObject = {"_p_p_PyObject", "PyObject **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_CdiVariable_t = {"_p_std__allocatorT_CdiVariable_t", "std::vector< CdiVariable >::allocator_type *|std::allocator< CdiVariable > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_double_t = {"_p_std__allocatorT_double_t", "std::vector< double >::allocator_type *|std::allocator< double > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_int_t = {"_p_std__allocatorT_int_t", "std::vector< int >::allocator_type *|std::allocator< int > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t", "std::map< int,CdiGrid >::allocator_type *|std::allocator< std::pair< int const,CdiGrid > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t", "std::map< int,CdiTaxis >::allocator_type *|std::allocator< std::pair< int const,CdiTaxis > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t", "std::map< int,CdiVariable >::allocator_type *|std::allocator< std::pair< int const,CdiVariable > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t", "std::map< int,CdiZaxis >::allocator_type *|std::allocator< std::pair< int const,CdiZaxis > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t", "std::allocator< std::pair< std::string const,CdiVariable > > *|std::map< std::string,CdiVariable >::allocator_type *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_std__string_t = {"_p_std__allocatorT_std__string_t", "std::vector< std::string >::allocator_type *|std::allocator< std::string > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t = {"_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t", "std::vector< std::vector< double > >::allocator_type *|std::allocator< std::vector< double,std::allocator< double > > > *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_std__invalid_argument = {"_p_std__invalid_argument", "std::invalid_argument *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__lessT_int_t = {"_p_std__lessT_int_t", "std::less< int > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__lessT_std__string_t = {"_p_std__lessT_std__string_t", "std::less< std::string > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t = {"_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t", "std::map< int,CdiGrid > *|std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t = {"_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t", "std::map< int,CdiTaxis > *|std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t = {"_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t", "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *|std::map< int,CdiVariable > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t = {"_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t", "std::map< int,CdiZaxis > *|std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t = {"_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t", "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *|std::map< std::string,CdiVariable > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t = {"_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t", "std::vector< CdiVariable,std::allocator< CdiVariable > > *|std::vector< CdiVariable > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__vectorT__Tp__Alloc_t = {"_p_std__vectorT__Tp__Alloc_t", "std::vector< _Tp,_Alloc > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__vectorT_double_std__allocatorT_double_t_t = {"_p_std__vectorT_double_std__allocatorT_double_t_t", "std::vector< double,std::allocator< double > > *|std::vector< double > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__vectorT_float_std__allocatorT_float_t_t = {"_p_std__vectorT_float_std__allocatorT_float_t_t", "std::vector< float,std::allocator< float > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__vectorT_int_std__allocatorT_int_t_t = {"_p_std__vectorT_int_std__allocatorT_int_t_t", "std::vector< int,std::allocator< int > > *|std::vector< int > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *|std::vector< std::string > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t = {"_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t", "std::vector< std::vector< double > > *|std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *|std::vector< std::vector< do [...]
-static swig_type_info _swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t = {"_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t", "std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_swig__SwigPyIterator = {"_p_swig__SwigPyIterator", "swig::SwigPyIterator *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t = {"_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t", "std::map<int,CdiGrid,std::less<int >,std::allocator<std::pair<int const,CdiGrid > > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type = {"_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type", "std::allocator<std::pair<int const,CdiGrid > > *|std::map<int,CdiGrid >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type = {"_p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type", "CdiGrid *|std::map<int,CdiGrid >::mapped_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t = {"_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t", "std::map<int,CdiTaxis,std::less<int >,std::allocator<std::pair<int const,CdiTaxis > > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type = {"_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type", "std::allocator<std::pair<int const,CdiTaxis > > *|std::map<int,CdiTaxis >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type = {"_p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type", "CdiTaxis *|std::map<int,CdiTaxis >::mapped_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t = {"_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t", "std::map<int,CdiVariable,std::less<int >,std::allocator<std::pair<int const,CdiVariable > > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type = {"_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type", "std::allocator<std::pair<int const,CdiVariable > > *|std::map<int,CdiVariable >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type = {"_p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type", "CdiVariable *|std::map<int,CdiVariable >::mapped_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t = {"_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t", "std::map<int,CdiZaxis,std::less<int >,std::allocator<std::pair<int const,CdiZaxis > > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type = {"_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type", "std::allocator<std::pair<int const,CdiZaxis > > *|std::map<int,CdiZaxis >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type = {"_p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type", "CdiZaxis *|std::map<int,CdiZaxis >::mapped_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t = {"_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t", "std::map<std::string,CdiVariable,std::less<std::string >,std::allocator<std::pair<std::string const,CdiVariable > > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type = {"_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type", "std::allocator<std::pair<std::string const,CdiVariable > > *|std::map<std::string,CdiVariable >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type = {"_p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type", "CdiVariable *|std::map<std::string,CdiVariable >::mapped_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t = {"_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t", "std::vector<CdiVariable,std::allocator<CdiVariable > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type = {"_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type", "std::allocator<CdiVariable > *|std::vector<CdiVariable >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type = {"_p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type", "CdiVariable *|std::vector<CdiVariable >::value_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTdouble_std__allocatorTdouble_t_t = {"_p_std__vectorTdouble_std__allocatorTdouble_t_t", "std::vector<double,std::allocator<double > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type = {"_p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type", "std::allocator<double > *|std::vector<double >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTfloat_std__allocatorTfloat_t_t = {"_p_std__vectorTfloat_std__allocatorTfloat_t_t", "std::vector<float,std::allocator<float > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTint_std__allocatorTint_t_t = {"_p_std__vectorTint_std__allocatorTint_t_t", "std::vector<int,std::allocator<int > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTint_std__allocatorTint_t_t__allocator_type = {"_p_std__vectorTint_std__allocatorTint_t_t__allocator_type", "std::allocator<int > *|std::vector<int >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTstd__string_std__allocatorTstd__string_t_t = {"_p_std__vectorTstd__string_std__allocatorTstd__string_t_t", "std::vector<std::string,std::allocator<std::string > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type = {"_p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type", "std::allocator<std::string > *|std::vector<std::string >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t = {"_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t", "std::vector<std::vector<double,std::allocator<double > >,std::allocator<std::vector<double,std::allocator<double > > > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type = {"_p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type", "std::allocator<std::vector<double,std::allocator<double > > > *|std::vector<std::vector<double > >::allocator_type *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t = {"_p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t", "std::vector<std::vector<float,std::allocator<float > >,std::allocator<std::vector<float,std::allocator<float > > > > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_swig__PySwigIterator = {"_p_swig__PySwigIterator", "swig::PySwigIterator *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_value_type = {"_p_value_type", "value_type *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
@@ -28635,41 +28160,44 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_p_PyObject,
   &_swigt__p_p_double,
   &_swigt__p_size_type,
-  &_swigt__p_std__allocatorT_CdiVariable_t,
-  &_swigt__p_std__allocatorT_double_t,
-  &_swigt__p_std__allocatorT_int_t,
-  &_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t,
-  &_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t,
-  &_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t,
-  &_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t,
-  &_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t,
-  &_swigt__p_std__allocatorT_std__string_t,
-  &_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t,
   &_swigt__p_std__invalid_argument,
-  &_swigt__p_std__lessT_int_t,
-  &_swigt__p_std__lessT_std__string_t,
-  &_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t,
-  &_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t,
-  &_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t,
-  &_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t,
-  &_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t,
-  &_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t,
-  &_swigt__p_std__vectorT__Tp__Alloc_t,
-  &_swigt__p_std__vectorT_double_std__allocatorT_double_t_t,
-  &_swigt__p_std__vectorT_float_std__allocatorT_float_t_t,
-  &_swigt__p_std__vectorT_int_std__allocatorT_int_t_t,
-  &_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
-  &_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t,
-  &_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t,
-  &_swigt__p_swig__SwigPyIterator,
+  &_swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t,
+  &_swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type,
+  &_swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type,
+  &_swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t,
+  &_swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type,
+  &_swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type,
+  &_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t,
+  &_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type,
+  &_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type,
+  &_swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t,
+  &_swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type,
+  &_swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type,
+  &_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t,
+  &_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type,
+  &_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type,
+  &_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t,
+  &_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type,
+  &_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,
+  &_swigt__p_std__vectorTdouble_std__allocatorTdouble_t_t,
+  &_swigt__p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type,
+  &_swigt__p_std__vectorTfloat_std__allocatorTfloat_t_t,
+  &_swigt__p_std__vectorTint_std__allocatorTint_t_t,
+  &_swigt__p_std__vectorTint_std__allocatorTint_t_t__allocator_type,
+  &_swigt__p_std__vectorTstd__string_std__allocatorTstd__string_t_t,
+  &_swigt__p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type,
+  &_swigt__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t,
+  &_swigt__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type,
+  &_swigt__p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t,
+  &_swigt__p_swig__PySwigIterator,
   &_swigt__p_value_type,
 };
 
 static swig_cast_info _swigc__p_Cdi[] = {  {&_swigt__p_Cdi, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CdiGrid[] = {  {&_swigt__p_CdiGrid, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CdiTaxis[] = {  {&_swigt__p_CdiTaxis, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CdiVariable[] = {  {&_swigt__p_CdiVariable, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CdiZaxis[] = {  {&_swigt__p_CdiZaxis, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CdiGrid[] = {  {&_swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_CdiGrid, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CdiTaxis[] = {  {&_swigt__p_CdiTaxis, 0, 0, 0},  {&_swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CdiVariable[] = {  {&_swigt__p_CdiVariable, 0, 0, 0},  {&_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0, 0, 0},  {&_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CdiZaxis[] = {  {&_swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_CdiZaxis, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_allocator_type[] = {  {&_swigt__p_allocator_type, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_difference_type[] = {  {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}};
@@ -28680,33 +28208,36 @@ static swig_cast_info _swigc__p_mapped_type[] = {  {&_swigt__p_mapped_type, 0, 0
 static swig_cast_info _swigc__p_p_PyObject[] = {  {&_swigt__p_p_PyObject, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_double[] = {  {&_swigt__p_p_double, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_size_type[] = {  {&_swigt__p_size_type, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_CdiVariable_t[] = {  {&_swigt__p_std__allocatorT_CdiVariable_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_double_t[] = {  {&_swigt__p_std__allocatorT_double_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_int_t[] = {  {&_swigt__p_std__allocatorT_int_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t[] = {  {&_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_std__string_t[] = {  {&_swigt__p_std__allocatorT_std__string_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t[] = {  {&_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_std__invalid_argument[] = {  {&_swigt__p_std__invalid_argument, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__lessT_int_t[] = {  {&_swigt__p_std__lessT_int_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__lessT_std__string_t[] = {  {&_swigt__p_std__lessT_std__string_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t[] = {  {&_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t[] = {  {&_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t[] = {  {&_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t[] = {  {&_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t[] = {  {&_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t[] = {  {&_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT__Tp__Alloc_t[] = {  {&_swigt__p_std__vectorT__Tp__Alloc_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT_double_std__allocatorT_double_t_t[] = {  {&_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT_float_std__allocatorT_float_t_t[] = {  {&_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT_int_std__allocatorT_int_t_t[] = {  {&_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = {  {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t[] = {  {&_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t[] = {  {&_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_swig__SwigPyIterator[] = {  {&_swigt__p_swig__SwigPyIterator, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t[] = {  {&_swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type[] = {  {&_swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type[] = {  {&_swigt__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_CdiGrid, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t[] = {  {&_swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type[] = {  {&_swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type[] = {  {&_swigt__p_CdiTaxis, 0, 0, 0},  {&_swigt__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t[] = {  {&_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type[] = {  {&_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type[] = {  {&_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0, 0, 0},  {&_swigt__p_CdiVariable, 0, 0, 0},  {&_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd_ [...]
+static swig_cast_info _swigc__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t[] = {  {&_swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type[] = {  {&_swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type[] = {  {&_swigt__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_CdiZaxis, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t[] = {  {&_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type[] = {  {&_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type[] = {  {&_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0, 0, 0},  {&_swigt__p_CdiVariable, 0, 0, 0},  {&_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__stri [...]
+static swig_cast_info _swigc__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t[] = {  {&_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type[] = {  {&_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type[] = {  {&_swigt__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type, 0, 0, 0},  {&_swigt__p_CdiVariable, 0, 0, 0},  {&_swigt__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type, 0, 0, 0},  {&_swigt__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_ [...]
+static swig_cast_info _swigc__p_std__vectorTdouble_std__allocatorTdouble_t_t[] = {  {&_swigt__p_std__vectorTdouble_std__allocatorTdouble_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type[] = {  {&_swigt__p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTfloat_std__allocatorTfloat_t_t[] = {  {&_swigt__p_std__vectorTfloat_std__allocatorTfloat_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTint_std__allocatorTint_t_t[] = {  {&_swigt__p_std__vectorTint_std__allocatorTint_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTint_std__allocatorTint_t_t__allocator_type[] = {  {&_swigt__p_std__vectorTint_std__allocatorTint_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTstd__string_std__allocatorTstd__string_t_t[] = {  {&_swigt__p_std__vectorTstd__string_std__allocatorTstd__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type[] = {  {&_swigt__p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t[] = {  {&_swigt__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type[] = {  {&_swigt__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t[] = {  {&_swigt__p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_swig__PySwigIterator[] = {  {&_swigt__p_swig__PySwigIterator, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_value_type[] = {  {&_swigt__p_value_type, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
@@ -28725,33 +28256,36 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_p_PyObject,
   _swigc__p_p_double,
   _swigc__p_size_type,
-  _swigc__p_std__allocatorT_CdiVariable_t,
-  _swigc__p_std__allocatorT_double_t,
-  _swigc__p_std__allocatorT_int_t,
-  _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t,
-  _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t,
-  _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t,
-  _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t,
-  _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t,
-  _swigc__p_std__allocatorT_std__string_t,
-  _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t,
   _swigc__p_std__invalid_argument,
-  _swigc__p_std__lessT_int_t,
-  _swigc__p_std__lessT_std__string_t,
-  _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t,
-  _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t,
-  _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t,
-  _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t,
-  _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t,
-  _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t,
-  _swigc__p_std__vectorT__Tp__Alloc_t,
-  _swigc__p_std__vectorT_double_std__allocatorT_double_t_t,
-  _swigc__p_std__vectorT_float_std__allocatorT_float_t_t,
-  _swigc__p_std__vectorT_int_std__allocatorT_int_t_t,
-  _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
-  _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t,
-  _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t,
-  _swigc__p_swig__SwigPyIterator,
+  _swigc__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t,
+  _swigc__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__allocator_type,
+  _swigc__p_std__mapTint_CdiGrid_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiGrid_t_t_t__mapped_type,
+  _swigc__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t,
+  _swigc__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__allocator_type,
+  _swigc__p_std__mapTint_CdiTaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiTaxis_t_t_t__mapped_type,
+  _swigc__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t,
+  _swigc__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__allocator_type,
+  _swigc__p_std__mapTint_CdiVariable_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiVariable_t_t_t__mapped_type,
+  _swigc__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t,
+  _swigc__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__allocator_type,
+  _swigc__p_std__mapTint_CdiZaxis_std__lessTint_t_std__allocatorTstd__pairTint_const_CdiZaxis_t_t_t__mapped_type,
+  _swigc__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t,
+  _swigc__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__allocator_type,
+  _swigc__p_std__mapTstd__string_CdiVariable_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_CdiVariable_t_t_t__mapped_type,
+  _swigc__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t,
+  _swigc__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__allocator_type,
+  _swigc__p_std__vectorTCdiVariable_std__allocatorTCdiVariable_t_t__value_type,
+  _swigc__p_std__vectorTdouble_std__allocatorTdouble_t_t,
+  _swigc__p_std__vectorTdouble_std__allocatorTdouble_t_t__allocator_type,
+  _swigc__p_std__vectorTfloat_std__allocatorTfloat_t_t,
+  _swigc__p_std__vectorTint_std__allocatorTint_t_t,
+  _swigc__p_std__vectorTint_std__allocatorTint_t_t__allocator_type,
+  _swigc__p_std__vectorTstd__string_std__allocatorTstd__string_t_t,
+  _swigc__p_std__vectorTstd__string_std__allocatorTstd__string_t_t__allocator_type,
+  _swigc__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t,
+  _swigc__p_std__vectorTstd__vectorTdouble_std__allocatorTdouble_t_t_std__allocatorTstd__vectorTdouble_std__allocatorTdouble_t_t_t_t__allocator_type,
+  _swigc__p_std__vectorTstd__vectorTfloat_std__allocatorTfloat_t_t_std__allocatorTstd__vectorTfloat_std__allocatorTfloat_t_t_t_t,
+  _swigc__p_swig__PySwigIterator,
   _swigc__p_value_type,
 };
 
@@ -28821,7 +28355,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found, init;
+  int found;
   
   clientdata = clientdata;
   
@@ -28831,9 +28365,6 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
-    init = 1;
-  } else {
-    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -28862,12 +28393,6 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
-  /* When multiple interpeters are used, a module could have already been initialized in
-       a different interpreter, but not yet have a pointer in this interpreter.
-       In this case, we do not want to continue adding types... everything should be
-       set up already */
-  if (init == 0) return;
-  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -29030,58 +28555,26 @@ extern "C" {
   
   SWIGINTERN PyObject *
   swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
-#if PY_VERSION_HEX >= 0x03000000
-    return PyUnicode_InternFromString("<Swig global variables>");
-#else
     return PyString_FromString("<Swig global variables>");
-#endif
   }
   
   SWIGINTERN PyObject *
   swig_varlink_str(swig_varlinkobject *v) {
-#if PY_VERSION_HEX >= 0x03000000
-    PyObject *str = PyUnicode_InternFromString("(");
-    PyObject *tail;
-    PyObject *joined;
-    swig_globalvar *var;
-    for (var = v->vars; var; var=var->next) {
-      tail = PyUnicode_FromString(var->name);
-      joined = PyUnicode_Concat(str, tail);
-      Py_DecRef(str);
-      Py_DecRef(tail);
-      str = joined;
-      if (var->next) {
-        tail = PyUnicode_InternFromString(", ");
-        joined = PyUnicode_Concat(str, tail);
-        Py_DecRef(str);
-        Py_DecRef(tail);
-        str = joined;
-      }
-    }
-    tail = PyUnicode_InternFromString(")");
-    joined = PyUnicode_Concat(str, tail);
-    Py_DecRef(str);
-    Py_DecRef(tail);
-    str = joined;
-#else
     PyObject *str = PyString_FromString("(");
-    swig_globalvar *var;
+    swig_globalvar  *var;
     for (var = v->vars; var; var=var->next) {
       PyString_ConcatAndDel(&str,PyString_FromString(var->name));
       if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
     }
     PyString_ConcatAndDel(&str,PyString_FromString(")"));
-#endif
     return str;
   }
   
   SWIGINTERN int
   swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
-    char *tmp;
     PyObject *str = swig_varlink_str(v);
     fprintf(fp,"Swig global variables ");
-    fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
-    SWIG_Python_str_DelForPy3(tmp);
+    fprintf(fp,"%s\n", PyString_AsString(str));
     Py_DECREF(str);
     return 0;
   }
@@ -29135,23 +28628,19 @@ extern "C" {
   swig_varlink_type(void) {
     static char varlink__doc__[] = "Swig var link object";
     static PyTypeObject varlink_type;
-    static int type_init = 0;
+    static int type_init = 0;  
     if (!type_init) {
-      const PyTypeObject tmp = {
-        /* PyObject header changed in Python 3 */
-#if PY_VERSION_HEX >= 0x03000000
-        PyVarObject_HEAD_INIT(NULL, 0)
-#else
+      const PyTypeObject tmp
+      = {
         PyObject_HEAD_INIT(NULL)
-        0,                                  /* ob_size */
-#endif
-        (char *)"swigvarlink",              /* tp_name */
-        sizeof(swig_varlinkobject),         /* tp_basicsize */
-        0,                                  /* tp_itemsize */
-        (destructor) swig_varlink_dealloc,  /* tp_dealloc */
-        (printfunc) swig_varlink_print,     /* tp_print */
-        (getattrfunc) swig_varlink_getattr, /* tp_getattr */
-        (setattrfunc) swig_varlink_setattr, /* tp_setattr */
+        0,                                  /* Number of items in variable part (ob_size) */
+        (char *)"swigvarlink",              /* Type name (tp_name) */
+        sizeof(swig_varlinkobject),         /* Basic size (tp_basicsize) */
+        0,                                  /* Itemsize (tp_itemsize) */
+        (destructor) swig_varlink_dealloc,   /* Deallocator (tp_dealloc) */ 
+        (printfunc) swig_varlink_print,     /* Print (tp_print) */
+        (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
+        (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
         0,                                  /* tp_compare */
         (reprfunc) swig_varlink_repr,       /* tp_repr */
         0,                                  /* tp_as_number */
@@ -29159,7 +28648,7 @@ extern "C" {
         0,                                  /* tp_as_mapping */
         0,                                  /* tp_hash */
         0,                                  /* tp_call */
-        (reprfunc) swig_varlink_str,        /* tp_str */
+        (reprfunc)swig_varlink_str,        /* tp_str */
         0,                                  /* tp_getattro */
         0,                                  /* tp_setattro */
         0,                                  /* tp_as_buffer */
@@ -29175,21 +28664,13 @@ extern "C" {
 #if PY_VERSION_HEX >= 0x02030000
         0,                                  /* tp_del */
 #endif
-#if PY_VERSION_HEX >= 0x02060000
-        0,                                  /* tp_version */
-#endif
 #ifdef COUNT_ALLOCS
         0,0,0,0                             /* tp_alloc -> tp_next */
 #endif
       };
       varlink_type = tmp;
-      type_init = 1;
-#if PY_VERSION_HEX < 0x02020000
       varlink_type.ob_type = &PyType_Type;
-#else
-      if (PyType_Ready(&varlink_type) < 0)
-      return NULL;
-#endif
+      type_init = 1;
     }
     return &varlink_type;
   }
@@ -29240,7 +28721,7 @@ extern "C" {
     for (i = 0; constants[i].type; ++i) {
       switch(constants[i].type) {
       case SWIG_PY_POINTER:
-        obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
+        obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
         break;
       case SWIG_PY_BINARY:
         obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
@@ -29280,15 +28761,15 @@ extern "C" {
           }
         }
         if (ci) {
-          void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
-          if (ptr) {
-            size_t shift = (ci->ptype) - types;
-            swig_type_info *ty = types_initial[shift];
-            size_t ldoc = (c - methods[i].ml_doc);
-            size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
-            char *ndoc = (char*)malloc(ldoc + lptr + 10);
-            if (ndoc) {
-              char *buff = ndoc;
+          size_t shift = (ci->ptype) - types;
+          swig_type_info *ty = types_initial[shift];
+          size_t ldoc = (c - methods[i].ml_doc);
+          size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
+          char *ndoc = (char*)malloc(ldoc + lptr + 10);
+          if (ndoc) {
+            char *buff = ndoc;
+            void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+            if (ptr) {
               strncpy(buff, methods[i].ml_doc, ldoc);
               buff += ldoc;
               strncpy(buff, "swig_ptr: ", 10);
@@ -29313,136 +28794,19 @@ extern "C" {
 #ifdef __cplusplus
 extern "C"
 #endif
-
-SWIGEXPORT 
-#if PY_VERSION_HEX >= 0x03000000
-PyObject*
-#else
-void
-#endif
-SWIG_init(void) {
-  PyObject *m, *d, *md;
-#if PY_VERSION_HEX >= 0x03000000
-  static struct PyModuleDef SWIG_module = {
-# if PY_VERSION_HEX >= 0x03020000
-    PyModuleDef_HEAD_INIT,
-# else
-    {
-      PyObject_HEAD_INIT(NULL)
-      NULL, /* m_init */
-      0,    /* m_index */
-      NULL, /* m_copy */
-    },
-# endif
-    (char *) SWIG_name,
-    NULL,
-    -1,
-    SwigMethods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
-  };
-#endif
-  
-#if defined(SWIGPYTHON_BUILTIN)
-  static SwigPyClientData SwigPyObject_clientdata = {
-    0, 0, 0, 0, 0, 0, 0
-  };
-  static PyGetSetDef this_getset_def = {
-    (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
-  };
-  static SwigPyGetSet thisown_getset_closure = {
-    (PyCFunction) SwigPyObject_own,
-    (PyCFunction) SwigPyObject_own
-  };
-  static PyGetSetDef thisown_getset_def = {
-    (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
-  };
-  PyObject *metatype_args;
-  PyTypeObject *builtin_pytype;
-  int builtin_base_count;
-  swig_type_info *builtin_basetype;
-  PyObject *tuple;
-  PyGetSetDescrObject *static_getset;
-  PyTypeObject *metatype;
-  SwigPyClientData *cd;
-  PyObject *public_interface, *public_symbol;
-  PyObject *this_descr;
-  PyObject *thisown_descr;
-  int i;
-  
-  (void)builtin_pytype;
-  (void)builtin_base_count;
-  (void)builtin_basetype;
-  (void)tuple;
-  (void)static_getset;
-  
-  /* metatype is used to implement static member variables. */
-  metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type);
-  assert(metatype_args);
-  metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
-  assert(metatype);
-  Py_DECREF(metatype_args);
-  metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro;
-  assert(PyType_Ready(metatype) >= 0);
-#endif
+SWIGEXPORT void SWIG_init(void) {
+  PyObject *m, *d;
   
   /* Fix SwigMethods to carry the callback ptrs when needed */
   SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
   
-#if PY_VERSION_HEX >= 0x03000000
-  m = PyModule_Create(&SWIG_module);
-#else
   m = Py_InitModule((char *) SWIG_name, SwigMethods);
-#endif
-  md = d = PyModule_GetDict(m);
+  d = PyModule_GetDict(m);
   
   SWIG_InitializeModule(0);
-  
-#ifdef SWIGPYTHON_BUILTIN
-  SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
-  assert(SwigPyObject_stype);
-  cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
-  if (!cd) {
-    SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
-    SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce();
-  } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) {
-    PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
-# if PY_VERSION_HEX >= 0x03000000
-    return NULL;
-# else
-    return;
-# endif
-  }
-  
-  /* All objects have a 'this' attribute */
-  this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
-  (void)this_descr;
-  
-  /* All objects have a 'thisown' attribute */
-  thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
-  (void)thisown_descr;
-  
-  public_interface = PyList_New(0);
-  public_symbol = 0;
-  (void)public_symbol;
-  
-  PyDict_SetItemString(md, "__all__", public_interface);
-  Py_DECREF(public_interface);
-  for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
-  SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
-  for (i = 0; swig_const_table[i].name != 0; ++i)
-  SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
-#endif
-  
   SWIG_InstallConstants(d,swig_const_table);
   
+  
   SWIG_Python_SetConstant(d, "CHARSIZE",SWIG_From_int(static_cast< int >(128)));
-#if PY_VERSION_HEX >= 0x03000000
-  return m;
-#else
-  return;
-#endif
 }
 
diff --git a/libcdi/m4/acx_options.m4 b/libcdi/m4/acx_options.m4
index 8d268de..aecd012 100644
--- a/libcdi/m4/acx_options.m4
+++ b/libcdi/m4/acx_options.m4
@@ -138,6 +138,9 @@ AC_SUBST([HDF5_LIBS])
 NETCDF_ROOT=''
 NETCDF_INCLUDE=''
 NETCDF_LIBS=''
+ENABLE_NETCDF=no
+ENABLE_NC2=no
+ENABLE_NC4=no
 AC_ARG_WITH([netcdf],
             [AS_HELP_STRING([--with-netcdf=<yes|no|directory> (default=yes)],[location of netcdf library (lib and include subdirs)])],
             [AS_CASE(["$with_netcdf"],
@@ -146,7 +149,8 @@ AC_ARG_WITH([netcdf],
                      [yes],[AC_CHECK_HEADERS([netcdf.h])
                             AC_SEARCH_LIBS([nc_open],
                                            [netcdf],
-                                           [AC_DEFINE([HAVE_LIBNETCDF],[1],[Define to 1 for NETCDF support])],
+                                           [AC_DEFINE([HAVE_LIBNETCDF],[1],[Define to 1 for NETCDF support])
+                                            ENABLE_NETCDF=yes],
                                            [AC_MSG_ERROR([Could not link to netcdf library])])
                             NETCDF_LIBS=" -lnetcdf"
                             AC_CHECK_PROG(NC_CONFIG,nc-config,nc-config)
@@ -154,10 +158,13 @@ AC_ARG_WITH([netcdf],
                                   [AC_MSG_CHECKING([netcdf's nc2 support])
                                    AS_IF([test "x$($NC_CONFIG --has-nc2)" = "xyes"],
                                          [AC_DEFINE([HAVE_NETCDF2],[1],[Define to 1 for NETCDF2 support])
-                                          AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
+                                          AC_MSG_RESULT([yes])
+                                          ENABLE_NC2=yes],
+                                         [AC_MSG_RESULT([no])])
                                    AC_MSG_CHECKING([netcdf's nc4 support])
                                    AS_IF([test "x$($NC_CONFIG --has-nc4)" = "xyes"],
                                    [AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
+                                    ENABLE_NC4=yes
                                     AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
                                   [AS_ECHO([Could not find nc-config! go on with default configuration])])],
                      [*],[AS_IF([test -d "$with_netcdf"],
@@ -167,7 +174,8 @@ AC_ARG_WITH([netcdf],
                                  AC_CHECK_HEADERS([netcdf.h])
                                  AC_SEARCH_LIBS([nc_open],
                                                 [netcdf],
-                                                [AC_DEFINE([HAVE_LIBNETCDF],[1],[Define to 1 for NETCDF support])],
+                                                [AC_DEFINE([HAVE_LIBNETCDF],[1],[Define to 1 for NETCDF support])
+                                                 ENABLE_NETCDF=yes],
                                                 [AC_MSG_ERROR([Could not link to netcdf library])])
                                  NETCDF_LIBS=" -L$NETCDF_ROOT/lib -lnetcdf"
                                  NETCDF_INCLUDE=" -I$NETCDF_ROOT/include"
@@ -181,15 +189,20 @@ AC_ARG_WITH([netcdf],
                                    [AC_MSG_CHECKING([netcdf's nc2 support])
                                    AS_IF([test "x$($NC_CONFIG --has-nc2)" = "xyes"],
                                          [AC_DEFINE([HAVE_NETCDF2],[1],[Define to 1 for NETCDF2 support])
+                                          ENABLE_NC2=yes
                                           AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
                                    AC_MSG_CHECKING([netcdf's nc4 support])
                                    AS_IF([test "x$($NC_CONFIG --has-nc4)" = "xyes"],
                                          [AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
+                                          ENABLE_NC4=yes
                                           AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
                                    [AC_MSG_RESULT([Could not find nc-config! go on with default configuration])])],
                                 [AC_MSG_NOTICE([$with_netcdf is not a directory! NETCDF suppressed])])])],
             [AC_MSG_CHECKING([for NETCDF library])
              AC_MSG_RESULT([suppressed])])
+AC_SUBST([ENABLE_NETCDF])
+AC_SUBST([ENABLE_NC2])
+AC_SUBST([ENABLE_NC4])
 AC_SUBST([NETCDF_ROOT])
 AC_SUBST([NETCDF_INCLUDE])
 AC_SUBST([NETCDF_LIBS])
@@ -383,3 +396,7 @@ AC_ARG_ENABLE([all-static],
 AC_MSG_RESULT([$enable_all_static])
 AM_CONDITIONAL([ENABLE_ALL_STATIC],[test x$enable_all_static = 'xyes'])
 ])
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/libcdi/m4/acx_sl_fc_mod_path_flag.m4 b/libcdi/m4/acx_sl_fc_mod_path_flag.m4
index 863f719..022255b 100644
--- a/libcdi/m4/acx_sl_fc_mod_path_flag.m4
+++ b/libcdi/m4/acx_sl_fc_mod_path_flag.m4
@@ -58,7 +58,7 @@ AC_DEFUN([ACX_SL_FC_CHECK_MOD_PATH_FLAG],dnl
    AC_REQUIRE([AC_PROG_FC])
    AS_VAR_PUSHDEF([mod_flag],[acx_sl_cv_fc_mod_path_flag_]_AC_LANG_ABBREV)dnl
    ASX_VAR_UNSET([mod_flag])
-   AC_CACHE_CHECK([for flag to alter module search path],[mod_flag],dnl
+   AC_CACHE_CHECK([for flag to alter module search path],[mod_flag],
      [mkdir conftestdir
       cd conftestdir
       AC_COMPILE_IFELSE([AC_LANG_SOURCE([      module cnftst
diff --git a/libcdi/src/Makefile.am b/libcdi/src/Makefile.am
index 32433c1..8e31955 100644
--- a/libcdi/src/Makefile.am
+++ b/libcdi/src/Makefile.am
@@ -9,6 +9,7 @@ else
   noinst_LTLIBRARIES = libcdi.la
 endif
 
+AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS)
 
 libcdi_la_SOURCES = 	 \
 	basetime.c     	 \
@@ -54,9 +55,10 @@ libcdi_la_SOURCES = 	 \
 	model.h        	 \
 	namespace.c      \
 	namespace.h      \
+	serialize.h	\
+	serialize.c	\
 	pio.c            \
 	pio.h            \
-	pio_c_temp.h     \
 	pio_comm.c       \
 	pio_comm.h       \
 	pio_dbuffer.c    \
@@ -69,12 +71,19 @@ libcdi_la_SOURCES = 	 \
 	pio_posixfpguardsendrecv.c \
 	pio_posixnonb.c  \
 	pio_list_set.c	 \
-	pio_rpc.c        \
+	resource_unpack.h \
+	resource_unpack.c \
 	pio_rpc.h        \
+	pio_client.c	\
+	pio_client.h	\
 	pio_server.c     \
 	pio_server.h     \
 	pio_util.c       \
 	pio_util.h       \
+	pio_serialize.h	\
+	pio_serialize.c	\
+	pio_cdf_int.c	\
+	pio_cdf_int.h	\
 	resource_handle.c\
 	resource_handle.h\
 	service.h	 \
@@ -123,13 +132,13 @@ libcdi_la_SOURCES = 	 \
         swap.c
 
 #libcdi_la_CPPFLAGS  = @CPPFLAGS@
-#libcdi_la_LIBADD    = @LDFLAGS@
+libcdi_la_LIBADD    = $(PPM_CORE_LIBS) $(YAXT_LIBS)
 #
-cdilib.c:
-	$(top_srcdir)/src/make_cdilib $(top_srcdir)/src
+#cdilib.c:
+#	$(top_srcdir)/src/make_cdilib $(top_srcdir)/src
 #
-cdilib.o: cdilib.c
-	$(COMPILE) -c $<
+#cdilib.o: cdilib.c
+#	$(COMPILE) -c $<
 
 LOCALTARGETS  = 
 if ENABLE_CDI_LIB
@@ -140,8 +149,8 @@ if CREATE_ISOC
 LOCALTARGETS += mo_cdi.o mo_cdi.$(FCMODEXT)
 endif
 #
-mo_cdi.f90:
-	ruby $(top_srcdir)/interfaces/f2003/bindGen.rb cdi.h $@
+mo_cdi.f90: $(top_srcdir)/src/cdi.h
+	ruby $(top_srcdir)/interfaces/f2003/bindGen.rb $(top_srcdir)/src/cdi.h $@
 #
 mo_cdi.o: mo_cdi.f90
 	$(FC) $(FCFLAGS) -c $(FCFLAGS_f90) $<
@@ -155,7 +164,7 @@ pkgconfig/cdi.pc: pkgconfig/cdi.pc.in ../config.status
 all-local: $(LOCALTARGETS) 
 #
 CLEANFILES  = `ls *~`
-CLEANFILES += cdilib.c
+#CLEANFILES += cdilib.c
 if CREATE_ISOC
 CLEANFILES += $(top_builddir)/src/mo_cdi.$(FCMODEXT) $(top_builddir)/src/mo_cdi.o
 endif
diff --git a/libcdi/src/Makefile.in b/libcdi/src/Makefile.in
index 1acc867..8dcb3d5 100644
--- a/libcdi/src/Makefile.in
+++ b/libcdi/src/Makefile.in
@@ -54,6 +54,7 @@ build_triplet = @build@
 host_triplet = @host@
 @ENABLE_CDI_LIB_TRUE at am__append_1 = pkgconfig/cdi.pc
 @CREATE_ISOC_TRUE at am__append_2 = mo_cdi.o mo_cdi.$(FCMODEXT)
+#CLEANFILES += cdilib.c
 @CREATE_ISOC_TRUE at am__append_3 = $(top_builddir)/src/mo_cdi.$(FCMODEXT) $(top_builddir)/src/mo_cdi.o
 @ENABLE_CDI_LIB_TRUE at am__append_4 = pkgconfig/cdi.pc
 subdir = src
@@ -107,21 +108,24 @@ am__uninstall_files_from_dir = { \
   }
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
-libcdi_la_LIBADD =
+am__DEPENDENCIES_1 =
+libcdi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_libcdi_la_OBJECTS = basetime.lo binary.lo calendar.lo cdf.lo \
 	cdf_int.lo cdi_error.lo cdi_util.lo cdiFortran.lo \
 	cgribexlib.lo dmemory.lo error.lo extralib.lo file.lo \
 	gaussgrid.lo gribapi.lo grid.lo ieglib.lo institution.lo \
-	model.lo namespace.lo pio.lo pio_comm.lo pio_dbuffer.lo \
-	pio_interface.lo pio_mpinonb.lo pio_record_send.lo \
-	pio_posixasynch.lo pio_posixfpguardsendrecv.lo \
-	pio_posixnonb.lo pio_list_set.lo pio_rpc.lo pio_server.lo \
-	pio_util.lo resource_handle.lo servicelib.lo stream_cdf.lo \
-	stream_cgribex.lo stream_ext.lo stream_grb.lo \
-	stream_gribapi.lo stream_history.lo stream_ieg.lo cdi_int.lo \
-	stream_record.lo stream_srv.lo stream_var.lo table.lo taxis.lo \
-	timebase.lo tsteps.lo util.lo varscan.lo version.lo vlist.lo \
-	vlist_att.lo vlist_var.lo zaxis.lo stream.lo swap.lo
+	model.lo namespace.lo serialize.lo pio.lo pio_comm.lo \
+	pio_dbuffer.lo pio_interface.lo pio_mpinonb.lo \
+	pio_record_send.lo pio_posixasynch.lo \
+	pio_posixfpguardsendrecv.lo pio_posixnonb.lo pio_list_set.lo \
+	resource_unpack.lo pio_client.lo pio_server.lo pio_util.lo \
+	pio_serialize.lo pio_cdf_int.lo resource_handle.lo \
+	servicelib.lo stream_cdf.lo stream_cgribex.lo stream_ext.lo \
+	stream_grb.lo stream_gribapi.lo stream_history.lo \
+	stream_ieg.lo cdi_int.lo stream_record.lo stream_srv.lo \
+	stream_var.lo table.lo taxis.lo timebase.lo tsteps.lo util.lo \
+	varscan.lo version.lo vlist.lo vlist_att.lo vlist_var.lo \
+	zaxis.lo stream.lo swap.lo
 libcdi_la_OBJECTS = $(am_libcdi_la_OBJECTS)
 @ENABLE_CDI_LIB_FALSE at am_libcdi_la_rpath =
 @ENABLE_CDI_LIB_TRUE at am_libcdi_la_rpath = -rpath $(libdir)
@@ -158,6 +162,13 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+BUILD_CXX = @BUILD_CXX@
+BUILD_F77 = @BUILD_F77@
+BUILD_FC = @BUILD_FC@
+BUILD_FCFLAGS = @BUILD_FCFLAGS@
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CDI_F90_INTERFACE_FCFLAGS = @CDI_F90_INTERFACE_FCFLAGS@
@@ -183,6 +194,9 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
 ENABLE_EXTRA = @ENABLE_EXTRA@
 ENABLE_GRIB = @ENABLE_GRIB@
 ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
+ENABLE_NETCDF = @ENABLE_NETCDF@
 ENABLE_PYTHON = @ENABLE_PYTHON@
 ENABLE_RUBY = @ENABLE_RUBY@
 ENABLE_SERVICE = @ENABLE_SERVICE@
@@ -203,6 +217,7 @@ FPP_INCOPT = @FPP_INCOPT@
 GREP = @GREP@
 GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
 GRIB_API_LIBS = @GRIB_API_LIBS@
+HAVE_PARALLEL_NC4 = @HAVE_PARALLEL_NC4@
 HDF5_INCLUDE = @HDF5_INCLUDE@
 HDF5_LIBS = @HDF5_LIBS@
 HDF5_ROOT = @HDF5_ROOT@
@@ -246,6 +261,11 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PPM_CORE_CFLAGS = @PPM_CORE_CFLAGS@
+PPM_CORE_LIBS = @PPM_CORE_LIBS@
 PTHREAD_CC = @PTHREAD_CC@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -265,6 +285,8 @@ THREADS_LIBS = @THREADS_LIBS@
 USER_NAME = @USER_NAME@
 USE_MPI = @USE_MPI@
 VERSION = @VERSION@
+YAXT_CFLAGS = @YAXT_CFLAGS@
+YAXT_LIBS = @YAXT_LIBS@
 ZLIB_INCLUDE = @ZLIB_INCLUDE@
 ZLIB_LIBS = @ZLIB_LIBS@
 abs_builddir = @abs_builddir@
@@ -330,6 +352,7 @@ EXTRA_DIST = cdilib.c mo_cdi.f90
 @ENABLE_CDI_LIB_TRUE at lib_LTLIBRARIES = libcdi.la
 @ENABLE_CDI_LIB_TRUE at include_HEADERS = cdi.h cdi.inc
 @ENABLE_CDI_LIB_FALSE at noinst_LTLIBRARIES = libcdi.la
+AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS)
 libcdi_la_SOURCES = \
 	basetime.c     	 \
 	basetime.h	 \
@@ -374,9 +397,10 @@ libcdi_la_SOURCES = \
 	model.h        	 \
 	namespace.c      \
 	namespace.h      \
+	serialize.h	\
+	serialize.c	\
 	pio.c            \
 	pio.h            \
-	pio_c_temp.h     \
 	pio_comm.c       \
 	pio_comm.h       \
 	pio_dbuffer.c    \
@@ -389,12 +413,19 @@ libcdi_la_SOURCES = \
 	pio_posixfpguardsendrecv.c \
 	pio_posixnonb.c  \
 	pio_list_set.c	 \
-	pio_rpc.c        \
+	resource_unpack.h \
+	resource_unpack.c \
 	pio_rpc.h        \
+	pio_client.c	\
+	pio_client.h	\
 	pio_server.c     \
 	pio_server.h     \
 	pio_util.c       \
 	pio_util.h       \
+	pio_serialize.h	\
+	pio_serialize.c	\
+	pio_cdf_int.c	\
+	pio_cdf_int.h	\
 	resource_handle.c\
 	resource_handle.h\
 	service.h	 \
@@ -442,9 +473,18 @@ libcdi_la_SOURCES = \
         stream.c         \
         swap.c
 
+
+#libcdi_la_CPPFLAGS  = @CPPFLAGS@
+libcdi_la_LIBADD = $(PPM_CORE_LIBS) $(YAXT_LIBS)
+#
+#cdilib.c:
+#	$(top_srcdir)/src/make_cdilib $(top_srcdir)/src
+#
+#cdilib.o: cdilib.c
+#	$(COMPILE) -c $<
 LOCALTARGETS = $(am__append_1) $(am__append_2)
 #
-CLEANFILES = `ls *~` cdilib.c $(am__append_3) $(am__append_4)
+CLEANFILES = `ls *~` $(am__append_3) $(am__append_4)
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
 
@@ -567,6 +607,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/model.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/namespace.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_cdf_int.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_client.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_comm.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_dbuffer.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_interface.Plo at am__quote@
@@ -576,10 +618,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_posixfpguardsendrecv.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_posixnonb.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_record_send.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_rpc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_serialize.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_server.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_util.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/resource_handle.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/resource_unpack.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/serialize.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/servicelib.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stream.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stream_cdf.Plo at am__quote@
@@ -869,18 +913,9 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
 	uninstall-am uninstall-includeHEADERS uninstall-libLTLIBRARIES \
 	uninstall-local
 
-
-#libcdi_la_CPPFLAGS  = @CPPFLAGS@
-#libcdi_la_LIBADD    = @LDFLAGS@
-#
-cdilib.c:
-	$(top_srcdir)/src/make_cdilib $(top_srcdir)/src
-#
-cdilib.o: cdilib.c
-	$(COMPILE) -c $<
 #
-mo_cdi.f90:
-	ruby $(top_srcdir)/interfaces/f2003/bindGen.rb cdi.h $@
+mo_cdi.f90: $(top_srcdir)/src/cdi.h
+	ruby $(top_srcdir)/interfaces/f2003/bindGen.rb $(top_srcdir)/src/cdi.h $@
 #
 mo_cdi.o: mo_cdi.f90
 	$(FC) $(FCFLAGS) -c $(FCFLAGS_f90) $<
diff --git a/libcdi/src/cdf_int.c b/libcdi/src/cdf_int.c
index af8cddc..18d8cab 100644
--- a/libcdi/src/cdf_int.c
+++ b/libcdi/src/cdf_int.c
@@ -10,7 +10,7 @@
 #include "cdi.h"
 #include "cdi_int.h"
 #include "cdf_int.h"
-
+#include "namespace.h"
 
 extern int CDF_Fatal;
 extern int CDF_Verbose;
@@ -24,7 +24,6 @@ extern int CDF_Debug;
 
 static size_t ChunkSizeMin = MIN_BUF_SIZE;
 */
-
 void cdf_create(const char *path, int cmode, int *ncidp)
 {
   int status;
@@ -59,7 +58,9 @@ void cdf_create(const char *path, int cmode, int *ncidp)
 
   if ( cdiNcChunksizehint != CDI_UNDEFID ) chunksizehint = cdiNcChunksizehint;
 
-  status = nc__create(path, cmode, initialsz, &chunksizehint, ncidp);
+  cdi_nc__create_funcp my_nc__create =
+    (cdi_nc__create_funcp)namespaceSwitchGet(NSSWITCH_NC__CREATE).func;
+  status = my_nc__create(path, cmode, initialsz, &chunksizehint, ncidp);
 
   if ( CDF_Debug || status != NC_NOERR )
     Message("ncid = %d  mode = %d  file = %s", *ncidp, cmode, path);
@@ -102,6 +103,7 @@ int cdf_open(const char *path, int omode, int *ncidp)
       */
       if ( cdiNcChunksizehint != CDI_UNDEFID ) chunksizehint = cdiNcChunksizehint;
 
+      /* FIXME: parallel part missing */
       status = nc__open(path, omode, &chunksizehint, ncidp);
 
       if ( CDF_Debug ) Message("chunksizehint %d", chunksizehint);
@@ -236,11 +238,18 @@ void cdf_inq_dimlen(int ncid, int dimid, size_t * lengthp)
 
 
 void cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims,
-	    const int dimids[], int *varidp)
+                 const int dimids[], int *varidp)
 {
-  int status;
+  cdi_cdf_def_var_funcp my_cdf_def_var
+    = (cdi_cdf_def_var_funcp)namespaceSwitchGet(NSSWITCH_CDF_DEF_VAR).func;
+  my_cdf_def_var(ncid, name, xtype, ndims, dimids, varidp);
+}
 
-  status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp);
+void
+cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
+                   const int dimids[], int *varidp)
+{
+  int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp);
 
   if ( CDF_Debug || status != NC_NOERR )
     Message("ncid = %d  name = %s  xtype = %d  ndims = %d  varid = %d",
@@ -250,6 +259,7 @@ void cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims,
 }
 
 
+
 void cdf_inq_varid(int ncid, const char *name, int *varidp)
 {
   int status;
diff --git a/libcdi/src/cdf_int.h b/libcdi/src/cdf_int.h
index 2937209..fa29c29 100644
--- a/libcdi/src/cdf_int.h
+++ b/libcdi/src/cdf_int.h
@@ -3,10 +3,7 @@
 
 #if  defined  (HAVE_LIBNETCDF)
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
+#include <stdlib.h>
 #include "netcdf.h"
 
 void cdf_create (const char *path, int cmode, int *idp);
@@ -26,6 +23,8 @@ void cdf_inq_dimname (int ncid, int dimid, char *name);
 void cdf_inq_dimlen (int ncid, int dimid, size_t * lengthp);
 void cdf_def_var (int ncid, const char *name, nc_type xtype, int ndims,
 		 const int dimids[], int *varidp);
+void cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
+                        const int dimids[], int *varidp);
 void cdf_inq_varid (int ncid, const char *name, int *varidp);
 void cdf_inq_nvars (int ncid, int *nvarsp);
 void cdf_inq_var (int ncid, int varid, char *name, nc_type *xtypep,
@@ -91,6 +90,14 @@ void cdf_inq_attlen (int ncid, int varid, const char *name, size_t *lenp);
 void cdf_inq_attname (int ncid, int varid, int attnum, char *name);
 void cdf_inq_attid (int ncid, int varid, const char *name, int *attnump);
 
+typedef int (*cdi_nc__create_funcp)(const char *path, int cmode,
+                                    size_t initialsz, size_t *chunksizehintp,
+                                    int *ncidp);
+
+typedef void (*cdi_cdf_def_var_funcp)(int ncid, const char *name,
+                                      nc_type xtype, int ndims,
+                                      const int dimids[], int *varidp);
+
 #endif
 
 #endif  /* _CDF_INT_H */
diff --git a/libcdi/src/cdi.h b/libcdi/src/cdi.h
index edb3132..41a221a 100644
--- a/libcdi/src/cdi.h
+++ b/libcdi/src/cdi.h
@@ -106,65 +106,69 @@ extern "C" {
 #define  DATATYPE_UINT32        332
 
 /* internal data types */
-
 #define  DATATYPE_INT           251
 #define  DATATYPE_FLT           252
 #define  DATATYPE_TXT           253
 #define  DATATYPE_CPX           254
+#define  DATATYPE_UCHAR         255
 
 /* Chunks */
 
-#define  CHUNK_AUTO               1  /* use default chunk size                  */
-#define  CHUNK_GRID               2
-#define  CHUNK_LINES              3
+#define  CHUNK_AUTO                 1  /* use default chunk size                                */
+#define  CHUNK_GRID                 2
+#define  CHUNK_LINES                3
 
 /* GRID types */
 
-#define  GRID_GENERIC             1  /* Generic grid                            */
-#define  GRID_GAUSSIAN            2  /* Regular Gaussian lon/lat grid           */
-#define  GRID_GAUSSIAN_REDUCED    3  /* Reduced Gaussian lon/lat grid           */
-#define  GRID_LONLAT              4  /* Regular longitude/latitude grid         */
-#define  GRID_SPECTRAL            5  /* Spherical harmonic coefficients         */
-#define  GRID_FOURIER             6  /* Fourier coefficients                    */
-#define  GRID_GME                 7  /* Icosahedral-hexagonal GME grid          */
-#define  GRID_TRAJECTORY          8  /* Trajectory                              */
-#define  GRID_UNSTRUCTURED        9  /* General unstructured grid               */
-#define  GRID_CURVILINEAR        10  /* Curvilinear grid                        */
-#define  GRID_LCC                11  /* Lambert Conformal Conic (GRIB)          */
-#define  GRID_LCC2               12  /* Lambert Conformal Conic (PROJ)          */
-#define  GRID_LAEA               13  /* Lambert Azimuthal Equal Area            */
-#define  GRID_SINUSOIDAL         14  /* Sinusoidal                              */
-#define  GRID_REFERENCE          15  /* Grid reference number                   */
-#define  GRID_PROJECTION         16  /* Projected coordiantes                   */
+#define  GRID_GENERIC               1  /* Generic grid                                          */
+#define  GRID_GAUSSIAN              2  /* Regular Gaussian lon/lat grid                         */
+#define  GRID_GAUSSIAN_REDUCED      3  /* Reduced Gaussian lon/lat grid                         */
+#define  GRID_LONLAT                4  /* Regular longitude/latitude grid                       */
+#define  GRID_SPECTRAL              5  /* Spherical harmonic coefficients                       */
+#define  GRID_FOURIER               6  /* Fourier coefficients                                  */
+#define  GRID_GME                   7  /* Icosahedral-hexagonal GME grid                        */
+#define  GRID_TRAJECTORY            8  /* Trajectory                                            */
+#define  GRID_UNSTRUCTURED          9  /* General unstructured grid                             */
+#define  GRID_CURVILINEAR          10  /* Curvilinear grid                                      */
+#define  GRID_LCC                  11  /* Lambert Conformal Conic (GRIB)                        */
+#define  GRID_LCC2                 12  /* Lambert Conformal Conic (PROJ)                        */
+#define  GRID_LAEA                 13  /* Lambert Azimuthal Equal Area                          */
+#define  GRID_SINUSOIDAL           14  /* Sinusoidal                                            */
+#define  GRID_PROJECTION           15  /* Projected coordiantes                                 */
 
 /* ZAXIS types */
 
-#define  ZAXIS_SURFACE            0  /* Surface level                           */
-#define  ZAXIS_GENERIC            1  /* Generic level                           */
-#define  ZAXIS_HYBRID             2  /* Hybrid level                            */
-#define  ZAXIS_HYBRID_HALF        3  /* Hybrid half level                       */
-#define  ZAXIS_PRESSURE           4  /* Isobaric pressure level in Pascal       */
-#define  ZAXIS_HEIGHT             5  /* Height above ground in meters           */
-#define  ZAXIS_DEPTH_BELOW_SEA    6  /* Depth below sea level in meters         */
-#define  ZAXIS_DEPTH_BELOW_LAND   7  /* Depth below land surface in centimeters */
-#define  ZAXIS_ISENTROPIC         8  /* Isentropic                              */
-#define  ZAXIS_TRAJECTORY         9  /* Trajectory                              */
-#define  ZAXIS_ALTITUDE          10  /* Altitude above mean sea level in meters */
-#define  ZAXIS_SIGMA             11  /* Sigma level                             */
-#define  ZAXIS_MEANSEA           12  /* Mean sea level                          */
-#define  ZAXIS_TOA               13  /* Norminal top of atmosphere              */
-#define  ZAXIS_SEA_BOTTOM        14  /* Sea bottom                              */
-#define  ZAXIS_ATMOSPHERE        15  /* Entire atmosphere                       */
-#define  ZAXIS_CLOUD_BASE        16  /* Cloud base level                        */
-#define  ZAXIS_CLOUD_TOP         17  /* Level of cloud tops                     */
-#define  ZAXIS_ISOTHERM_ZERO     18  /* Level of 0o C isotherm                  */
-#define  ZAXIS_SNOW              19  /* Snow level                              */
-#define  ZAXIS_REFERENCE         20  /* zaxis reference number                  */
+#define  ZAXIS_SURFACE              0  /* Surface level                                         */
+#define  ZAXIS_GENERIC              1  /* Generic level                                         */
+#define  ZAXIS_HYBRID               2  /* Hybrid level                                          */
+#define  ZAXIS_HYBRID_HALF          3  /* Hybrid half level                                     */
+#define  ZAXIS_PRESSURE             4  /* Isobaric pressure level in Pascal                     */
+#define  ZAXIS_HEIGHT               5  /* Height above ground in meters                         */
+#define  ZAXIS_DEPTH_BELOW_SEA      6  /* Depth below sea level in meters                       */
+#define  ZAXIS_DEPTH_BELOW_LAND     7  /* Depth below land surface in centimeters               */
+#define  ZAXIS_ISENTROPIC           8  /* Isentropic                                            */
+#define  ZAXIS_TRAJECTORY           9  /* Trajectory                                            */
+#define  ZAXIS_ALTITUDE            10  /* Altitude above mean sea level in meters               */
+#define  ZAXIS_SIGMA               11  /* Sigma level                                           */
+#define  ZAXIS_MEANSEA             12  /* Mean sea level                                        */
+#define  ZAXIS_TOA                 13  /* Norminal top of atmosphere                            */
+#define  ZAXIS_SEA_BOTTOM          14  /* Sea bottom                                            */
+#define  ZAXIS_ATMOSPHERE          15  /* Entire atmosphere                                     */
+#define  ZAXIS_CLOUD_BASE          16  /* Cloud base level                                      */
+#define  ZAXIS_CLOUD_TOP           17  /* Level of cloud tops                                   */
+#define  ZAXIS_ISOTHERM_ZERO       18  /* Level of 0o C isotherm                                */
+#define  ZAXIS_SNOW                19  /* Snow level                                            */
+#define  ZAXIS_LAKE_BOTTOM         20  /* Lake or River Bottom                                  */
+#define  ZAXIS_SEDIMENT_BOTTOM     21  /* Bottom Of Sediment Layer                              */
+#define  ZAXIS_SEDIMENT_BOTTOM_TA  22  /* Bottom Of Thermally Active Sediment Layer             */
+#define  ZAXIS_SEDIMENT_BOTTOM_TW  23  /* Bottom Of Sediment Layer Penetrated By Thermal Wave   */
+#define  ZAXIS_MIX_LAYER           24  /* Mixing Layer                                          */
+#define  ZAXIS_REFERENCE           25  /* zaxis reference number                                */
 
 /* TIME types */
 
-#define  TIME_CONSTANT            0  /* obsolate, use TSTEP_CONSTANT            */
-#define  TIME_VARIABLE            1  /* obsolate, use TSTEP_INSTANT             */
+#define  TIME_CONSTANT              0  /* obsolate, use TSTEP_CONSTANT                          */
+#define  TIME_VARIABLE              1  /* obsolate, use TSTEP_INSTANT                           */
 
 /* TSTEP types */
 
@@ -223,15 +227,25 @@ extern "C" {
 #define  PIO_MINIOMODEWITHSPECIALPROCS  PIO_WRITER
 
 /* parallel IO routines */
+#ifdef MPI_VERSION
+#  include <yaxt.h>
+#endif
 
+#ifdef MPI_VERSION /* make_fint keep */
 void     pioEndDef             ( void );
 void     pioEndTimestepping    ( void );
 void     pioFinalize           ( void );
-int      pioInit               ( int, int, int, int, int * );
-int      pioInqVarDecoChunk    ( int, int );
-int      pioInqVarDecoOff      ( int, int );
+/*      pioInit: initialize I/O server processes and communication */
+MPI_Comm pioInit(MPI_Comm commSuper, int nProcsIO, int IOMode,
+                 int *pioNamespace, float partInflate);
+void     pioWriteTimestep();
+
+void     streamWriteVarPart    (int streamID, int varID,
+                                const void *data, int nmiss,
+                                Xt_idxlist partDesc);
+
+#endif /* make_fint keep */
 void     pioNamespaceSetActive ( int );
-void     pioWriteTimestep      ( int, int, int );
 
 /* CDI control routines */
 
@@ -342,6 +356,9 @@ void    streamReadVarSlice(int streamID, int varID, int levelID, double *data_ve
 void    streamWriteVarSlice(int streamID, int varID, int levelID, const double *data_vec, int nmiss);
 void    streamWriteVarSliceF(int streamID, int varID, int levelID, const float *data_vec, int nmiss);
 
+void    streamWriteVarChunk(int streamID, int varID, const int rect[][2],
+                            const double *data_vec, int nmiss);
+
 
 /* STREAM record I/O routines */
 
@@ -522,6 +539,9 @@ int     vlistInqVarTimave(int vlistID, int varID);
 void    vlistDefVarTimaccu(int vlistID, int varID, int timaccu);
 int     vlistInqVarTimaccu(int vlistID, int varID);
 
+void    vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGeneratingProcess);
+int     vlistInqVarTypeOfGeneratingProcess(int vlistID, int varID);
+
 int     vlistInqVarSize(int vlistID, int varID);
 
 void    vlistDefIndex(int vlistID, int varID, int levID, int index);
@@ -715,16 +735,32 @@ void    gridDefGMEni2(int gridID, int ni2);
 int     gridInqGMEni3(int gridID);
 void    gridDefGMEni3(int gridID, int ni3);
 
-/* Reference grid */
-int     gridInqNumber(int gridID);
+/* Reference of an unstructured grid */
+
+/*      gridDefNumber: Define the reference number for an unstructured grid */
 void    gridDefNumber(int gridID, int number);
-int     gridInqPosition(int gridID);
+
+/*      gridInqNumber: Get the reference number to an unstructured grid */
+int     gridInqNumber(int gridID);
+
+/*      gridDefPosition: Define the position of grid in the reference file */
 void    gridDefPosition(int gridID, int position);
-int     gridInqReference(int gridID, char *reference);
+
+/*      gridInqPosition: Get the position of grid in the reference file */
+int     gridInqPosition(int gridID);
+
+/*      gridDefReference: Define the reference URI for an unstructured grid */
 void    gridDefReference(int gridID, const char *reference);
-char   *gridInqUUID(int gridID, char *uuid_cbuf);
+
+/*      gridInqReference: Get the reference URI to an unstructured grid */
+int     gridInqReference(int gridID, char *reference);
+
+/*      gridDefUUID: Define the UUID of an unstructured grid */
 void    gridDefUUID(int gridID, const char *uuid_cbuf);
 
+/*      gridInqUUID: Get the UUID of an unstructured grid */
+char   *gridInqUUID(int gridID, char *uuid_cbuf);
+
 
 /* Lambert Conformal Conic grid (GRIB version) */
 void gridDefLCC(int gridID, double originLon, double originLat, double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag);
@@ -803,18 +839,24 @@ void    zaxisDefLevel(int zaxisID, int levelID, double levels);
 /*      zaxisInqLevel: Get one level of a Z-axis */
 double  zaxisInqLevel(int zaxisID, int levelID);
 
-/*      zaxisDefReference: Define the reference of a generalized Z-axis */
-void    zaxisDefReference(int zaxisID, int refID);
+/*      zaxisDefNlevRef: Define the number of half levels of a generalized Z-axis */
+void    zaxisDefNlevRef(int gridID, int nhlev);
+
+/*      zaxisInqNlevRef: Get the number of half levels of a generalized Z-axis */
+int     zaxisInqNlevRef(int gridID);
 
-/*      zaxisDefUUID: Define the uuid of a generalized Z-axis */
+/*      zaxisDefNumber: Define the reference number for a generalized Z-axis */
+void    zaxisDefNumber(int gridID, int number);
+
+/*      zaxisInqNumber: Get the reference number to a generalized Z-axis */
+int     zaxisInqNumber(int gridID);
+
+/*      zaxisDefUUID: Define the UUID of a generalized Z-axis */
 void    zaxisDefUUID(int zaxisID, const char *uuid_cbuf);
 
-/*      zaxisInqUUID: Get the reference of a generalized Z-axis */
+/*      zaxisInqUUID: Get the UUID of a generalized Z-axis */
 char   *zaxisInqUUID(int zaxisID, char *uuid_cbuf);
 
-/*      zaxisInqReference: Get the reference of a generalized Z-axis */
-int     zaxisInqReference(int zaxisID);
-
 /*      zaxisDefName: Define the name of a Z-axis */
 void    zaxisDefName(int zaxisID, const char *name);
 
@@ -839,6 +881,7 @@ void    zaxisInqUnits(int zaxisID, char *units);
 void    zaxisDefPrec(int zaxisID, int prec);
 int     zaxisInqPrec(int zaxisID);
 
+void    zaxisDefPositive(int zaxisID, int positive);
 int     zaxisInqPositive(int zaxisID);
 
 void    zaxisDefLtype(int zaxisID, int ltype);
diff --git a/libcdi/src/cdi.inc b/libcdi/src/cdi.inc
index 803cc92..169089e 100644
--- a/libcdi/src/cdi.inc
+++ b/libcdi/src/cdi.inc
@@ -1,10 +1,10 @@
 ! This file was automatically generated, don't edit!
 !
-! Fortran interface for CDI library version 1.6.1
+! Fortran interface for CDI library version 1.6.2
 !
 ! Author:
 ! -------
-! Uwe Schulzweida, MPI-MET, Hamburg,   June 2013
+! Uwe Schulzweida, MPI-MET, Hamburg,   November 2013
 !
 
       INTEGER    CDI_MAX_NAME          
@@ -181,6 +181,8 @@
       PARAMETER (DATATYPE_TXT           = 253)
       INTEGER    DATATYPE_CPX          
       PARAMETER (DATATYPE_CPX           = 254)
+      INTEGER    DATATYPE_UCHAR        
+      PARAMETER (DATATYPE_UCHAR         = 255)
 !
 !  Chunks
 !
@@ -221,10 +223,8 @@
       PARAMETER (GRID_LAEA              = 13)
       INTEGER    GRID_SINUSOIDAL       
       PARAMETER (GRID_SINUSOIDAL        = 14)
-      INTEGER    GRID_REFERENCE        
-      PARAMETER (GRID_REFERENCE         = 15)
       INTEGER    GRID_PROJECTION       
-      PARAMETER (GRID_PROJECTION        = 16)
+      PARAMETER (GRID_PROJECTION        = 15)
 !
 !  ZAXIS types
 !
@@ -268,8 +268,18 @@
       PARAMETER (ZAXIS_ISOTHERM_ZERO    = 18)
       INTEGER    ZAXIS_SNOW            
       PARAMETER (ZAXIS_SNOW             = 19)
+      INTEGER    ZAXIS_LAKE_BOTTOM     
+      PARAMETER (ZAXIS_LAKE_BOTTOM      = 20)
+      INTEGER    ZAXIS_SEDIMENT_BOTTOM 
+      PARAMETER (ZAXIS_SEDIMENT_BOTTOM  = 21)
+      INTEGER    ZAXIS_SEDIMENT_BOTTOM_TA
+      PARAMETER (ZAXIS_SEDIMENT_BOTTOM_TA = 22)
+      INTEGER    ZAXIS_SEDIMENT_BOTTOM_TW
+      PARAMETER (ZAXIS_SEDIMENT_BOTTOM_TW = 23)
+      INTEGER    ZAXIS_MIX_LAYER       
+      PARAMETER (ZAXIS_MIX_LAYER        = 24)
       INTEGER    ZAXIS_REFERENCE       
-      PARAMETER (ZAXIS_REFERENCE        = 20)
+      PARAMETER (ZAXIS_REFERENCE        = 25)
 !
 !  TIME types
 !
@@ -379,33 +389,28 @@
       EXTERNAL        pioFinalize
 
       INTEGER         pioInit
-!                                    (INTEGER         ,
-!                                     INTEGER         ,
-!                                     INTEGER         ,
-!                                     INTEGER         ,
-!                                     INTEGER         )
+!                                    (INTEGER         commSuper,
+!                                     INTEGER         nProcsIO,
+!                                     INTEGER         IOMode,
+!                                     INTEGER         pioNamespace,
+!                                     REAL            partInflate)
       EXTERNAL        pioInit
 
-      INTEGER         pioInqVarDecoChunk
-!                                    (INTEGER         ,
-!                                     INTEGER         )
-      EXTERNAL        pioInqVarDecoChunk
+!                     pioWriteTimestep
+      EXTERNAL        pioWriteTimestep
 
-      INTEGER         pioInqVarDecoOff
-!                                    (INTEGER         ,
-!                                     INTEGER         )
-      EXTERNAL        pioInqVarDecoOff
+!                     streamWriteVarPart
+!                                    (INTEGER         streamID,
+!                                     INTEGER         varID,
+!                                     CHOICE          data,
+!                                     INTEGER         nmiss,
+!                                     TYPE(XT_IDXLIST)partDesc)
+      EXTERNAL        streamWriteVarPart
 
 !                     pioNamespaceSetActive
 !                                    (INTEGER         )
       EXTERNAL        pioNamespaceSetActive
 
-!                     pioWriteTimestep
-!                                    (INTEGER         ,
-!                                     INTEGER         ,
-!                                     INTEGER         )
-      EXTERNAL        pioWriteTimestep
-
 !
 !  CDI control routines
 !
@@ -641,6 +646,14 @@
 !                                     INTEGER         nmiss)
       EXTERNAL        streamWriteVarSliceF
 
+!                     streamWriteVarChunk
+!                                    (INTEGER         streamID,
+!                                     INTEGER         varID,
+!                                     INTEGER         rect,
+!                                     DOUBLEPRECISION data_vec,
+!                                     INTEGER         nmiss)
+      EXTERNAL        streamWriteVarChunk
+
 !
 !  STREAM record I/O routines
 !
@@ -1129,6 +1142,17 @@
 !                                     INTEGER         varID)
       EXTERNAL        vlistInqVarTimaccu
 
+!                     vlistDefVarTypeOfGeneratingProcess
+!                                    (INTEGER         vlistID,
+!                                     INTEGER         varID,
+!                                     INTEGER         typeOfGeneratingProcess)
+      EXTERNAL        vlistDefVarTypeOfGeneratingProcess
+
+      INTEGER         vlistInqVarTypeOfGeneratingProcess
+!                                    (INTEGER         vlistID,
+!                                     INTEGER         varID)
+      EXTERNAL        vlistInqVarTypeOfGeneratingProcess
+
       INTEGER         vlistInqVarSize
 !                                    (INTEGER         vlistID,
 !                                     INTEGER         varID)
@@ -1201,6 +1225,9 @@
 !                                     INTEGER         forecast_type)
       EXTERNAL        vlistInqVarEnsemble
 
+!                     cdiClearAdditionalKeys
+      EXTERNAL        cdiClearAdditionalKeys
+
 !                     cdiDefAdditionalKey
 !                                    (CHARACTER*(*)   string)
       EXTERNAL        cdiDefAdditionalKey
@@ -1601,46 +1628,46 @@
       EXTERNAL        gridDefGMEni3
 
 !
-!  Reference grid
+!  Reference of an unstructured grid
 !
-      INTEGER         gridInqNumber
-!                                    (INTEGER         gridID)
-      EXTERNAL        gridInqNumber
-
 !                     gridDefNumber
 !                                    (INTEGER         gridID,
 !                                     INTEGER         number)
       EXTERNAL        gridDefNumber
 
-      INTEGER         gridInqPosition
+      INTEGER         gridInqNumber
 !                                    (INTEGER         gridID)
-      EXTERNAL        gridInqPosition
+      EXTERNAL        gridInqNumber
 
 !                     gridDefPosition
 !                                    (INTEGER         gridID,
 !                                     INTEGER         position)
       EXTERNAL        gridDefPosition
 
-      INTEGER         gridInqReference
-!                                    (INTEGER         gridID,
-!                                     CHARACTER*(*)   reference)
-      EXTERNAL        gridInqReference
+      INTEGER         gridInqPosition
+!                                    (INTEGER         gridID)
+      EXTERNAL        gridInqPosition
 
 !                     gridDefReference
 !                                    (INTEGER         gridID,
 !                                     CHARACTER*(*)   reference)
       EXTERNAL        gridDefReference
 
-      CHARACTER(80)   gridInqUUID
+      INTEGER         gridInqReference
 !                                    (INTEGER         gridID,
-!                                     CHARACTER*(*)   uuid_cbuf)
-      EXTERNAL        gridInqUUID
+!                                     CHARACTER*(*)   reference)
+      EXTERNAL        gridInqReference
 
 !                     gridDefUUID
 !                                    (INTEGER         gridID,
 !                                     CHARACTER*(*)   uuid_cbuf)
       EXTERNAL        gridDefUUID
 
+      CHARACTER(80)   gridInqUUID
+!                                    (INTEGER         gridID,
+!                                     CHARACTER*(*)   uuid_cbuf)
+      EXTERNAL        gridInqUUID
+
 !
 !  Lambert Conformal Conic grid (GRIB version)
 !
@@ -1835,10 +1862,23 @@
 !                                     INTEGER         levelID)
       EXTERNAL        zaxisInqLevel
 
-!                     zaxisDefReference
-!                                    (INTEGER         zaxisID,
-!                                     INTEGER         refID)
-      EXTERNAL        zaxisDefReference
+!                     zaxisDefNlevRef
+!                                    (INTEGER         gridID,
+!                                     INTEGER         nhlev)
+      EXTERNAL        zaxisDefNlevRef
+
+      INTEGER         zaxisInqNlevRef
+!                                    (INTEGER         gridID)
+      EXTERNAL        zaxisInqNlevRef
+
+!                     zaxisDefNumber
+!                                    (INTEGER         gridID,
+!                                     INTEGER         number)
+      EXTERNAL        zaxisDefNumber
+
+      INTEGER         zaxisInqNumber
+!                                    (INTEGER         gridID)
+      EXTERNAL        zaxisInqNumber
 
 !                     zaxisDefUUID
 !                                    (INTEGER         zaxisID,
@@ -1850,10 +1890,6 @@
 !                                     CHARACTER*(*)   uuid_cbuf)
       EXTERNAL        zaxisInqUUID
 
-      INTEGER         zaxisInqReference
-!                                    (INTEGER         zaxisID)
-      EXTERNAL        zaxisInqReference
-
 !                     zaxisDefName
 !                                    (INTEGER         zaxisID,
 !                                     CHARACTER*(*)   name)
@@ -1898,6 +1934,11 @@
 !                                    (INTEGER         zaxisID)
       EXTERNAL        zaxisInqPrec
 
+!                     zaxisDefPositive
+!                                    (INTEGER         zaxisID,
+!                                     INTEGER         positive)
+      EXTERNAL        zaxisDefPositive
+
       INTEGER         zaxisInqPositive
 !                                    (INTEGER         zaxisID)
       EXTERNAL        zaxisInqPositive
diff --git a/libcdi/src/cdiFortran.c b/libcdi/src/cdiFortran.c
index 9ec4949..6d11efa 100644
--- a/libcdi/src/cdiFortran.c
+++ b/libcdi/src/cdiFortran.c
@@ -4,6 +4,15 @@
 #  include "config.h"
 #endif
 
+#if USE_MPI
+#  include <mpi.h>
+#  include <yaxt.h>
+#else
+#define MPI_Comm int
+#define MPI_Comm_f2c(c) (c)
+#define MPI_Comm_c2f(c) (c)
+#endif
+
 #if ! defined (_CDI_H)
 #  include "cdi.h"
 #endif
@@ -66,14 +75,25 @@
 
 /*  parallel IO routines  */
 
+#ifdef MPI_VERSION /* make_fint keep */
 FCALLSCSUB0 (pioEndDef, PIOENDDEF, pioenddef)
 FCALLSCSUB0 (pioEndTimestepping, PIOENDTIMESTEPPING, pioendtimestepping)
 FCALLSCSUB0 (pioFinalize, PIOFINALIZE, piofinalize)
-FCALLSCFUN5 (INT, pioInit, PIOINIT, pioinit, INT, INT, INT, INT, PINT)
-FCALLSCFUN2 (INT, pioInqVarDecoChunk, PIOINQVARDECOCHUNK, pioinqvardecochunk, INT, INT)
-FCALLSCFUN2 (INT, pioInqVarDecoOff, PIOINQVARDECOOFF, pioinqvardecooff, INT, INT)
+static int pioInit_fwrap(int commSuper, int nProcsIO, int IOMode, int * pioNamespace, float partInflate)
+{
+  MPI_Comm v;
+  v = pioInit(MPI_Comm_f2c(commSuper),  nProcsIO,  IOMode,  pioNamespace,  partInflate);
+  return MPI_Comm_c2f(v);
+}
+FCALLSCFUN5 (INT, pioInit_fwrap, PIOINIT, pioinit, INT, INT, INT, PINT, FLOAT)
+FCALLSCSUB0 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep)
+static void streamWriteVarPart_fwrap(int streamID, int varID, const void * data, int nmiss, void * partDesc)
+{
+  streamWriteVarPart( streamID,  varID,  data,  nmiss, (*(Xt_idxlist *)partDesc));
+}
+FCALLSCSUB5 (streamWriteVarPart_fwrap, STREAMWRITEVARPART, streamwritevarpart, INT, INT, PVOID, INT, PVOID)
+#endif /* make_fint keep */
 FCALLSCSUB1 (pioNamespaceSetActive, PIONAMESPACESETACTIVE, pionamespacesetactive, INT)
-FCALLSCSUB3 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep, INT, INT, INT)
 
 /*  CDI control routines  */
 
@@ -138,6 +158,7 @@ FCALLSCSUB4 (streamWriteVarF, STREAMWRITEVARF, streamwritevarf, INT, INT, PFLOAT
 FCALLSCSUB5 (streamReadVarSlice, STREAMREADVARSLICE, streamreadvarslice, INT, INT, INT, PDOUBLE, PINT)
 FCALLSCSUB5 (streamWriteVarSlice, STREAMWRITEVARSLICE, streamwritevarslice, INT, INT, INT, PDOUBLE, INT)
 FCALLSCSUB5 (streamWriteVarSliceF, STREAMWRITEVARSLICEF, streamwritevarslicef, INT, INT, INT, PFLOAT, INT)
+FCALLSCSUB5 (streamWriteVarChunk, STREAMWRITEVARCHUNK, streamwritevarchunk, INT, INT, INTVV, PDOUBLE, INT)
 
 /*  STREAM record I/O routines  */
 
@@ -240,6 +261,8 @@ FCALLSCSUB3 (vlistDefVarTimave, VLISTDEFVARTIMAVE, vlistdefvartimave, INT, INT,
 FCALLSCFUN2 (INT, vlistInqVarTimave, VLISTINQVARTIMAVE, vlistinqvartimave, INT, INT)
 FCALLSCSUB3 (vlistDefVarTimaccu, VLISTDEFVARTIMACCU, vlistdefvartimaccu, INT, INT, INT)
 FCALLSCFUN2 (INT, vlistInqVarTimaccu, VLISTINQVARTIMACCU, vlistinqvartimaccu, INT, INT)
+FCALLSCSUB3 (vlistDefVarTypeOfGeneratingProcess, VLISTDEFVARTYPEOFGENERATINGPROCESS, vlistdefvartypeofgeneratingprocess, INT, INT, INT)
+FCALLSCFUN2 (INT, vlistInqVarTypeOfGeneratingProcess, VLISTINQVARTYPEOFGENERATINGPROCESS, vlistinqvartypeofgeneratingprocess, INT, INT)
 FCALLSCFUN2 (INT, vlistInqVarSize, VLISTINQVARSIZE, vlistinqvarsize, INT, INT)
 FCALLSCSUB4 (vlistDefIndex, VLISTDEFINDEX, vlistdefindex, INT, INT, INT, INT)
 FCALLSCFUN3 (INT, vlistInqIndex, VLISTINQINDEX, vlistinqindex, INT, INT, INT)
@@ -254,6 +277,7 @@ FCALLSCFUN3 (INT, vlistMergedLevel, VLISTMERGEDLEVEL, vlistmergedlevel, INT, INT
 
 FCALLSCSUB5 (vlistDefVarEnsemble, VLISTDEFVARENSEMBLE, vlistdefvarensemble, INT, INT, INT, INT, INT)
 FCALLSCFUN5 (INT, vlistInqVarEnsemble, VLISTINQVARENSEMBLE, vlistinqvarensemble, INT, INT, PINT, PINT, PINT)
+FCALLSCSUB0 (cdiClearAdditionalKeys, CDICLEARADDITIONALKEYS, cdiclearadditionalkeys)
 FCALLSCSUB1 (cdiDefAdditionalKey, CDIDEFADDITIONALKEY, cdidefadditionalkey, STRING)
 FCALLSCSUB4 (vlistDefVarIntKey, VLISTDEFVARINTKEY, vlistdefvarintkey, INT, INT, STRING, INT)
 FCALLSCSUB4 (vlistDefVarDblKey, VLISTDEFVARDBLKEY, vlistdefvardblkey, INT, INT, STRING, DOUBLE)
@@ -340,16 +364,16 @@ FCALLSCSUB2 (gridDefGMEni2, GRIDDEFGMENI2, griddefgmeni2, INT, INT)
 FCALLSCFUN1 (INT, gridInqGMEni3, GRIDINQGMENI3, gridinqgmeni3, INT)
 FCALLSCSUB2 (gridDefGMEni3, GRIDDEFGMENI3, griddefgmeni3, INT, INT)
 
-/*  Reference grid  */
+/*  Reference of an unstructured grid  */
 
-FCALLSCFUN1 (INT, gridInqNumber, GRIDINQNUMBER, gridinqnumber, INT)
 FCALLSCSUB2 (gridDefNumber, GRIDDEFNUMBER, griddefnumber, INT, INT)
-FCALLSCFUN1 (INT, gridInqPosition, GRIDINQPOSITION, gridinqposition, INT)
+FCALLSCFUN1 (INT, gridInqNumber, GRIDINQNUMBER, gridinqnumber, INT)
 FCALLSCSUB2 (gridDefPosition, GRIDDEFPOSITION, griddefposition, INT, INT)
-FCALLSCFUN2 (INT, gridInqReference, GRIDINQREFERENCE, gridinqreference, INT, PSTRING)
+FCALLSCFUN1 (INT, gridInqPosition, GRIDINQPOSITION, gridinqposition, INT)
 FCALLSCSUB2 (gridDefReference, GRIDDEFREFERENCE, griddefreference, INT, STRING)
-FCALLSCFUN2 (STRING, gridInqUUID, GRIDINQUUID, gridinquuid, INT, CBUF)
+FCALLSCFUN2 (INT, gridInqReference, GRIDINQREFERENCE, gridinqreference, INT, PSTRING)
 FCALLSCSUB2 (gridDefUUID, GRIDDEFUUID, griddefuuid, INT, CBUF)
+FCALLSCFUN2 (STRING, gridInqUUID, GRIDINQUUID, gridinquuid, INT, CBUF)
 
 /*  Lambert Conformal Conic grid (GRIB version)  */
 
@@ -394,10 +418,12 @@ FCALLSCSUB2 (zaxisDefLevels, ZAXISDEFLEVELS, zaxisdeflevels, INT, PDOUBLE)
 FCALLSCSUB2 (zaxisInqLevels, ZAXISINQLEVELS, zaxisinqlevels, INT, PDOUBLE)
 FCALLSCSUB3 (zaxisDefLevel, ZAXISDEFLEVEL, zaxisdeflevel, INT, INT, DOUBLE)
 FCALLSCFUN2 (DOUBLE, zaxisInqLevel, ZAXISINQLEVEL, zaxisinqlevel, INT, INT)
-FCALLSCSUB2 (zaxisDefReference, ZAXISDEFREFERENCE, zaxisdefreference, INT, INT)
+FCALLSCSUB2 (zaxisDefNlevRef, ZAXISDEFNLEVREF, zaxisdefnlevref, INT, INT)
+FCALLSCFUN1 (INT, zaxisInqNlevRef, ZAXISINQNLEVREF, zaxisinqnlevref, INT)
+FCALLSCSUB2 (zaxisDefNumber, ZAXISDEFNUMBER, zaxisdefnumber, INT, INT)
+FCALLSCFUN1 (INT, zaxisInqNumber, ZAXISINQNUMBER, zaxisinqnumber, INT)
 FCALLSCSUB2 (zaxisDefUUID, ZAXISDEFUUID, zaxisdefuuid, INT, CBUF)
 FCALLSCFUN2 (STRING, zaxisInqUUID, ZAXISINQUUID, zaxisinquuid, INT, CBUF)
-FCALLSCFUN1 (INT, zaxisInqReference, ZAXISINQREFERENCE, zaxisinqreference, INT)
 FCALLSCSUB2 (zaxisDefName, ZAXISDEFNAME, zaxisdefname, INT, STRING)
 FCALLSCSUB2 (zaxisDefLongname, ZAXISDEFLONGNAME, zaxisdeflongname, INT, STRING)
 FCALLSCSUB2 (zaxisDefUnits, ZAXISDEFUNITS, zaxisdefunits, INT, STRING)
@@ -407,6 +433,7 @@ FCALLSCSUB2 (zaxisInqStdname, ZAXISINQSTDNAME, zaxisinqstdname, INT, PSTRING)
 FCALLSCSUB2 (zaxisInqUnits, ZAXISINQUNITS, zaxisinqunits, INT, PSTRING)
 FCALLSCSUB2 (zaxisDefPrec, ZAXISDEFPREC, zaxisdefprec, INT, INT)
 FCALLSCFUN1 (INT, zaxisInqPrec, ZAXISINQPREC, zaxisinqprec, INT)
+FCALLSCSUB2 (zaxisDefPositive, ZAXISDEFPOSITIVE, zaxisdefpositive, INT, INT)
 FCALLSCFUN1 (INT, zaxisInqPositive, ZAXISINQPOSITIVE, zaxisinqpositive, INT)
 FCALLSCSUB2 (zaxisDefLtype, ZAXISDEFLTYPE, zaxisdefltype, INT, INT)
 FCALLSCFUN1 (INT, zaxisInqLtype, ZAXISINQLTYPE, zaxisinqltype, INT)
diff --git a/libcdi/src/cdi_int.c b/libcdi/src/cdi_int.c
index 4aebb8c..73ad427 100644
--- a/libcdi/src/cdi_int.c
+++ b/libcdi/src/cdi_int.c
@@ -13,15 +13,22 @@
 
 #include "cdi.h"
 #include "cdi_int.h"
+#include "gribapi.h"
+#ifdef HAVE_LIBNETCDF
+#include "stream_cdf.h"
+#endif
 #include "pio_util.h"
 #include "namespace.h"
+#include "serialize.h"
 #include "resource_handle.h"
-#include "pio_rpc.h"
+#include "resource_unpack.h"
 
 #if  defined  (HAVE_LIBCGRIBEX)
 #include "cgribex.h"
 #endif
 
+extern int cdiPioSerialOpenFileMap(int streamID);
+
 int cdiDefaultCalendar = CALENDAR_PROLEPTIC;
 
 int cdiDefaultInstID   = CDI_UNDEFID;
@@ -73,19 +80,14 @@ static int cdiHaveMissval = 0;
 static int    streamCompareP ( void * streamptr1, void * streamptr2 );
 static void   streamDestroyP ( void * streamptr );
 static void   streamPrintP   ( void * streamptr, FILE * fp );
-#ifdef USE_MPI
-static int    streamGetPackSize ( void * streamptr, MPI_Comm comm );
-static void   streamPack        ( void * streamptr, void * buff, int size,
-				  int * position, MPI_Comm comm );
+static int    streamGetPackSize ( void * streamptr, void *context);
+static void   streamPack        ( void * streamptr, void * buff, int size, int * position, void *context );
 static int    streamTxCode      ( void );
-#endif
 
 resOps streamOps = { streamCompareP, streamDestroyP, streamPrintP,
-#ifdef USE_MPI
                      streamGetPackSize,
 		     streamPack,
                      streamTxCode
-#endif
 };
 
 long cdiGetenvInt(char *envName)
@@ -564,19 +566,19 @@ int  streamCompareP ( void * streamptr1, void * streamptr2 )
   xassert ( s2 );
 
   if ( s1->filetype  != s2->filetype  ) return differ;
-  if (  namespaceAdaptKey2 ( s1->vlistIDorig ) != 			     
+  if (  namespaceAdaptKey2 ( s1->vlistIDorig ) !=
 	namespaceAdaptKey2 ( s2->vlistIDorig )) return differ;
   if ( s1->byteorder != s2->byteorder ) return differ;
   if ( s1->comptype  != s2->comptype  ) return differ;
-  if ( s1->complevel != s2->complevel ) return differ; 
+  if ( s1->complevel != s2->complevel ) return differ;
 
   if ( s1->filename )
     {
       len = strlen ( s1->filename ) + 1;
-      if ( memcmp ( s1->filename, s2->filename, len )) 
+      if ( memcmp ( s1->filename, s2->filename, len ))
 	return differ;
     }
-  else if ( s2->filename ) 
+  else if ( s2->filename )
     return differ;
 
   return equal;
@@ -659,10 +661,47 @@ void streamGetIndexList ( int nstreams, int * streamIndexList )
   reshGetResHListOfType ( nstreams, streamIndexList, &streamOps );
 }
 
+void
+cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig)
+{
+  int nvars = vlistNvars(vlistID);
+  streamptr->vlistID = vlistID;
+  streamptr->vlistIDorig = vlistIDorig;
+  for (int varID = 0; varID < nvars; varID++ )
+    {
+      int gridID  = vlistInqVarGrid(vlistID, varID);
+      int zaxisID = vlistInqVarZaxis(vlistID, varID);
+      stream_new_var(streamptr, gridID, zaxisID);
+      if ( streamptr->have_missval )
+        vlistDefVarMissval(vlistID, varID,
+                           vlistInqVarMissval(vlistID, varID));
+    }
+
+  if (streamptr->filemode == 'w' )
+    {
+      if ( streamptr->filetype == FILETYPE_NC  ||
+           streamptr->filetype == FILETYPE_NC2 ||
+           streamptr->filetype == FILETYPE_NC4 ||
+           streamptr->filetype == FILETYPE_NC4C )
+        {
+#ifdef HAVE_LIBNETCDF
+          void (*myCdfDefVars)(stream_t *streamptr)
+            = (void (*)(stream_t *))
+            namespaceSwitchGet(NSSWITCH_CDF_STREAM_SETUP).func;
+          myCdfDefVars(streamptr);
+#endif
+        }
+      else if ( streamptr->filetype == FILETYPE_GRB  ||
+                streamptr->filetype == FILETYPE_GRB2 )
+        {
+          gribContainersNew(streamptr);
+        }
+    }
+}
+
 
-#ifdef USE_MPI
 static int
-streamTxCode ( void )
+streamTxCode(void)
 {
   return STREAM;
 }
@@ -671,65 +710,85 @@ streamTxCode ( void )
 int streamNint = 11 ;
 
 
-static
-int streamGetPackSize ( void * voidP, MPI_Comm comm )
+static int
+streamGetPackSize(void * voidP, void *context)
 {
   stream_t * streamP = ( stream_t * ) voidP;
-  int packBufferSize = 0, size;
-
-  xmpi ( MPI_Pack_size ( streamNint, MPI_INT, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += 2 * size;
-
-
-  xmpi ( MPI_Pack_size (( int ) strlen ( streamP->filename ) + 1,
-			MPI_CHAR, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
-
+  int packBufferSize
+    = serializeGetSize(streamNint, DATATYPE_INT, context)
+    + serializeGetSize(2, DATATYPE_FLT64, context)
+    + serializeGetSize((int)strlen(streamP->filename) + 1,
+                       DATATYPE_TXT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
   return packBufferSize;
 }
 
 
-static
-void streamPack ( void * streamptr, void * packBuffer, int packBufferSize,
-                  int * packBufferPos, MPI_Comm comm )
+static void
+streamPack(void * streamptr, void * packBuffer, int packBufferSize,
+           int * packBufferPos, void *context)
 {
   stream_t * streamP = ( stream_t * ) streamptr;
-  int intBuffer[streamNint];  
+  int intBuffer[streamNint];
   double d;
 
   intBuffer[0]  = streamP->self;
   intBuffer[1]  = streamP->filetype;
-  intBuffer[2]  =  ( int ) strlen ( streamP->filename ) + 1;
+  intBuffer[2]  = (int)strlen(streamP->filename) + 1;
   intBuffer[3]  = streamP->vlistID;
   intBuffer[4]  = streamP->vlistIDorig;
   intBuffer[5]  = streamP->byteorder;
   intBuffer[6]  = streamP->comptype;
-  intBuffer[7]  = streamP->complevel; 
+  intBuffer[7]  = streamP->complevel;
   intBuffer[8]  = cdiDataUnreduced;
   intBuffer[9]  = cdiSortName;
   intBuffer[10] = cdiHaveMissval;
-  
-  xmpi ( MPI_Pack ( intBuffer, streamNint, MPI_INT, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT , streamNint, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-
-  xmpi ( MPI_Pack ( &cdiDefaultMissval, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-
-  xmpi ( MPI_Pack ( streamP->filename, intBuffer[2], MPI_CHAR, 
-		    packBuffer, packBufferSize, packBufferPos, comm )); 
-  d = xchecksum  ( DATATYPE_TXT, intBuffer[2], &streamP->filename );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
+
+  serializePack(intBuffer, streamNint, DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_INT, streamNint, intBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context);
+
+  serializePack(&cdiDefaultMissval, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context);
+  serializePack(streamP->filename, intBuffer[2], DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_TXT, intBuffer[2], &streamP->filename);
+  serializePack(&d, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context);
 }
 
-#endif
+struct streamAssoc
+streamUnpack(char * unpackBuffer, int unpackBufferSize,
+             int * unpackBufferPos, int nspTarget, void *context)
+{
+  int intBuffer[streamNint], streamID;
+  double d;
+  char filename[CDI_MAX_NAME];
+
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  intBuffer, streamNint, DATATYPE_INT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
+  xassert(xchecksum(DATATYPE_INT, streamNint, intBuffer ) == d);
+
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &cdiDefaultMissval, 1, DATATYPE_FLT64, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &filename, intBuffer[2], DATATYPE_TXT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
+  xassert(d == xchecksum(DATATYPE_TXT, intBuffer[2], filename));
+  streamID = streamOpenWrite ( filename, intBuffer[1] );
+  xassert ( streamID >= 0 &&
+            namespaceAdaptKey ( intBuffer[0], nspTarget ) == streamID );
+  streamDefByteorder(streamID, intBuffer[5]);
+  streamDefCompType(streamID, intBuffer[6]);
+  streamDefCompLevel(streamID, intBuffer[7]);
+  cdiDefGlobal("REGULARGRID", intBuffer[8]);
+  cdiDefGlobal("SORTNAME", intBuffer[9]);
+  cdiDefGlobal("HAVE_MISSVAL", intBuffer[10]);
+  struct streamAssoc retval = { streamID, intBuffer[3], intBuffer[4] };
+  return retval;
+}
+
+
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/cdi_int.h b/libcdi/src/cdi_int.h
index 69978eb..a41caab 100644
--- a/libcdi/src/cdi_int.h
+++ b/libcdi/src/cdi_int.h
@@ -251,7 +251,8 @@ typedef struct {
   void       *gribContainers;
 #endif
   int         vlistIDorig;
-
+  /* only used by MPI-parallelized version of library */
+  int       ownerRank;    // MPI rank of owner process
   /* ---------------------------------- */
   /* Local change: 2013-02-18, FP (DWD) */
   /* ---------------------------------- */
@@ -292,6 +293,7 @@ void    streamDefineTaxis(int streamID);
 
 int     streamsNewEntry(int filetype);
 void    streamsInitEntry(int streamID);
+void    cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig);
 int     stream_new_var(stream_t *streamptr, int gridID, int zaxisID);
 
 int     tstepsNewEntry(stream_t *streamptr);
@@ -340,6 +342,36 @@ void str2uuid(const char *uuidstr, char *uuid);
 #define CDI_UNIT_DM   5
 #define CDI_UNIT_M    6
 
+struct streamAssoc
+{
+  int streamID, vlistID, vlistIDorig;
+};
+
+struct streamAssoc
+streamUnpack(char * unpackBuffer, int unpackBufferSize,
+             int * unpackBufferPos, int nspTarget, void *context);
+
+int
+cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
+                             int filetype, stream_t *streamptr,
+                             int recordBufIsToBeCreated);
+
+void
+cdiStreamDefVlist_(int streamID, int vlistID);
+void
+cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
+                   int nmiss);
+void
+cdiStreamwriteVarChunk_(int streamID, int varID, int memtype,
+                        const int rect[][2], const void *data, int nmiss);
+void
+cdiStreamCloseDefaultDelegate(stream_t *streamptr,
+                              int recordBufIsToBeDeleted);
+
+int cdiStreamDefTimestep_(stream_t *streamptr, int tsID);
+
+void cdiStreamSync_(stream_t *streamptr);
+
 char *cdiUnitNamePtr(int cdi_unit);
 
 
diff --git a/libcdi/src/cdilib.c b/libcdi/src/cdilib.c
index b4aa0ba..f481cf7 100644
--- a/libcdi/src/cdilib.c
+++ b/libcdi/src/cdilib.c
@@ -1,7 +1,11 @@
 
-/* Automatically generated by m214003 at 2013-06-28, do not edit */
+/* Automatically generated by m214003 at 2013-11-08, do not edit */
 
-/* CDILIB_VERSION="1.6.1" */
+/* CDILIB_VERSION="1.6.2" */
+
+#ifdef _ARCH_PWR6
+#pragma options nostrict
+#endif
 
 #if  defined  (HAVE_CONFIG_H)
 #  include "config.h"
@@ -74,9 +78,98 @@
  * require-trailing-newline: t
  * End:
  */
+#ifndef RESOURCE_HANDLE_H
+#define RESOURCE_HANDLE_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+
+/*
+ * CDI internal handling of resource handles given to user code
+ */
+
+/*
+ * for reasons of compatibility with cfortran.h, the handle type is: int
+ */
+typedef int cdiResH;
+
+/* return 0 on equality, not 0 otherwise */
+typedef int    ( * valCompareFunc     )( void *, void * );
+typedef void   ( * valDestroyFunc     )( void * );
+typedef void   ( * valPrintFunc       )( void *, FILE * );
+typedef int    ( * valGetPackSizeFunc )( void *, void *context );
+typedef void   ( * valPackFunc        )( void *, void *buf, int size, int *pos, void *context );
+typedef int    ( * valTxCodeFunc      )( void );
+
+typedef struct {
+  valCompareFunc     valCompare;
+  valDestroyFunc     valDestroy;
+  valPrintFunc       valPrint;
+  valGetPackSizeFunc valGetPackSize;
+  valPackFunc        valPack;
+  valTxCodeFunc      valTxCode;
+}resOps;
+
+enum { RESH_UNDEFID, ASSIGNED, SUSPENDED, CLOSED };
+
+void   reshListCreate(int namespaceID);
+void   reshListDestruct(int namespaceID);
+int    reshPut ( void *, resOps * );
+void   reshRemove ( cdiResH, resOps * );
+
+int    reshCountType ( resOps * );
+
+void * reshGetValue(const char *, cdiResH, resOps * );
+#define reshGetVal(resH, ops)  reshGetValue(__func__, resH, ops)
+
+void   reshGetResHListOfType ( int, int *, resOps * );
+
+enum cdiApplyRet {
+  CDI_APPLY_ERROR = -1,
+  CDI_APPLY_STOP,
+  CDI_APPLY_GO_ON,
+};
+enum cdiApplyRet
+cdiResHApply(enum cdiApplyRet (*func)(int id, void *res, const resOps *p,
+                                      void *data), void *data);
+enum cdiApplyRet
+cdiResHFilterApply(const resOps *p,
+                   enum cdiApplyRet (*func)(int id, void *res,
+                                            void *data),
+                   void *data);
+
+void   reshPackBufferCreate ( char **, int *, void *context );
+void   reshPackBufferDestroy ( char ** );
+int    reshResourceGetPackSize(int resh, resOps *ops, void *context);
+void   reshPackResource(int resh, resOps *ops,
+                        void *buf, int buf_size, int *position, void *context);
+void   reshSetStatus ( cdiResH, resOps *, int );
+int    reshGetStatus ( cdiResH, resOps * );
+
+void   reshLock   ( void );
+void   reshUnlock ( void );
+int reshListCompare(int nsp0, int nsp1);
+void reshListPrint(FILE *fp);
+
+#endif
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
 #ifndef _TAXIS_H
 #define _TAXIS_H
 
+#ifndef RESOURCE_HANDLE_H
+#include "resource_handle.h"
+#endif
 
 typedef struct {
   /* Date format  YYYYMMDD */
@@ -91,6 +184,7 @@ typedef struct {
   int     calendar;
   int     unit;           /* time unit             */
   int     numavg;
+  int     climatology;
   int     has_bounds;
   int     vdate_lb;       /* lower bounds of vdate */
   int     vtime_lb;       /* lower bounds of vtime */
@@ -109,6 +203,11 @@ double  cdiEncodeTimeval(int date, int time, taxis_t *taxis);
 void    timeval2vtime(double timevalue, taxis_t *taxis, int *vdate, int *vtime);
 double  vtime2timeval(int vdate, int vtime, taxis_t *taxis);
 
+extern resOps taxisOps;
+
+int
+taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
+            int nspTarget, void *context, int checkForSameID);
 
 #endif  /* _TAXIS_H */
 /*
@@ -204,7 +303,9 @@ int    fileSetBufferType(int fileID, int type);
 void   fileSetBufferSize(int fileID, long buffersize);
 
 int    fileOpen(const char *filename, const char *mode);
+int    fileOpen_serial(const char *filename, const char *mode);
 int    fileClose(int fileID);
+int    fileClose_serial(int fileID);
 
 char  *fileInqName(int fileID);
 int    fileInqMode(int fileID);
@@ -544,65 +645,69 @@ extern "C" {
 #define  DATATYPE_UINT32        332
 
 /* internal data types */
-
 #define  DATATYPE_INT           251
 #define  DATATYPE_FLT           252
 #define  DATATYPE_TXT           253
 #define  DATATYPE_CPX           254
+#define  DATATYPE_UCHAR         255
 
 /* Chunks */
 
-#define  CHUNK_AUTO               1  /* use default chunk size                  */
-#define  CHUNK_GRID               2
-#define  CHUNK_LINES              3
+#define  CHUNK_AUTO                 1  /* use default chunk size                                */
+#define  CHUNK_GRID                 2
+#define  CHUNK_LINES                3
 
 /* GRID types */
 
-#define  GRID_GENERIC             1  /* Generic grid                            */
-#define  GRID_GAUSSIAN            2  /* Regular Gaussian lon/lat grid           */
-#define  GRID_GAUSSIAN_REDUCED    3  /* Reduced Gaussian lon/lat grid           */
-#define  GRID_LONLAT              4  /* Regular longitude/latitude grid         */
-#define  GRID_SPECTRAL            5  /* Spherical harmonic coefficients         */
-#define  GRID_FOURIER             6  /* Fourier coefficients                    */
-#define  GRID_GME                 7  /* Icosahedral-hexagonal GME grid          */
-#define  GRID_TRAJECTORY          8  /* Trajectory                              */
-#define  GRID_UNSTRUCTURED        9  /* General unstructured grid               */
-#define  GRID_CURVILINEAR        10  /* Curvilinear grid                        */
-#define  GRID_LCC                11  /* Lambert Conformal Conic (GRIB)          */
-#define  GRID_LCC2               12  /* Lambert Conformal Conic (PROJ)          */
-#define  GRID_LAEA               13  /* Lambert Azimuthal Equal Area            */
-#define  GRID_SINUSOIDAL         14  /* Sinusoidal                              */
-#define  GRID_REFERENCE          15  /* Grid reference number                   */
-#define  GRID_PROJECTION         16  /* Projected coordiantes                   */
+#define  GRID_GENERIC               1  /* Generic grid                                          */
+#define  GRID_GAUSSIAN              2  /* Regular Gaussian lon/lat grid                         */
+#define  GRID_GAUSSIAN_REDUCED      3  /* Reduced Gaussian lon/lat grid                         */
+#define  GRID_LONLAT                4  /* Regular longitude/latitude grid                       */
+#define  GRID_SPECTRAL              5  /* Spherical harmonic coefficients                       */
+#define  GRID_FOURIER               6  /* Fourier coefficients                                  */
+#define  GRID_GME                   7  /* Icosahedral-hexagonal GME grid                        */
+#define  GRID_TRAJECTORY            8  /* Trajectory                                            */
+#define  GRID_UNSTRUCTURED          9  /* General unstructured grid                             */
+#define  GRID_CURVILINEAR          10  /* Curvilinear grid                                      */
+#define  GRID_LCC                  11  /* Lambert Conformal Conic (GRIB)                        */
+#define  GRID_LCC2                 12  /* Lambert Conformal Conic (PROJ)                        */
+#define  GRID_LAEA                 13  /* Lambert Azimuthal Equal Area                          */
+#define  GRID_SINUSOIDAL           14  /* Sinusoidal                                            */
+#define  GRID_PROJECTION           15  /* Projected coordiantes                                 */
 
 /* ZAXIS types */
 
-#define  ZAXIS_SURFACE            0  /* Surface level                           */
-#define  ZAXIS_GENERIC            1  /* Generic level                           */
-#define  ZAXIS_HYBRID             2  /* Hybrid level                            */
-#define  ZAXIS_HYBRID_HALF        3  /* Hybrid half level                       */
-#define  ZAXIS_PRESSURE           4  /* Isobaric pressure level in Pascal       */
-#define  ZAXIS_HEIGHT             5  /* Height above ground in meters           */
-#define  ZAXIS_DEPTH_BELOW_SEA    6  /* Depth below sea level in meters         */
-#define  ZAXIS_DEPTH_BELOW_LAND   7  /* Depth below land surface in centimeters */
-#define  ZAXIS_ISENTROPIC         8  /* Isentropic                              */
-#define  ZAXIS_TRAJECTORY         9  /* Trajectory                              */
-#define  ZAXIS_ALTITUDE          10  /* Altitude above mean sea level in meters */
-#define  ZAXIS_SIGMA             11  /* Sigma level                             */
-#define  ZAXIS_MEANSEA           12  /* Mean sea level                          */
-#define  ZAXIS_TOA               13  /* Norminal top of atmosphere              */
-#define  ZAXIS_SEA_BOTTOM        14  /* Sea bottom                              */
-#define  ZAXIS_ATMOSPHERE        15  /* Entire atmosphere                       */
-#define  ZAXIS_CLOUD_BASE        16  /* Cloud base level                        */
-#define  ZAXIS_CLOUD_TOP         17  /* Level of cloud tops                     */
-#define  ZAXIS_ISOTHERM_ZERO     18  /* Level of 0o C isotherm                  */
-#define  ZAXIS_SNOW              19  /* Snow level                              */
-#define  ZAXIS_REFERENCE         20  /* zaxis reference number                  */
+#define  ZAXIS_SURFACE              0  /* Surface level                                         */
+#define  ZAXIS_GENERIC              1  /* Generic level                                         */
+#define  ZAXIS_HYBRID               2  /* Hybrid level                                          */
+#define  ZAXIS_HYBRID_HALF          3  /* Hybrid half level                                     */
+#define  ZAXIS_PRESSURE             4  /* Isobaric pressure level in Pascal                     */
+#define  ZAXIS_HEIGHT               5  /* Height above ground in meters                         */
+#define  ZAXIS_DEPTH_BELOW_SEA      6  /* Depth below sea level in meters                       */
+#define  ZAXIS_DEPTH_BELOW_LAND     7  /* Depth below land surface in centimeters               */
+#define  ZAXIS_ISENTROPIC           8  /* Isentropic                                            */
+#define  ZAXIS_TRAJECTORY           9  /* Trajectory                                            */
+#define  ZAXIS_ALTITUDE            10  /* Altitude above mean sea level in meters               */
+#define  ZAXIS_SIGMA               11  /* Sigma level                                           */
+#define  ZAXIS_MEANSEA             12  /* Mean sea level                                        */
+#define  ZAXIS_TOA                 13  /* Norminal top of atmosphere                            */
+#define  ZAXIS_SEA_BOTTOM          14  /* Sea bottom                                            */
+#define  ZAXIS_ATMOSPHERE          15  /* Entire atmosphere                                     */
+#define  ZAXIS_CLOUD_BASE          16  /* Cloud base level                                      */
+#define  ZAXIS_CLOUD_TOP           17  /* Level of cloud tops                                   */
+#define  ZAXIS_ISOTHERM_ZERO       18  /* Level of 0o C isotherm                                */
+#define  ZAXIS_SNOW                19  /* Snow level                                            */
+#define  ZAXIS_LAKE_BOTTOM         20  /* Lake or River Bottom                                  */
+#define  ZAXIS_SEDIMENT_BOTTOM     21  /* Bottom Of Sediment Layer                              */
+#define  ZAXIS_SEDIMENT_BOTTOM_TA  22  /* Bottom Of Thermally Active Sediment Layer             */
+#define  ZAXIS_SEDIMENT_BOTTOM_TW  23  /* Bottom Of Sediment Layer Penetrated By Thermal Wave   */
+#define  ZAXIS_MIX_LAYER           24  /* Mixing Layer                                          */
+#define  ZAXIS_REFERENCE           25  /* zaxis reference number                                */
 
 /* TIME types */
 
-#define  TIME_CONSTANT            0  /* obsolate, use TSTEP_CONSTANT            */
-#define  TIME_VARIABLE            1  /* obsolate, use TSTEP_INSTANT             */
+#define  TIME_CONSTANT              0  /* obsolate, use TSTEP_CONSTANT                          */
+#define  TIME_VARIABLE              1  /* obsolate, use TSTEP_INSTANT                           */
 
 /* TSTEP types */
 
@@ -661,15 +766,25 @@ extern "C" {
 #define  PIO_MINIOMODEWITHSPECIALPROCS  PIO_WRITER
 
 /* parallel IO routines */
+#ifdef MPI_VERSION
+#  include <yaxt.h>
+#endif
 
+#ifdef MPI_VERSION /* make_fint keep */
 void     pioEndDef             ( void );
 void     pioEndTimestepping    ( void );
 void     pioFinalize           ( void );
-int      pioInit               ( int, int, int, int, int * );
-int      pioInqVarDecoChunk    ( int, int );
-int      pioInqVarDecoOff      ( int, int );
+/*      pioInit: initialize I/O server processes and communication */
+MPI_Comm pioInit(MPI_Comm commSuper, int nProcsIO, int IOMode,
+                 int *pioNamespace, float partInflate);
+void     pioWriteTimestep();
+
+void     streamWriteVarPart    (int streamID, int varID,
+                                const void *data, int nmiss,
+                                Xt_idxlist partDesc);
+
+#endif /* make_fint keep */
 void     pioNamespaceSetActive ( int );
-void     pioWriteTimestep      ( int, int, int );
 
 /* CDI control routines */
 
@@ -780,6 +895,9 @@ void    streamReadVarSlice(int streamID, int varID, int levelID, double *data_ve
 void    streamWriteVarSlice(int streamID, int varID, int levelID, const double *data_vec, int nmiss);
 void    streamWriteVarSliceF(int streamID, int varID, int levelID, const float *data_vec, int nmiss);
 
+void    streamWriteVarChunk(int streamID, int varID, const int rect[][2],
+                            const double *data_vec, int nmiss);
+
 
 /* STREAM record I/O routines */
 
@@ -960,6 +1078,9 @@ int     vlistInqVarTimave(int vlistID, int varID);
 void    vlistDefVarTimaccu(int vlistID, int varID, int timaccu);
 int     vlistInqVarTimaccu(int vlistID, int varID);
 
+void    vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGeneratingProcess);
+int     vlistInqVarTypeOfGeneratingProcess(int vlistID, int varID);
+
 int     vlistInqVarSize(int vlistID, int varID);
 
 void    vlistDefIndex(int vlistID, int varID, int levID, int index);
@@ -1153,16 +1274,32 @@ void    gridDefGMEni2(int gridID, int ni2);
 int     gridInqGMEni3(int gridID);
 void    gridDefGMEni3(int gridID, int ni3);
 
-/* Reference grid */
-int     gridInqNumber(int gridID);
+/* Reference of an unstructured grid */
+
+/*      gridDefNumber: Define the reference number for an unstructured grid */
 void    gridDefNumber(int gridID, int number);
-int     gridInqPosition(int gridID);
+
+/*      gridInqNumber: Get the reference number to an unstructured grid */
+int     gridInqNumber(int gridID);
+
+/*      gridDefPosition: Define the position of grid in the reference file */
 void    gridDefPosition(int gridID, int position);
-int     gridInqReference(int gridID, char *reference);
+
+/*      gridInqPosition: Get the position of grid in the reference file */
+int     gridInqPosition(int gridID);
+
+/*      gridDefReference: Define the reference URI for an unstructured grid */
 void    gridDefReference(int gridID, const char *reference);
-char   *gridInqUUID(int gridID, char *uuid_cbuf);
+
+/*      gridInqReference: Get the reference URI to an unstructured grid */
+int     gridInqReference(int gridID, char *reference);
+
+/*      gridDefUUID: Define the UUID of an unstructured grid */
 void    gridDefUUID(int gridID, const char *uuid_cbuf);
 
+/*      gridInqUUID: Get the UUID of an unstructured grid */
+char   *gridInqUUID(int gridID, char *uuid_cbuf);
+
 
 /* Lambert Conformal Conic grid (GRIB version) */
 void gridDefLCC(int gridID, double originLon, double originLat, double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag);
@@ -1241,18 +1378,24 @@ void    zaxisDefLevel(int zaxisID, int levelID, double levels);
 /*      zaxisInqLevel: Get one level of a Z-axis */
 double  zaxisInqLevel(int zaxisID, int levelID);
 
-/*      zaxisDefReference: Define the reference of a generalized Z-axis */
-void    zaxisDefReference(int zaxisID, int refID);
+/*      zaxisDefNlevRef: Define the number of half levels of a generalized Z-axis */
+void    zaxisDefNlevRef(int gridID, int nhlev);
+
+/*      zaxisInqNlevRef: Get the number of half levels of a generalized Z-axis */
+int     zaxisInqNlevRef(int gridID);
 
-/*      zaxisDefUUID: Define the uuid of a generalized Z-axis */
+/*      zaxisDefNumber: Define the reference number for a generalized Z-axis */
+void    zaxisDefNumber(int gridID, int number);
+
+/*      zaxisInqNumber: Get the reference number to a generalized Z-axis */
+int     zaxisInqNumber(int gridID);
+
+/*      zaxisDefUUID: Define the UUID of a generalized Z-axis */
 void    zaxisDefUUID(int zaxisID, const char *uuid_cbuf);
 
-/*      zaxisInqUUID: Get the reference of a generalized Z-axis */
+/*      zaxisInqUUID: Get the UUID of a generalized Z-axis */
 char   *zaxisInqUUID(int zaxisID, char *uuid_cbuf);
 
-/*      zaxisInqReference: Get the reference of a generalized Z-axis */
-int     zaxisInqReference(int zaxisID);
-
 /*      zaxisDefName: Define the name of a Z-axis */
 void    zaxisDefName(int zaxisID, const char *name);
 
@@ -1277,6 +1420,7 @@ void    zaxisInqUnits(int zaxisID, char *units);
 void    zaxisDefPrec(int zaxisID, int prec);
 int     zaxisInqPrec(int zaxisID);
 
+void    zaxisDefPositive(int zaxisID, int positive);
 int     zaxisInqPositive(int zaxisID);
 
 void    zaxisDefLtype(int zaxisID, int ltype);
@@ -1513,6 +1657,89 @@ DateTime;
  * require-trailing-newline: t
  * End:
  */
+#ifndef NAMESPACE_H
+#define NAMESPACE_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+
+typedef enum {
+  STAGE_DEFINITION = 0,
+  STAGE_TIMELOOP   = 1,
+  STAGE_CLEANUP    = 2,
+  STAGE_UNUSED     = 3,
+} statusCode;
+
+typedef struct {
+  int idx;
+  int nsp;
+} namespaceTuple_t;
+
+enum namespaceSwitch
+{
+  NSSWITCH_NO_SUCH_SWITCH = -1,
+  NSSWITCH_ABORT,
+  NSSWITCH_SERIALIZE_GET_SIZE,
+  NSSWITCH_SERIALIZE_PACK,
+  NSSWITCH_SERIALIZE_UNPACK,
+  NSSWITCH_FILE_OPEN,
+  NSSWITCH_FILE_WRITE,
+  NSSWITCH_FILE_CLOSE,
+  NSSWITCH_STREAM_OPEN_BACKEND,
+  NSSWITCH_STREAM_DEF_VLIST_,
+  NSSWITCH_STREAM_WRITE_VAR_,
+  NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
+  NSSWITCH_STREAM_WRITE_VAR_PART_,
+  NSSWITCH_STREAM_CLOSE_BACKEND,
+  NSSWITCH_STREAM_DEF_TIMESTEP_,
+  NSSWITCH_STREAM_SYNC,
+#ifdef HAVE_LIBNETCDF
+  NSSWITCH_NC__CREATE,
+  NSSWITCH_CDF_DEF_VAR,
+  NSSWITCH_CDF_DEF_TIMESTEP,
+  NSSWITCH_CDF_STREAM_SETUP,
+#endif
+  NUM_NAMESPACE_SWITCH,
+};
+
+union namespaceSwitchValue
+{
+  void *data;
+  void (*func)();
+};
+
+#define NSSW_FUNC(p) ((union namespaceSwitchValue){ .func = (void (*)())(p) })
+#define NSSW_DATA(p) ((union namespaceSwitchValue){ .data = (void *)(p) })
+
+int              namespaceNew();
+void             namespaceDelete(int namespaceID);
+void             namespaceCleanup      ( void );
+int              namespaceGetNumber    ( void );
+int              namespaceGetActive    ( void );
+int              namespaceIdxEncode    ( namespaceTuple_t );
+int              namespaceIdxEncode2   ( int, int );
+namespaceTuple_t namespaceResHDecode   ( int );
+int              namespaceAdaptKey     ( int, int );
+int              namespaceAdaptKey2    ( int );
+void             namespaceDefResStatus ( statusCode );
+statusCode       namespaceInqResStatus ( void );
+void namespaceSwitchSet(enum namespaceSwitch sw,
+                        union namespaceSwitchValue value);
+union namespaceSwitchValue namespaceSwitchGet(enum namespaceSwitch sw);
+
+
+#endif
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
 #if defined (HAVE_CONFIG_H)
 #  include "config.h"
 #endif
@@ -1522,6 +1749,9 @@ DateTime;
 #include <stdarg.h>
 #include <errno.h>
 
+#if !defined (NAMESPACE_H)
+#include "namespace.h"
+#endif
 
 int _ExitOnError   = 1;	/* If set to 1, exit on error       */
 int _Verbose = 1;	/* If set to 1, errors are reported */
@@ -1531,7 +1761,7 @@ int _Debug   = 0;       /* If set to 1, debugging           */
 void SysError_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
   printf("\n");
@@ -1543,7 +1773,7 @@ void SysError_(const char *caller, const char *fmt, ...)
 
   if ( errno )
     perror("System error message ");
-	
+
   exit(EXIT_FAILURE);
 }
 
@@ -1551,7 +1781,7 @@ void SysError_(const char *caller, const char *fmt, ...)
 void Error_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
   printf("\n");
@@ -1564,11 +1794,43 @@ void Error_(const char *caller, const char *fmt, ...)
   if ( _ExitOnError ) exit(EXIT_FAILURE);
 }
 
+typedef void (*cdiAbortCFunc)(const char * caller, const char * filename,
+                              const char *functionname, int line,
+                              const char * errorString, va_list ap)
+#ifdef __GNUC__
+  __attribute__((noreturn))
+#endif
+;
+
+void cdiAbortC(const char * caller, const char * filename,
+               const char *functionname, int line,
+               const char * errorString, ... )
+{
+  va_list ap;
+  va_start(ap, errorString);
+  cdiAbortCFunc cdiAbortC_p
+    = (cdiAbortCFunc)namespaceSwitchGet(NSSWITCH_ABORT).func;
+  cdiAbortC_p(caller, filename, functionname, line, errorString, ap);
+  va_end(ap);
+}
+
+void
+cdiAbortC_serial(const char *caller, const char *filename,
+                 const char *functionname, int line,
+                 const char *errorString, va_list ap)
+{
+  fprintf(stderr, "ERROR, %s, %s, line %d%s%s\nerrorString: \"",
+          functionname, filename, line, caller?", called from ":"",
+          caller?caller:"");
+  vfprintf(stderr, errorString, ap);
+  fputs("\"\n", stderr);
+  exit(EXIT_FAILURE);
+}
 
 void Warning_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
   if ( _Verbose )
@@ -1585,7 +1847,7 @@ void Warning_(const char *caller, const char *fmt, ...)
 void Message_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
    fprintf(stdout, "%-18s : ", caller);
@@ -1606,6 +1868,9 @@ void Message_(const char *caller, const char *fmt, ...)
 #ifndef _ERROR_H
 #define _ERROR_H
 
+#include <stdarg.h>
+#include <stdlib.h>
+
 #ifndef  WITH_CALLER_NAME
 #define  WITH_CALLER_NAME
 #endif
@@ -1639,6 +1904,33 @@ void  Message_(const char *caller, const char *fmt, ...);
 #  define   Message(...)   Message_((void *), __VA_ARGS__)
 #endif
 
+/* If we're not using GNU C, elide __attribute__ */
+#ifndef __GNUC__
+#  define  __attribute__(x)  /*NOTHING*/
+#endif
+
+void cdiAbortC(const char *caller, const char *filename,
+               const char *functionname, int line,
+               const char *errorString, ... )
+  __attribute__((noreturn));
+#define xabortC(caller, ...)                                    \
+  cdiAbortC(caller, __FILE__, __func__, __LINE__, __VA_ARGS__ )
+#define xabort(...)                                             \
+  cdiAbortC(NULL, __FILE__, __func__, __LINE__, __VA_ARGS__ )
+#define cdiAbort(file, func, line, ...)                 \
+  cdiAbortC(NULL, (file), (func), (line), __VA_ARGS__)
+
+#define xassert(arg) do {                       \
+    if ((arg)) { } else {                       \
+      xabort("assertion failed");}              \
+  } while(0)
+
+void
+cdiAbortC_serial(const char *caller, const char *filename,
+                 const char *functionname, int line,
+                 const char *errorString, va_list ap)
+  __attribute__((noreturn));
+
 #endif  /* _ERROR_H */
 /*
  * Local Variables:
@@ -1902,7 +2194,8 @@ typedef struct {
   void       *gribContainers;
 #endif
   int         vlistIDorig;
-
+  /* only used by MPI-parallelized version of library */
+  int       ownerRank;    // MPI rank of owner process
   /* ---------------------------------- */
   /* Local change: 2013-02-18, FP (DWD) */
   /* ---------------------------------- */
@@ -1943,6 +2236,7 @@ void    streamDefineTaxis(int streamID);
 
 int     streamsNewEntry(int filetype);
 void    streamsInitEntry(int streamID);
+void    cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig);
 int     stream_new_var(stream_t *streamptr, int gridID, int zaxisID);
 
 int     tstepsNewEntry(stream_t *streamptr);
@@ -1991,6 +2285,36 @@ void str2uuid(const char *uuidstr, char *uuid);
 #define CDI_UNIT_DM   5
 #define CDI_UNIT_M    6
 
+struct streamAssoc
+{
+  int streamID, vlistID, vlistIDorig;
+};
+
+struct streamAssoc
+streamUnpack(char * unpackBuffer, int unpackBufferSize,
+             int * unpackBufferPos, int nspTarget, void *context);
+
+int
+cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
+                             int filetype, stream_t *streamptr,
+                             int recordBufIsToBeCreated);
+
+void
+cdiStreamDefVlist_(int streamID, int vlistID);
+void
+cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
+                   int nmiss);
+void
+cdiStreamwriteVarChunk_(int streamID, int varID, int memtype,
+                        const int rect[][2], const void *data, int nmiss);
+void
+cdiStreamCloseDefaultDelegate(stream_t *streamptr,
+                              int recordBufIsToBeDeleted);
+
+int cdiStreamDefTimestep_(stream_t *streamptr, int tsID);
+
+void cdiStreamSync_(stream_t *streamptr);
+
 char *cdiUnitNamePtr(int cdi_unit);
 
 
@@ -2015,8 +2339,8 @@ char *cdiUnitNamePtr(int cdi_unit);
 
 /* GRIB1 Level Types */
 #define  GRIB1_LTYPE_SURFACE               1
-#define  GRIB1_LTYPE_CLOUDBASE             2
-#define  GRIB1_LTYPE_CLOUDTOP              3
+#define  GRIB1_LTYPE_CLOUD_BASE            2
+#define  GRIB1_LTYPE_CLOUD_TOP             3
 #define  GRIB1_LTYPE_ISOTHERM0             4
 #define  GRIB1_LTYPE_TOA                   8
 #define  GRIB1_LTYPE_SEA_BOTTOM            9
@@ -2033,27 +2357,32 @@ char *cdiUnitNamePtr(int cdi_unit);
 #define  GRIB1_LTYPE_LANDDEPTH           111
 #define  GRIB1_LTYPE_LANDDEPTH_LAYER     112
 #define  GRIB1_LTYPE_ISENTROPIC          113
-#define  GRIB1_LTYPE_SEADEPTH            160
+#define  GRIB1_LTYPE_SEADEPTH            160  /* Depth Below Sea Level                                 */
+#define  GRIB1_LTYPE_LAKE_BOTTOM         162  /* Lake or River Bottom                                  */
+#define  GRIB1_LTYPE_SEDIMENT_BOTTOM     163  /* Bottom Of Sediment Layer                              */
+#define  GRIB1_LTYPE_SEDIMENT_BOTTOM_TA  164  /* Bottom Of Thermally Active Sediment Layer             */
+#define  GRIB1_LTYPE_SEDIMENT_BOTTOM_TW  165  /* Bottom Of Sediment Layer Penetrated By Thermal Wave   */
+#define  GRIB1_LTYPE_MIX_LAYER           166  /* Mixing Layer                                          */
 #define  GRIB1_LTYPE_99_MARGIN          1000
 
 /* GRIB1 Data representation type (Grid Type) [Table 6] */
-#define  GRIB1_GTYPE_LATLON                0  /*  latitude/longitude                       */
-#define  GRIB1_GTYPE_LATLON_ROT           10  /*  rotated latitude/longitude               */
-#define  GRIB1_GTYPE_LATLON_STR           20  /*  stretched latitude/longitude             */
-#define  GRIB1_GTYPE_LATLON_ROTSTR        30  /*  rotated and stretched latitude/longitude */
-#define  GRIB1_GTYPE_GAUSSIAN              4  /*  gaussian grid                            */
-#define  GRIB1_GTYPE_GAUSSIAN_ROT         14  /*  rotated gaussian grid                    */
-#define  GRIB1_GTYPE_GAUSSIAN_STR         24  /*  stretched gaussian grid                  */
-#define  GRIB1_GTYPE_GAUSSIAN_ROTSTR      34  /*  rotated and stretched gaussian grid      */
-#define  GRIB1_GTYPE_LCC                   3  /*  Lambert conformal                        */
-#define  GRIB1_GTYPE_SPECTRAL             50  /*  spherical harmonics                      */
-#define  GRIB1_GTYPE_GME                 192  /*  hexagonal GME grid                       */
+#define  GRIB1_GTYPE_LATLON                0  /*  latitude/longitude                                   */
+#define  GRIB1_GTYPE_LATLON_ROT           10  /*  rotated latitude/longitude                           */
+#define  GRIB1_GTYPE_LATLON_STR           20  /*  stretched latitude/longitude                         */
+#define  GRIB1_GTYPE_LATLON_ROTSTR        30  /*  rotated and stretched latitude/longitude             */
+#define  GRIB1_GTYPE_GAUSSIAN              4  /*  gaussian grid                                        */
+#define  GRIB1_GTYPE_GAUSSIAN_ROT         14  /*  rotated gaussian grid                                */
+#define  GRIB1_GTYPE_GAUSSIAN_STR         24  /*  stretched gaussian grid                              */
+#define  GRIB1_GTYPE_GAUSSIAN_ROTSTR      34  /*  rotated and stretched gaussian grid                  */
+#define  GRIB1_GTYPE_LCC                   3  /*  Lambert conformal                                    */
+#define  GRIB1_GTYPE_SPECTRAL             50  /*  spherical harmonics                                  */
+#define  GRIB1_GTYPE_GME                 192  /*  hexagonal GME grid                                   */
 
 /*
  *  Macros for the indicator section ( Section 0 )
  */
-#define  ISEC0_GRIB_Len             (isec0[ 0])  /*  Number of octets in the GRIB message         */
-#define  ISEC0_GRIB_Version         (isec0[ 1])  /*  GRIB edition number                          */
+#define  ISEC0_GRIB_Len             (isec0[ 0])  /*  Number of octets in the GRIB message              */
+#define  ISEC0_GRIB_Version         (isec0[ 1])  /*  GRIB edition number                               */
 
 
 /*
@@ -2261,8 +2590,8 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long
 
 /* GRIB2 Level Types */
 #define  GRIB2_LTYPE_SURFACE               1
-#define  GRIB2_LTYPE_CLOUDBASE             2
-#define  GRIB2_LTYPE_CLOUDTOP              3
+#define  GRIB2_LTYPE_CLOUD_BASE            2
+#define  GRIB2_LTYPE_CLOUD_TOP             3
 #define  GRIB2_LTYPE_ISOTHERM0             4
 #define  GRIB2_LTYPE_TOA                   8
 #define  GRIB2_LTYPE_SEA_BOTTOM            9
@@ -2277,21 +2606,26 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long
 #define  GRIB2_LTYPE_ISENTROPIC          107
 #define  GRIB2_LTYPE_SNOW                114
 #define  GRIB2_LTYPE_REFERENCE           150
-#define  GRIB2_LTYPE_SEADEPTH            160
+#define  GRIB2_LTYPE_SEADEPTH            160  /* Depth Below Sea Level                                 */
+#define  GRIB2_LTYPE_LAKE_BOTTOM         162  /* Lake or River Bottom                                  */
+#define  GRIB2_LTYPE_SEDIMENT_BOTTOM     163  /* Bottom Of Sediment Layer                              */
+#define  GRIB2_LTYPE_SEDIMENT_BOTTOM_TA  164  /* Bottom Of Thermally Active Sediment Layer             */
+#define  GRIB2_LTYPE_SEDIMENT_BOTTOM_TW  165  /* Bottom Of Sediment Layer Penetrated By Thermal Wave   */
+#define  GRIB2_LTYPE_MIX_LAYER           166  /* Mixing Layer                                          */
 
 /* GRIB2 Data representation type (Grid Type) */
-#define  GRIB2_GTYPE_LATLON                0  /*  latitude/longitude                       */
-#define  GRIB2_GTYPE_LATLON_ROT            1  /*  rotated latitude/longitude               */
-#define  GRIB2_GTYPE_LATLON_STR            2  /*  stretched latitude/longitude             */
-#define  GRIB2_GTYPE_LATLON_ROTSTR         3  /*  rotated and stretched latitude/longitude */
-#define  GRIB2_GTYPE_GAUSSIAN             40  /*  gaussian grid                            */
-#define  GRIB2_GTYPE_GAUSSIAN_ROT         41  /*  rotated gaussian grid                    */
-#define  GRIB2_GTYPE_GAUSSIAN_STR         42  /*  stretched gaussian grid                  */
-#define  GRIB2_GTYPE_GAUSSIAN_ROTSTR      43  /*  rotated and stretched gaussian grid      */
-#define  GRIB2_GTYPE_LCC                  30  /*  Lambert conformal                        */
-#define  GRIB2_GTYPE_SPECTRAL             50  /*  spherical harmonics                      */
-#define  GRIB2_GTYPE_GME                 100  /*  hexagonal GME grid                       */
-#define  GRIB2_GTYPE_NUMBER              101  /*  General Unstructured Grid                */
+#define  GRIB2_GTYPE_LATLON                0  /*  latitude/longitude                                   */
+#define  GRIB2_GTYPE_LATLON_ROT            1  /*  rotated latitude/longitude                           */
+#define  GRIB2_GTYPE_LATLON_STR            2  /*  stretched latitude/longitude                         */
+#define  GRIB2_GTYPE_LATLON_ROTSTR         3  /*  rotated and stretched latitude/longitude             */
+#define  GRIB2_GTYPE_GAUSSIAN             40  /*  gaussian grid                                        */
+#define  GRIB2_GTYPE_GAUSSIAN_ROT         41  /*  rotated gaussian grid                                */
+#define  GRIB2_GTYPE_GAUSSIAN_STR         42  /*  stretched gaussian grid                              */
+#define  GRIB2_GTYPE_GAUSSIAN_ROTSTR      43  /*  rotated and stretched gaussian grid                  */
+#define  GRIB2_GTYPE_LCC                  30  /*  Lambert conformal                                    */
+#define  GRIB2_GTYPE_SPECTRAL             50  /*  spherical harmonics                                  */
+#define  GRIB2_GTYPE_GME                 100  /*  hexagonal GME grid                                   */
+#define  GRIB2_GTYPE_UNSTRUCTURED        101  /*  General Unstructured Grid                            */
 
 const char *gribapiLibraryVersion(void);
 void gribContainersNew(stream_t * streamptr);
@@ -2387,6 +2721,9 @@ int   grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memty
 int   grib1ltypeToZaxisType(int grib_ltype);
 int   grib2ltypeToZaxisType(int grib_ltype);
 
+int   zaxisTypeToGrib1ltype(int zaxistype);
+int   zaxisTypeToGrib2ltype(int zaxistype);
+
 #endif  /* _STREAM_GRB_H */
 /*
  * Local Variables:
@@ -2422,6 +2759,9 @@ void   cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *da
 int    cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, int *nmiss);
 int    cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, int nmiss);
 
+void   cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
+                           const int rect[][2], const void *data, int nmiss);
+
 #endif
 /*
  * Local Variables:
@@ -4035,6 +4375,9 @@ void varDefTable(int varID, int tableID);
 int  varInqTable(int varID);
 void varDefEnsembleInfo(int varID, int ens_idx, int ens_count, int forecast_type);
 
+void varDefTypeOfGeneratingProcess(int varID, int typeOfGeneratingProcess);
+
+
 void varDefOptGribInt(int varID, long lval, const char *keyword);
 void varDefOptGribDbl(int varID, double dval, const char *keyword);
 int varOptGribNentries(int varID);
@@ -4253,10 +4596,7 @@ void   iegWriteVarSliceDP(stream_t *streamptr, int varID, int levelID, const dou
 
 #if  defined  (HAVE_LIBNETCDF)
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
+#include <stdlib.h>
 #include "netcdf.h"
 
 void cdf_create (const char *path, int cmode, int *idp);
@@ -4276,6 +4616,8 @@ void cdf_inq_dimname (int ncid, int dimid, char *name);
 void cdf_inq_dimlen (int ncid, int dimid, size_t * lengthp);
 void cdf_def_var (int ncid, const char *name, nc_type xtype, int ndims,
 		 const int dimids[], int *varidp);
+void cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
+                        const int dimids[], int *varidp);
 void cdf_inq_varid (int ncid, const char *name, int *varidp);
 void cdf_inq_nvars (int ncid, int *nvarsp);
 void cdf_inq_var (int ncid, int varid, char *name, nc_type *xtypep,
@@ -4341,6 +4683,14 @@ void cdf_inq_attlen (int ncid, int varid, const char *name, size_t *lenp);
 void cdf_inq_attname (int ncid, int varid, int attnum, char *name);
 void cdf_inq_attid (int ncid, int varid, const char *name, int *attnump);
 
+typedef int (*cdi_nc__create_funcp)(const char *path, int cmode,
+                                    size_t initialsz, size_t *chunksizehintp,
+                                    int *ncidp);
+
+typedef void (*cdi_cdf_def_var_funcp)(int ncid, const char *name,
+                                      nc_type xtype, int ndims,
+                                      const int dimids[], int *varidp);
+
 #endif
 
 #endif  /* _CDF_INT_H */
@@ -4385,10 +4735,6 @@ void cdfClose(int fileID);
 
 #include <stddef.h>  /* size_t */
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
 #ifndef _CDI_LIMITS_H
 #  include "cdi_limits.h"
 #endif
@@ -4432,14 +4778,6 @@ levinfo_t;
 
 typedef struct
 {
-  int      rank;
-  int      offset;
-  int      chunk;
-}
-deco_t;
-
-typedef struct
-{
   int ens_index;
   int ens_count;
   int forecast_init_type;
@@ -4471,6 +4809,7 @@ typedef struct
   int         tableID;
   int         timave;
   int         timaccu;
+  int         typeOfGeneratingProcess;
   int         chunktype;
   int         xyz;
   int         missvalused; /* TRUE if missval is defined */
@@ -4490,9 +4829,6 @@ typedef struct
   ensinfo_t  *ensdata;      /* Ensemble information */
   cdi_atts_t  atts;
   int         iorank;
-  int         decoSize;
-  deco_t     *deco;
-
 #if  defined  (HAVE_LIBGRIB_API)
   /* ---------------------------------- */
   /* Local change: 2013-01-28, FP (DWD) */
@@ -4546,11 +4882,7 @@ int      vlistHasTime(int vlistID);
 int      vlistDelAtts(int vlistID, int varID);
 int      vlistCopyVarAtts(int vlistID1, int varID_1, int vlistID2, int varID_2);
 
-#ifdef USE_MPI
-void     vlistUnpack(char * buffer, int bufferSize, int * pos, int, MPI_Comm comm);
-void     vlistDefVarDeco ( int vlistID, int varID, int decoSize, 
-                              deco_t * deco );
-#endif
+void     vlistUnpack(char * buffer, int bufferSize, int * pos, int, void *context);
 
 /*      vlistDefVarValidrange: Define the valid range of a Variable */
 void    vlistDefVarValidrange(int vlistID, int varID, const double *validrange);
@@ -4580,10 +4912,6 @@ extern char* cdiAdditionalGRIBKeys[];
 #include "config.h"
 #endif
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
 #ifndef _VLIST_H
 #include "vlist.h"
 #endif
@@ -4591,15 +4919,13 @@ extern char* cdiAdditionalGRIBKeys[];
 int  vlistInqVarDecoChunk ( int, int, int );
 int  vlistInqVarDecoOff   ( int, int, int );
 
-#ifdef USE_MPI
-int  vlistVarGetSize(vlist_t *p, int varID, MPI_Comm comm);
+int  vlistVarGetSize(vlist_t *p, int varID, void *context);
 void vlistVarPack(vlist_t *p, int varID,
-                  char * buffer, int bufferSize, int * pos, MPI_Comm comm);
+                  char * buffer, int bufferSize, int * pos, void *context);
 void vlistVarUnpack(int vlistID,
-                    char * buf, int size, int *position, int, MPI_Comm comm);
+                    char * buf, int size, int *position, int, void *context);
 void vlistDefVarIOrank    ( int, int, int );
 int  vlistInqVarIOrank    ( int, int );
-#endif
 
 #endif
 /*
@@ -4618,24 +4944,17 @@ int  vlistInqVarIOrank    ( int, int );
 #include "config.h"
 #endif
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
-#ifdef USE_MPI
-
 int
-vlistAttsGetSize(vlist_t *p, int varID, MPI_Comm comm);
+vlistAttsGetSize(vlist_t *p, int varID, void *context);
 
 void
 vlistAttsPack(vlist_t *p, int varID,
-              void * buf, int size, int *position, MPI_Comm comm);
+              void * buf, int size, int *position, void *context);
 
 void
 vlistAttsUnpack(int vlistID, int varID,
-                void * buf, int size, int *position, MPI_Comm comm);
+                void * buf, int size, int *position, void *context);
 
-#endif
 
 #endif
 
@@ -4651,11 +4970,9 @@ vlistAttsUnpack(int vlistID, int varID,
 #ifndef MODEL_H
 #define MODEL_H
 
-#ifdef USE_MPI
 int
 modelUnpack(void *buf, int size, int *position,
-            int, MPI_Comm comm);
-#endif
+            int, void *context);
 
 #endif
 /*
@@ -4670,11 +4987,9 @@ modelUnpack(void *buf, int size, int *position,
 #ifndef INSTITUTION_H
 #define INSTITUTION_H
 
-#ifdef USE_MPI
 int
 instituteUnpack(void *buf, int size, int *position, int,
-                MPI_Comm comm);
-#endif
+                void *context);
 
 #endif
 
@@ -4690,31 +5005,75 @@ instituteUnpack(void *buf, int size, int *position, int,
 #ifndef NAMESPACE_H
 #define NAMESPACE_H
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+
 typedef enum {
   STAGE_DEFINITION = 0,
   STAGE_TIMELOOP   = 1,
-  STAGE_CLEANUP    = 2
+  STAGE_CLEANUP    = 2,
+  STAGE_UNUSED     = 3,
 } statusCode;
 
 typedef struct {
   int idx;
   int nsp;
-  statusCode resStatus;
 } namespaceTuple_t;
 
+enum namespaceSwitch
+{
+  NSSWITCH_NO_SUCH_SWITCH = -1,
+  NSSWITCH_ABORT,
+  NSSWITCH_SERIALIZE_GET_SIZE,
+  NSSWITCH_SERIALIZE_PACK,
+  NSSWITCH_SERIALIZE_UNPACK,
+  NSSWITCH_FILE_OPEN,
+  NSSWITCH_FILE_WRITE,
+  NSSWITCH_FILE_CLOSE,
+  NSSWITCH_STREAM_OPEN_BACKEND,
+  NSSWITCH_STREAM_DEF_VLIST_,
+  NSSWITCH_STREAM_WRITE_VAR_,
+  NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
+  NSSWITCH_STREAM_WRITE_VAR_PART_,
+  NSSWITCH_STREAM_CLOSE_BACKEND,
+  NSSWITCH_STREAM_DEF_TIMESTEP_,
+  NSSWITCH_STREAM_SYNC,
+#ifdef HAVE_LIBNETCDF
+  NSSWITCH_NC__CREATE,
+  NSSWITCH_CDF_DEF_VAR,
+  NSSWITCH_CDF_DEF_TIMESTEP,
+  NSSWITCH_CDF_STREAM_SETUP,
+#endif
+  NUM_NAMESPACE_SWITCH,
+};
+
+union namespaceSwitchValue
+{
+  void *data;
+  void (*func)();
+};
+
+#define NSSW_FUNC(p) ((union namespaceSwitchValue){ .func = (void (*)())(p) })
+#define NSSW_DATA(p) ((union namespaceSwitchValue){ .data = (void *)(p) })
+
+int              namespaceNew();
+void             namespaceDelete(int namespaceID);
 void             namespaceCleanup      ( void );
-void             namespaceInit         ( int, int * );
-void             namespaceShowbits     ( int, char * );
 int              namespaceGetNumber    ( void );
 int              namespaceGetActive    ( void );
 int              namespaceIdxEncode    ( namespaceTuple_t );
 int              namespaceIdxEncode2   ( int, int );
 namespaceTuple_t namespaceResHDecode   ( int );
-int              namespaceHasLocalFile ( int );
 int              namespaceAdaptKey     ( int, int );
 int              namespaceAdaptKey2    ( int );
 void             namespaceDefResStatus ( statusCode );
 statusCode       namespaceInqResStatus ( void );
+void namespaceSwitchSet(enum namespaceSwitch sw,
+                        union namespaceSwitchValue value);
+union namespaceSwitchValue namespaceSwitchGet(enum namespaceSwitch sw);
+
 
 #endif
 /*
@@ -4726,88 +5085,35 @@ statusCode       namespaceInqResStatus ( void );
  * require-trailing-newline: t
  * End:
  */
-#ifndef RESOURCE_HANDLE_H
-#define RESOURCE_HANDLE_H
+#ifndef RESOURCE_UNPACK_H
+#define RESOURCE_UNPACK_H
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef USE_MPI
-#include <mpi.h>
-#include <stdlib.h>
-#endif
-
-/*
- * CDI internal handling of resource handles given to user code
- */
-
-/*
- * for reasons of compatibility with cfortran.h, the handle type is: int
- */
-typedef int cdiResH;
-
-/* return 0 on equality, not 0 otherwise */
-typedef int    ( * valCompareFunc     )( void *, void * );
-typedef void   ( * valDestroyFunc     )( void * );
-typedef void   ( * valPrintFunc       )( void *, FILE * );
-#ifdef USE_MPI
-typedef int    ( * valGetPackSizeFunc )( void *, MPI_Comm comm );
-typedef void   ( * valPackFunc        )( void *, void *buf, int size, int *pos, MPI_Comm comm );
-typedef int    ( * valTxCodeFunc      )( void );
-#endif
-
-typedef struct {
-  valCompareFunc     valCompare;
-  valDestroyFunc     valDestroy;
-  valPrintFunc       valPrint;
-#ifdef USE_MPI
-  valGetPackSizeFunc valGetPackSize;
-  valPackFunc        valPack;
-  valTxCodeFunc      valTxCode;
-#endif
-}resOps;
-
-enum { RESH_UNDEFID, ASSIGNED, SUSPENDED, CLOSED };
-
-int    reshPut ( void *, resOps * );
-void   reshRemove ( cdiResH, resOps * );
-
-int    reshCountType ( resOps * );
-
-void * reshGetValue(const char *, cdiResH, resOps * );
-#define reshGetVal(resH, ops)  reshGetValue(__func__, resH, ops)
-
-void   reshGetResHListOfType ( int, int *, resOps * );
-
-#ifdef USE_MPI
-void   reshPackBufferCreate ( char **, int *, MPI_Comm );
-void   reshPackBufferDestroy ( char ** );
+#  include "config.h"
 #endif
 
-void   reshSetStatus ( cdiResH, resOps *, int );
-int    reshGetStatus ( cdiResH, resOps * );
+enum
+{ GRID      = 1,
+  ZAXIS     = 2,
+  TAXIS     = 3,
+  INSTITUTE = 4,
+  MODEL     = 5,
+  STREAM    = 6,
+  VLIST     = 7,
+  START     = 55555555,
+  SEPARATOR = 66666666,
+  DATATOKEN = 77777777,
+  FUNCCALL  = 88888888,
+  END       = 99999999
+};
 
-void   reshLock   ( void );
-void   reshUnlock ( void );
+void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
+                         void *context);
 
 #endif
-/*
- * Local Variables:
- * c-file-style: "Java"
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * show-trailing-whitespace: t
- * require-trailing-newline: t
- * End:
- */
 #ifndef PIO_UTIL_
 #define PIO_UTIL_
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -4817,56 +5123,47 @@ void   reshUnlock ( void );
 #include "mpi.h"
 #endif
 
+#ifndef _ERROR_H
+#include "error.h"
+#endif
 
-#define MAXSTRLNNETCDF    32
-#define MAXBUFFERSIZE     32
-#define MAXVALUE          10
 #define MAXDEBUG           3
-#define MAXLEVELINFOS     10
-#define MAXVARS           10
-
-#define MAXLEVEL          10
-#define MAXLEVELIDX       10
-#define MAXRECORDS        10
-#define MAXRECIDS         10
-#define MAXVARS           10
-#define MAXTSTEPS         10
-#define MAXFNAMES         10
-#define MAXGHBUFFERSIZE_0 10
-#define MAXGHBUFFERSIZE_1 10
-
-#define MAXSTRING        256
-#define MINFILETYPE        1
-#define MAXFILETYPE        9
 
 #define ddebug             0
 
 #define debugString "#####"
 
-/* If we're not using GNU C, elide __attribute__ */
-#ifndef __GNUC__
-#  define  __attribute__(x)  /*NOTHING*/
+#ifdef USE_MPI
+void
+cdiAbortC_MPI(const char * caller, const char * filename,
+              const char *functionname, int line,
+              const char * errorString, va_list ap)
+  __attribute__((noreturn));
 #endif
 
-void pcdiAssert( bool, const char *, const char *, int );
-#define xassert(arg) do {                               \
-    if ((arg)) {                                        \
-    } else {                                            \
-      pcdiAssert(0, __FILE__, __func__, __LINE__ );     \
-    }                                                   \
-  } while(0)
+#ifdef USE_MPI
+static inline int
+callsToMPIAreAllowed()
+{
+  int init_flag = 0, finished_flag = 0;
+  return MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag
+    && MPI_Finalized(&finished_flag) == MPI_SUCCESS && !finished_flag;
+}
+
+static inline int
+getMPICommWorldRank()
+{
+  int rank = -1;
+  if (callsToMPIAreAllowed())
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  return rank;
+}
+#endif
 
 #ifdef USE_MPI
 #define xdebug(fmt, ...)                                                \
   if ( ddebug ){                                                        \
-    int rank;                                                           \
-    {                                                                   \
-      int init_flag;                                                    \
-      if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag)      \
-        MPI_Comm_rank ( MPI_COMM_WORLD, &rank );                        \
-      else                                                              \
-        rank = -1;                                                      \
-    }                                                                   \
+    int rank = getMPICommWorldRank();                                   \
     fprintf ( stderr, "%s pe%d in %s, %s, line %d: " fmt "\n",          \
               debugString, rank,  __func__, __FILE__,  __LINE__,        \
               __VA_ARGS__ );                                            \
@@ -4883,13 +5180,12 @@ void pcdiAssert( bool, const char *, const char *, int );
 
 
 #ifdef USE_MPI
-#define xdebug3(fmt, ...)					\
-  if ( ddebug == MAXDEBUG ){                                    \
-    int rank;                                                   \
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );                    \
-    fprintf ( stderr, "pe%d in %s, %s, line %d: " fmt "\n",     \
-              rank,  __func__, __FILE__,  __LINE__,             \
-              __VA_ARGS__ );                                    \
+#define xdebug3(fmt, ...)                                               \
+  if ( ddebug == MAXDEBUG ){                                            \
+    int rank = getMPICommWorldRank();                                   \
+    fprintf ( stderr, "pe%d in %s, %s, line %d: " fmt "\n",             \
+              rank,  __func__, __FILE__,  __LINE__,                     \
+              __VA_ARGS__ );                                            \
   }
 
 #else
@@ -4900,25 +5196,11 @@ void pcdiAssert( bool, const char *, const char *, int );
               __VA_ARGS__ );                                 \
   }
 #endif
-/*
-#ifdef USE_MPI
-char * outTextComm ( MPI_Comm * );
-
-#define xdebugComm(comm,fmt, ...)				\
-  if ( ddebug ){						\
-    fprintf ( stderr, "%s%s, %s, line %d%s: " fmt "\n",		\
-	      outTextRank (),  __func__, __FILE__,  __LINE__,	\
-	      outTextComm ( comm ),				\
-	      ## __VA_ARGS__  );				\
-    }
-#endif
-*/
 
 #ifdef USE_MPI
 #define xwarning(fmt, ...)						\
   if ( ddebug ){							\
-    int rank;								\
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );				\
+    int rank = getMPICommWorldRank();                                   \
     fprintf ( stderr, "WARNING: pe%d in %s, %s, line %d: " fmt "\n",	\
               rank,  __func__, __FILE__,  __LINE__,			\
               __VA_ARGS__ );						\
@@ -4932,14 +5214,6 @@ char * outTextComm ( MPI_Comm * );
   }
 #endif
 
-void pcdiAbortC(const char *, const char *, const char *, int, const char *, ... )
-  __attribute__((noreturn));
-#define xabortC(caller, ...) pcdiAbortC(caller, __FILE__, __func__, __LINE__, __VA_ARGS__ )
-
-void pcdiAbort (const char *, const char *, int, const char *, ... )
-  __attribute__((noreturn));
-#define xabort(...) pcdiAbort(__FILE__, __func__, __LINE__, __VA_ARGS__ )
-
 void * pcdiXmalloc ( size_t, const char *, const char *, int );
 #define xmalloc(size) pcdiXmalloc ( size, __FILE__, __func__,  __LINE__ )
 
@@ -4951,8 +5225,12 @@ void * pcdiXrealloc ( void *, size_t, const char *, const char *, int );
 #define xrealloc(p,size) pcdiXrealloc(p, size,            \
                                       __FILE__, __func__, __LINE__)
 
-void pcdiXMPI ( int, const char *, int );
-#define xmpi(ret) pcdiXMPI ( ret, __FILE__, __LINE__ )
+void pcdiXMPI(int iret, const char *, int);
+#define xmpi(ret) do {                                  \
+    int tmpIRet = (ret);                                   \
+    if (tmpIRet != MPI_SUCCESS)                            \
+      pcdiXMPI(tmpIRet, __FILE__, __LINE__ );              \
+  } while(0)
 
 #ifdef USE_MPI
 void pcdiXMPIStat ( int, const char *, int, MPI_Status * );
@@ -4990,8 +5268,11 @@ void printArray ( const char *, char *, const void *, int, int, const char *, co
   if ( ddebug == MAXDEBUG )                                                         \
       printArray ( debugString, ps, array, n, datatype,  __func__, __FILE__, __LINE__ )
 
-
-void reshListPrint ( char * );
+/**
+ * @return number of dimensions
+ */
+int
+cdiPioQueryVarDims(int varShape[3], int vlistID, int varID);
 
 #endif
 /*
@@ -5014,13 +5295,17 @@ void reshListPrint ( char * );
 #include <stdlib.h>
 #include <mpi.h>
 
+#include "cdi_int.h"
+
 void   backendCleanup  ( void );
 void   backendInit     ( void );
 void   backendFinalize ( void );
-int    pioFileOpenW    ( const char* );
+int pioFileOpen(const char *filename, const char *mode);
 int    pioFileClose    ( int );
-size_t pioFileWrite    ( int, int, const void*, size_t );
-
+size_t cdiPioFileWrite(int fileID, const void *restrict buffer, size_t len,
+                       int tsID);
+#else
+typedef int MPI_Comm;
 #endif
 
 #endif
@@ -5139,6 +5424,38 @@ void pioWriterStdIO(void);
  * require-trailing-newline: t
  * End:
  */
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifndef SERIALIZE_H
+#define SERIALIZE_H
+
+#include "cdi.h"
+
+/*
+ * Generic interfaces for (de-)marshalling
+ */
+int serializeGetSize(int count, int datatype, void *context);
+void serializePack(void *data, int count, int datatype,
+                   void *buf, int buf_size, int *position, void *context);
+void serializeUnpack(void *buf, int buf_size, int *position,
+                     void *data, int count, int datatype, void *context);
+
+/*
+ * top-level de-marshalling function
+ */
+
+/*
+ * Interfaces for marshalling within a single memory domain
+ */
+int serializeGetSizeInCore(int count, int datatype, void *context);
+void serializePackInCore(void *data, int count, int datatype,
+                          void *buf, int buf_size, int *position, void *context);
+void serializeUnpackInCore(void *buf, int buf_size, int *position,
+                            void *data, int count, int datatype, void *context);
+
+#endif
 #if  defined  (HAVE_CONFIG_H)
 #endif
 
@@ -5770,9 +6087,6 @@ extern void    Free   (const char *caller, const char *file, int line, void *ptr
 #endif
 
 #include <string.h>
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
 
 
 
@@ -5800,17 +6114,13 @@ char *Timeunits[] = {
 static int    taxisCompareP    ( void * taxisptr1, void * taxisptr2 );
 static void   taxisDestroyP    ( void * taxisptr );
 static void   taxisPrintP      ( void * taxisptr, FILE * fp );
-#ifdef USE_MPI
-static int    taxisGetPackSize ( void * taxisptr, MPI_Comm comm );
+static int    taxisGetPackSize ( void * taxisptr, void *context );
 static void   taxisPack        ( void * taxisptr, void *buf, int size,
-				 int *position, MPI_Comm comm );
+				 int *position, void *context );
 static int    taxisTxCode      ( void );
-#endif
 
 resOps taxisOps = { taxisCompareP, taxisDestroyP, taxisPrintP
-#ifdef USE_MPI
                     , taxisGetPackSize, taxisPack, taxisTxCode
-#endif
 };
 
 
@@ -5881,6 +6191,7 @@ void taxisDefaultValue ( taxis_t *taxisptr )
   taxisptr->vtime_ub    = 0;
   taxisptr->name        = NULL;
   taxisptr->longname    = NULL;
+  taxisptr->climatology = FALSE;
 }
 
 static
@@ -6416,7 +6727,7 @@ int taxisInqVtime(int taxisID)
 void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub)
 {
   taxis_t *taxisptr;
-  
+
   taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
 
   taxis_check_ptr(__func__, taxisptr);
@@ -6442,7 +6753,7 @@ void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub)
 
   taxisptr->vtime_lb = vtime_lb;
   taxisptr->vtime_ub = vtime_ub;
- 
+
   taxisptr->has_bounds = TRUE;
 }
 
@@ -6965,20 +7276,21 @@ void ptaxisCopy(taxis_t *dest, taxis_t *source)
   reshLock ();
 
   /* memcpy(dest, source, sizeof(taxis_t)); */
-  dest->used       = source->used;
-  dest->type       = source->type;
-  dest->vdate      = source->vdate;
-  dest->vtime      = source->vtime;
-  dest->rdate      = source->rdate;
-  dest->rtime      = source->rtime;
-  dest->calendar   = source->calendar;
-  dest->unit       = source->unit;
-  dest->numavg     = source->numavg;
-  dest->has_bounds = source->has_bounds;
-  dest->vdate_lb   = source->vdate_lb;
-  dest->vtime_lb   = source->vtime_lb;
-  dest->vdate_ub   = source->vdate_ub;
-  dest->vtime_ub   = source->vtime_ub;
+  dest->used        = source->used;
+  dest->type        = source->type;
+  dest->vdate       = source->vdate;
+  dest->vtime       = source->vtime;
+  dest->rdate       = source->rdate;
+  dest->rtime       = source->rtime;
+  dest->calendar    = source->calendar;
+  dest->unit        = source->unit;
+  dest->numavg      = source->numavg;
+  dest->has_bounds  = source->has_bounds;
+  dest->vdate_lb    = source->vdate_lb;
+  dest->vtime_lb    = source->vtime_lb;
+  dest->vdate_ub    = source->vdate_ub;
+  dest->vtime_ub    = source->vtime_ub;
+  dest->climatology = source->climatology;
 
   reshUnlock ();
 }
@@ -6997,21 +7309,22 @@ void taxisPrintKernel ( taxis_t * taxisptr, FILE * fp )
   fprintf ( fp, "#\n");
   fprintf ( fp, "# taxisID %d\n", taxisptr->self);
   fprintf ( fp, "#\n");
-  fprintf ( fp, "self       = %d\n", taxisptr->self );
-  fprintf ( fp, "used       = %d\n", taxisptr->used );
-  fprintf ( fp, "type       = %d\n", taxisptr->type );
-  fprintf ( fp, "vdate      = %d\n", taxisptr->vdate );
-  fprintf ( fp, "vtime      = %d\n", taxisptr->vtime );
-  fprintf ( fp, "rdate      = %d\n", taxisptr->rdate );
-  fprintf ( fp, "rtime      = %d\n", taxisptr->rtime );
-  fprintf ( fp, "calendar   = %d\n", taxisptr->calendar );
-  fprintf ( fp, "unit       = %d\n", taxisptr->unit );
-  fprintf ( fp, "numavg     = %d\n", taxisptr->numavg );
-  fprintf ( fp, "has_bounds = %d\n", taxisptr->has_bounds );
-  fprintf ( fp, "vdate_lb   = %d\n", vdate_lb );
-  fprintf ( fp, "vtime_lb   = %d\n", vtime_lb );
-  fprintf ( fp, "vdate_ub   = %d\n", vdate_ub );
-  fprintf ( fp, "vtime_ub   = %d\n", vtime_ub );
+  fprintf ( fp, "self        = %d\n", taxisptr->self );
+  fprintf ( fp, "used        = %d\n", taxisptr->used );
+  fprintf ( fp, "type        = %d\n", taxisptr->type );
+  fprintf ( fp, "vdate       = %d\n", taxisptr->vdate );
+  fprintf ( fp, "vtime       = %d\n", taxisptr->vtime );
+  fprintf ( fp, "rdate       = %d\n", taxisptr->rdate );
+  fprintf ( fp, "rtime       = %d\n", taxisptr->rtime );
+  fprintf ( fp, "calendar    = %d\n", taxisptr->calendar );
+  fprintf ( fp, "unit        = %d\n", taxisptr->unit );
+  fprintf ( fp, "numavg      = %d\n", taxisptr->numavg );
+  fprintf ( fp, "climatology = %d\n", taxisptr->climatology );
+  fprintf ( fp, "has_bounds  = %d\n", taxisptr->has_bounds );
+  fprintf ( fp, "vdate_lb    = %d\n", vdate_lb );
+  fprintf ( fp, "vtime_lb    = %d\n", vtime_lb );
+  fprintf ( fp, "vdate_ub    = %d\n", vdate_ub );
+  fprintf ( fp, "vtime_ub    = %d\n", vtime_ub );
   fprintf ( fp, "\n");
 }
 
@@ -7038,116 +7351,150 @@ int taxisCompareP ( void *  taxisptr1, void * taxisptr2 )
   xassert ( t1 );
   xassert ( t2 );
 
-  return ! ( t1->used       == t2->used       &&
-	     t1->type       == t2->type       &&
-	     t1->vdate      == t2->vdate      &&
-	     t1->vtime      == t2->vtime      &&
-	     t1->rdate      == t2->rdate      &&
-	     t1->rtime      == t2->rtime      &&
-	     t1->calendar   == t2->calendar   &&
-	     t1->unit       == t2->unit       &&
-	     t1->numavg     == t2->numavg     &&
-	     t1->has_bounds == t2->has_bounds &&
-	     t1->vdate_lb   == t2->vdate_lb   &&
-	     t1->vtime_lb   == t2->vtime_lb   &&
-	     t1->vdate_ub   == t2->vdate_ub   &&
-	     t1->vtime_ub   == t2->vtime_ub );
+  return ! ( t1->used        == t2->used        &&
+	     t1->type        == t2->type        &&
+	     t1->vdate       == t2->vdate       &&
+	     t1->vtime       == t2->vtime       &&
+	     t1->rdate       == t2->rdate       &&
+	     t1->rtime       == t2->rtime       &&
+	     t1->calendar    == t2->calendar    &&
+	     t1->unit        == t2->unit        &&
+	     t1->numavg      == t2->numavg      &&
+	     t1->climatology == t2->climatology &&
+	     t1->has_bounds  == t2->has_bounds  &&
+	     t1->vdate_lb    == t2->vdate_lb    &&
+	     t1->vtime_lb    == t2->vtime_lb    &&
+	     t1->vdate_ub    == t2->vdate_ub    &&
+	     t1->vtime_ub    == t2->vtime_ub );
 }
 
 
-#ifdef USE_MPI
 static int
 taxisTxCode ( void )
 {
   return TAXIS;
 }
 
-enum { taxisNint = 15 };
-
-static
-int taxisGetPackSize ( void * voidP, MPI_Comm comm )
-{
-  int packBufferSize = 0, size;
-
-  xmpi ( MPI_Pack_size ( taxisNint, MPI_INT, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
+enum { taxisNint = 18 };
 
+static int
+taxisGetPackSize(void *p, void *context)
+{
+  taxis_t *taxisptr = p;
+  int packBufferSize
+    = serializeGetSize(taxisNint, DATATYPE_INT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context)
+    + (taxisptr->name ?
+       serializeGetSize(strlen(taxisptr->name), DATATYPE_TXT, context) : 0)
+    + (taxisptr->longname ?
+       serializeGetSize(strlen(taxisptr->longname), DATATYPE_TXT,
+                        context) : 0);
   return packBufferSize;
 }
 
-
-void taxisUnpack ( char * unpackBuffer, int unpackBufferSize,
-		   int * unpackBufferPos, int nspTarget, MPI_Comm comm )
+int
+taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
+            int nspTarget, void *context, int checkForSameID)
 {
   taxis_t * taxisP;
   int intBuffer[taxisNint];
   double d;
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-		      intBuffer, taxisNint, MPI_INT, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-		      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  intBuffer, taxisNint, DATATYPE_INT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( xchecksum ( DATATYPE_INT, taxisNint, intBuffer ) == d );
+  xassert(xchecksum(DATATYPE_INT, taxisNint, intBuffer) == d);
 
-  taxisInit ();
+  taxisInit();
 
   taxisP = taxisNewEntry();
   if ( ! taxisP ) Error("No memory");
 
-  xassert ( namespaceAdaptKey ( intBuffer[0], nspTarget ) == taxisP->self );
+  xassert(!checkForSameID
+          || namespaceAdaptKey(intBuffer[0], nspTarget) == taxisP->self);
+
+  taxisP->used        = intBuffer[1];
+  taxisP->type        = intBuffer[2];
+  taxisP->vdate       = intBuffer[3];
+  taxisP->vtime       = intBuffer[4];
+  taxisP->rdate       = intBuffer[5];
+  taxisP->rtime       = intBuffer[6];
+  taxisP->calendar    = intBuffer[7];
+  taxisP->unit        = intBuffer[8];
+  taxisP->numavg      = intBuffer[9];
+  taxisP->has_bounds  = intBuffer[10];
+  taxisP->vdate_lb    = intBuffer[11];
+  taxisP->vtime_lb    = intBuffer[12];
+  taxisP->vdate_ub    = intBuffer[13];
+  taxisP->vtime_ub    = intBuffer[14];
+  if (intBuffer[15])
+    {
+      size_t len = intBuffer[15];
+      char *name = xmalloc(len + 1);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      name, len, DATATYPE_TXT, context);
+      name[len] = '\0';
+      taxisP->name = name;
+    }
+  if (intBuffer[16])
+    {
+      size_t len = intBuffer[16];
+      char *longname = xmalloc(len + 1);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      longname, len, DATATYPE_TXT, context);
+      longname[len] = '\0';
+      taxisP->longname = longname;
+    }
+
+  taxisP->climatology = intBuffer[17];
 
-  taxisP->used       = intBuffer[1];
-  taxisP->type       = intBuffer[2];
-  taxisP->vdate      = intBuffer[3];
-  taxisP->vtime      = intBuffer[4];
-  taxisP->rdate      = intBuffer[5];
-  taxisP->rtime      = intBuffer[6];
-  taxisP->calendar   = intBuffer[7];
-  taxisP->unit       = intBuffer[8];
-  taxisP->numavg     = intBuffer[9];
-  taxisP->has_bounds = intBuffer[10];
-  taxisP->vdate_lb   = intBuffer[11];
-  taxisP->vtime_lb   = intBuffer[12];
-  taxisP->vdate_ub   = intBuffer[13];
-  taxisP->vtime_ub   = intBuffer[14];
+  return taxisP->self;
 }
 
 
-static
-void taxisPack ( void * voidP, void * packBuffer, int packBufferSize,
-		 int * packBufferPos, MPI_Comm comm )
+static void
+taxisPack(void * voidP, void * packBuffer, int packBufferSize, int * packBufferPos,
+          void *context)
 {
-  taxis_t   * taxisP = ( taxis_t * ) voidP;
+  taxis_t *taxisP = (taxis_t *)voidP;
   int intBuffer[taxisNint];
   double d;
 
-  intBuffer[0]  = taxisP->self; 
-  intBuffer[1]  = taxisP->used;      
-  intBuffer[2]  = taxisP->type;      
-  intBuffer[3]  = taxisP->vdate;     
-  intBuffer[4]  = taxisP->vtime;     
-  intBuffer[5]  = taxisP->rdate;     
-  intBuffer[6]  = taxisP->rtime;     
-  intBuffer[7]  = taxisP->calendar;  
-  intBuffer[8]  = taxisP->unit;      
-  intBuffer[9]  = taxisP->numavg;    
+  intBuffer[0]  = taxisP->self;
+  intBuffer[1]  = taxisP->used;
+  intBuffer[2]  = taxisP->type;
+  intBuffer[3]  = taxisP->vdate;
+  intBuffer[4]  = taxisP->vtime;
+  intBuffer[5]  = taxisP->rdate;
+  intBuffer[6]  = taxisP->rtime;
+  intBuffer[7]  = taxisP->calendar;
+  intBuffer[8]  = taxisP->unit;
+  intBuffer[9]  = taxisP->numavg;
   intBuffer[10] = taxisP->has_bounds;
-  intBuffer[11] = taxisP->vdate_lb;  
-  intBuffer[12] = taxisP->vtime_lb;  
-  intBuffer[13] = taxisP->vdate_ub;  
-  intBuffer[14] = taxisP->vtime_ub;  
-  
-  xmpi ( MPI_Pack ( intBuffer, taxisNint, MPI_INT, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT, taxisNint, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
+  intBuffer[11] = taxisP->vdate_lb;
+  intBuffer[12] = taxisP->vtime_lb;
+  intBuffer[13] = taxisP->vdate_ub;
+  intBuffer[14] = taxisP->vtime_ub;
+  intBuffer[15] = taxisP->name ? strlen(taxisP->name) : 0;
+  intBuffer[16] = taxisP->longname ? strlen(taxisP->longname) : 0;
+
+  serializePack(intBuffer, taxisNint, DATATYPE_INT,
+                packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_INT, taxisNint, intBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
+  if (taxisP->name)
+    serializePack(taxisP->name, intBuffer[15], DATATYPE_TXT,
+                  packBuffer, packBufferSize, packBufferPos, context);
+  if (taxisP->longname)
+    serializePack(taxisP->longname, intBuffer[16], DATATYPE_TXT,
+                  packBuffer, packBufferSize, packBufferPos, context);
+
+  intBuffer[17] = taxisP->climatology;
 }
 
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -7866,16 +8213,13 @@ static void modelInit(void);
 static int    modelCompareP ( void * modelptr1, void * modelptr2 );
 static void   modelDestroyP ( void * modelptr );
 static void   modelPrintP   ( void * modelptr, FILE * fp );
-#ifdef USE_MPI
-static int    modelGetSizeP ( void * modelptr, MPI_Comm comm );
-static void   modelPackP    ( void * modelptr, void * buff, int size, int *position, MPI_Comm comm);
+static int    modelGetSizeP ( void * modelptr, void *context);
+static void   modelPackP    ( void * modelptr, void * buff, int size,
+                              int *position, void *context);
 static int    modelTxCode   ( void );
-#endif
 
 resOps modelOps = { modelCompareP, modelDestroyP, modelPrintP
-#ifdef USE_MPI
                     , modelGetSizeP, modelPackP, modelTxCode
-#endif
 };
 
 static
@@ -7935,9 +8279,8 @@ void modelDefaultEntries ( void )
   instID  = institutInq(  0,   1, "NCEP", NULL);
   resH[9] = modelDef(instID,  80, "T62L28MRF");
   
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    for ( i = 0; i < 10 ; i++ )
-      reshSetStatus ( resH[i], &modelOps, SUSPENDED );  
+  for ( i = 0; i < 10 ; i++ )
+    reshSetStatus(resH[i], &modelOps, SUSPENDED);
 }
 
 static
@@ -7978,59 +8321,65 @@ int modelSize ( void )
   return reshCountType ( &modelOps );
 }
 
-
-int modelInq(int instID, int modelgribID, char *name)
+struct modelLoc
 {
-  int modelID = UNDEFID;
-  size_t len;
-  int found;
-  int modelCount;
-  model_t *modelptr;
-  int i, * modelResHs;
-
-  modelInit ();
-
-  modelCount = modelSize();
-  modelResHs = xmalloc ( modelCount * sizeof ( int ));
-  reshGetResHListOfType ( modelCount, modelResHs, &modelOps );
+  char *name;
+  int instID, modelgribID, resID;
+};
 
-  for( i = 0; i < modelCount; i++ )
+static enum cdiApplyRet
+findModelByID(int resID, void *res, void *data)
+{
+  model_t *modelptr = res;
+  struct modelLoc *ret = data;
+  int instID = ret->instID, modelgribID = ret->modelgribID;
+  if (modelptr->used
+      && modelptr->instID == instID
+      && modelptr->modelgribID == modelgribID)
     {
-      modelID = modelResHs[i];
-      modelptr = ( model_t * ) reshGetVal ( modelID, &modelOps );
+      ret->resID = resID;
+      return CDI_APPLY_STOP;
+    }
+  else
+    return CDI_APPLY_GO_ON;
+}
 
-      if ( modelptr->used )
+static enum cdiApplyRet
+findModelByName(int resID, void *res, void *data)
+{
+  model_t *modelptr = res;
+  struct modelLoc *ret = data;
+  int instID = ret->instID, modelgribID = ret->modelgribID;
+  const char *name = ret->name;
+  if (modelptr->used
+      && (instID == -1 || modelptr->instID == instID)
+      && (modelgribID == 0 || modelptr->modelgribID == modelgribID)
+      && modelptr->name)
+    {
+      const char *p = name, *q = modelptr->name;
+      while (*p != '\0' && *p == *q)
+        ++p, ++q;
+      if (*p == '\0' || *q == '\0')
         {
-          if ( name && *name )
-            {
-              found = 1;
-              if ( instID      != -1 && modelptr->instID      != instID )      found = 0;
-              if ( modelgribID !=  0 && modelptr->modelgribID != modelgribID ) found = 0;
-
-              if ( found )
-                {
-                  if ( modelptr->name )
-                    {
-                      len = strlen(modelptr->name);
-                      if ( strncmp(modelptr->name, name, len) == 0 ) break;
-                      len = strlen(name);
-                      if ( strncmp(modelptr->name, name, len) == 0 ) break;
-                    }
-                }
-            }
-          else
-            {
-              if ( modelptr->instID      == instID &&
-                   modelptr->modelgribID == modelgribID ) break;
-            }
+          ret->resID = resID;
+          return CDI_APPLY_STOP;
         }
     }
+  return CDI_APPLY_GO_ON;
+}
 
-  if ( i == modelCount ) modelID = UNDEFID;
-
-  if ( modelResHs ) free ( modelResHs );
+int modelInq(int instID, int modelgribID, char *name)
+{
+  modelInit ();
 
-  return (modelID);
+  struct modelLoc searchState = { .name = name, .instID = instID,
+                                  .modelgribID = modelgribID,
+                                  .resID = UNDEFID };
+  if (name && *name)
+    cdiResHFilterApply(&modelOps, findModelByName, &searchState);
+  else
+    cdiResHFilterApply(&modelOps, findModelByID, &searchState);
+  return searchState.resID;
 }
 
 
@@ -8117,8 +8466,6 @@ void modelPrintP   ( void * modelptr, FILE * fp )
 }
 
 
-#ifdef USE_MPI
-
 static int
 modelTxCode ( void )
 {
@@ -8130,49 +8477,50 @@ enum {
 };
 
 
-static
-int modelGetSizeP ( void * modelptr, MPI_Comm comm )
+static int modelGetSizeP(void * modelptr, void *context)
 {
   model_t *p = modelptr;
-  int txsize = 0, txinc;
-  xmpi(MPI_Pack_size(model_nints, MPI_INT, comm, &txsize));
-  xmpi(MPI_Pack_size(strlen(p->name) + 1, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
+  int txsize = serializeGetSize(model_nints, DATATYPE_INT, context)
+    + serializeGetSize(p->name?strlen(p->name) + 1:0, DATATYPE_TXT, context);
   return txsize;
 }
 
 
-static
-void modelPackP ( void * modelptr, void * buf, int size,
-                  int *position, MPI_Comm comm )
+static void modelPackP(void * modelptr, void * buf, int size, int *position, void *context)
 {
   model_t *p = modelptr;
   int tempbuf[model_nints];
   tempbuf[0] = p->self;
   tempbuf[1] = p->instID;
   tempbuf[2] = p->modelgribID;
-  tempbuf[3] = (int)strlen(p->name) + 1;
-  xmpi(MPI_Pack(tempbuf, model_nints, MPI_INT, buf, size, position, comm));
-  xmpi(MPI_Pack(p->name, tempbuf[3], MPI_CHAR, buf, size, position, comm));
+  tempbuf[3] = p->name ? (int)strlen(p->name) + 1 : 0;
+  serializePack(tempbuf, model_nints, DATATYPE_INT, buf, size, position, context);
+  if (p->name)
+    serializePack(p->name, tempbuf[3], DATATYPE_TXT, buf, size, position, context);
 }
 
 int
-modelUnpack(void *buf, int size, int *position, int nspTarget,
-            MPI_Comm comm)
+modelUnpack(void *buf, int size, int *position, int nspTarget, void *context)
 {
   int tempbuf[model_nints];
   int modelID;
   char *name;
-  xmpi(MPI_Unpack(buf, size, position, tempbuf, model_nints, MPI_INT, comm));
-  name = xmalloc(tempbuf[3]);
-  xmpi(MPI_Unpack(buf, size, position, name, tempbuf[3], MPI_CHAR, comm));
+  serializeUnpack(buf, size, position, tempbuf, model_nints, DATATYPE_INT, context);
+  if (tempbuf[3] != 0)
+    {
+      name = xmalloc(tempbuf[3]);
+      serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
+    }
+  else
+    {
+      name = "";
+    }
   modelID = modelDef( namespaceAdaptKey ( tempbuf[1], nspTarget ), tempbuf[2], name);
   // FIXME: this should work, once all types are transferred
   //assert(modelID == tempbuf[0]);
   return modelID;
 }
 
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -8209,16 +8557,12 @@ institute_t;
 static int    instituteCompareP ( void * instituteptr1, void * instituteptr2 );
 static void   instituteDestroyP ( void * instituteptr );
 static void   institutePrintP   ( void * instituteptr, FILE * fp );
-#ifdef USE_MPI
-static int    instituteGetSizeP ( void * instituteptr, MPI_Comm comm );
-static void   institutePackP    ( void * instituteptr, void *buf, int size, int *position, MPI_Comm comm );
+static int    instituteGetSizeP ( void * instituteptr, void *context );
+static void   institutePackP    ( void * instituteptr, void *buf, int size, int *position, void *context );
 static int    instituteTxCode   ( void );
-#endif
 
 resOps instituteOps = { instituteCompareP, instituteDestroyP, institutePrintP
-#ifdef USE_MPI
                         ,instituteGetSizeP, institutePackP, instituteTxCode
-#endif
  };
 
 static int * instituteInitializedNsp;
@@ -8268,9 +8612,8 @@ void instituteDefaultEntries ( void )
   resH[11] =           institutDef( 99,   0, "KNMI",      "Royal Netherlands Meteorological Institute");
   /*     (void) institutDef(  0,   0, "IPSL", "IPSL (Institut Pierre Simon Laplace, Paris, France)"); */
 
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    for ( i = 0; i < 12 ; i++ )
-      reshSetStatus ( resH[i], &instituteOps, SUSPENDED );
+  for ( i = 0; i < 12 ; i++ )
+    reshSetStatus(resH[i], &instituteOps, SUSPENDED);
 }
 
 static
@@ -8358,48 +8701,45 @@ static int instituteCompareP ( void *  instituteptr1, void * instituteptr2 )
   return instituteCompareKernel ( i1, i2 );
 }
 
-
-int institutInq(int center, int subcenter, const char *name, const char *longname)
+struct instLoc
 {
-  int instID = UNDEFID, instCount, * instResHs, i;
-  institute_t * ip1;
-  institute_t * ip2;
-
-  instituteInit ();
+  institute_t *ip;
+  int id;
+};
 
-  ip1 = xmalloc ( sizeof ( institute_t ));
+static enum cdiApplyRet
+findInstitute(int id, void *res, void *data)
+{
+  institute_t * ip1 = ((struct instLoc *)data)->ip;
+  institute_t * ip2 = res;
+  if (ip2->used && !instituteCompareKernel(ip1, ip2))
+    {
+      ((struct instLoc *)data)->id = id;
+      return CDI_APPLY_STOP;
+    }
+  else
+    return CDI_APPLY_GO_ON;
+}
 
-  ip1->self       = UNDEFID;
-  ip1->used       = 0;
-  ip1->center     = center;
-  ip1->subcenter  = subcenter;
-  ip1->name       = NULL;
-  ip1->longname   = NULL;
-  if ( name && *name )
-    ip1->name     = ( char * ) name;
-  if ( longname && *longname )
-    ip1->longname = ( char * ) longname;
 
-  instCount = instituteCount ();
-  instResHs = xmalloc ( instCount * sizeof ( int ));
-  reshGetResHListOfType ( instCount, instResHs, &instituteOps );
+int institutInq(int center, int subcenter, const char *name, const char *longname)
+{
+  instituteInit ();
 
-  for ( i = 0; i < instCount; i++ )
-    {
-      ip2 = ( institute_t * ) reshGetVal ( instResHs[i], &instituteOps );
-      xassert ( ip2 );
+  institute_t * ip_ref = xmalloc(sizeof (*ip_ref));
+  ip_ref->self       = UNDEFID;
+  ip_ref->used       = 0;
+  ip_ref->center     = center;
+  ip_ref->subcenter  = subcenter;
+  ip_ref->name       = name && name[0] ? (char *)name : NULL;
+  ip_ref->longname   = longname && longname[0] ? (char *)longname : NULL;
 
-      if ( ip2->used && ! instituteCompareKernel ( ip1, ip2 ))
-        {
-          instID = ip2->self;
-          break;
-        }
-    }
+  struct instLoc state = { .ip = ip_ref, .id = UNDEFID };
+  cdiResHFilterApply(&instituteOps, findInstitute, &state);
 
-  free ( instResHs );
-  free ( ip1 );
+  free(ip_ref);
 
-  return  (instID);
+  return state.id;
 }
 
 
@@ -8471,27 +8811,21 @@ char *institutInqLongnamePtr(int instID)
   return instituteptr ? instituteptr->longname : NULL;
 }
 
+static enum cdiApplyRet
+activeInstitutes(int id, void *res, void *data)
+{
+  if (res && ((institute_t *)res)->used)
+    ++(*(int *)data);
+  return CDI_APPLY_GO_ON;
+}
 
 int institutInqNumber(void)
 {
-  int i, instCount, * instResHs, instNum = 0;
-  institute_t * instituteptr;
+  int instNum = 0;
 
   instituteInit ();
 
-  instCount = reshCountType ( &instituteOps );
-  instResHs = xmalloc ( instCount * sizeof ( int ));
-  reshGetResHListOfType ( instCount, instResHs, &instituteOps );
-
-  for ( i = 0; i < instCount; i++ )
-    {
-      instituteptr = ( institute_t * ) reshGetVal ( instResHs[i], &instituteOps );
-      if ( instituteptr && instituteptr->used )
-        instNum++;
-    }
-
-  if ( instResHs ) free ( instResHs );
-
+  cdiResHFilterApply(&instituteOps, activeInstitutes, &instNum);
   return instNum;
 }
 
@@ -8529,7 +8863,6 @@ void institutePrintP   ( void * instituteptr, FILE * fp )
 }
 
 
-#ifdef USE_MPI
 static int
 instituteTxCode ( void )
 {
@@ -8540,22 +8873,16 @@ enum {
   institute_nints = 5,
 };
 
-static
-int instituteGetSizeP ( void * instituteptr, MPI_Comm comm )
+static int instituteGetSizeP ( void * instituteptr, void *context)
 {
   institute_t *p = instituteptr;
-  int txsize = 0, txinc;
-  xmpi(MPI_Pack_size(institute_nints, MPI_INT, comm, &txsize));
-  xmpi(MPI_Pack_size(strlen(p->name) + 1, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
-  xmpi(MPI_Pack_size(strlen(p->longname) + 1, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
+  int txsize = serializeGetSize(institute_nints, DATATYPE_INT, context)
+    + serializeGetSize(strlen(p->name) + 1, DATATYPE_TXT, context)
+    + serializeGetSize(strlen(p->longname) + 1, DATATYPE_TXT, context);
   return txsize;
 }
 
-static
-void institutePackP ( void * instituteptr, void *buf, int size,
-                      int *position, MPI_Comm comm )
+static void institutePackP(void * instituteptr, void *buf, int size, int *position, void *context)
 {
   institute_t *p = instituteptr;
   int tempbuf[institute_nints];
@@ -8564,30 +8891,27 @@ void institutePackP ( void * instituteptr, void *buf, int size,
   tempbuf[2] = p->subcenter;
   tempbuf[3] = (int)strlen(p->name) + 1;
   tempbuf[4] = (int)strlen(p->longname) + 1;
-  xmpi(MPI_Pack(tempbuf, institute_nints, MPI_INT, buf, size, position, comm));
-  xmpi(MPI_Pack(p->name, tempbuf[3], MPI_CHAR, buf, size, position, comm));
-  xmpi(MPI_Pack(p->longname, tempbuf[4], MPI_CHAR, buf, size, position, comm));
+  serializePack(tempbuf, institute_nints, DATATYPE_INT, buf, size, position, context);
+  serializePack(p->name, tempbuf[3], DATATYPE_TXT, buf, size, position, context);
+  serializePack(p->longname, tempbuf[4], DATATYPE_TXT, buf, size, position, context);
 }
 
-int
-instituteUnpack(void *buf, int size, int *position, int nspTarget,
-                MPI_Comm comm)
+int instituteUnpack(void *buf, int size, int *position, int nspTarget, void *context)
 {
   int tempbuf[institute_nints];
   int instituteID;
   char *name, *longname;
-  xmpi(MPI_Unpack(buf, size, position, tempbuf, institute_nints, MPI_INT, comm));
+  serializeUnpack(buf, size, position, tempbuf, institute_nints, DATATYPE_INT, context);
   name = xmalloc(tempbuf[3]);
   longname = xmalloc(tempbuf[4]);
-  xmpi(MPI_Unpack(buf, size, position, name, tempbuf[3], MPI_CHAR, comm));
-  xmpi(MPI_Unpack(buf, size, position, longname, tempbuf[4], MPI_CHAR, comm));
+  serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
+  serializeUnpack(buf, size, position, longname, tempbuf[4], DATATYPE_TXT, context);
   instituteID = institutDef(tempbuf[1], tempbuf[2], name, longname);
   // FIXME: this should work, once all types are transferred
   //xassert(instituteID == tempbuf[0]);
   return instituteID;
 }
 
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -8741,6 +9065,7 @@ int decodeForm1(char *pline, char *name, char *longname, char *units)
   char *pstart, *pend;
   long len;
 
+  /* FIXME: parse success isn't verified */
   level = strtol(pline, &pline, 10);
   while ( isspace((int) *pline) ) pline++;
 
@@ -8758,7 +9083,9 @@ int decodeForm1(char *pline, char *name, char *longname, char *units)
   len = strlen(pline);
   if ( len == 0 ) return (0);
 
+  /* FIXME: successful parse isn't verified */
   add  = strtod(pline, &pline);
+  /* FIXME: successful parse isn't verified */
   mult = strtod(pline, &pline);
 
   while ( isspace((int) *pline) ) pline++;
@@ -10061,41 +10388,42 @@ leveltable_t;
 
 typedef struct
 {
-  int         param;
-  int         prec;
-  int         tsteptype;
-  int         timave;
-  int         timaccu;
-  int         gridID;
-  int         zaxistype;
-  int         ltype;     /* GRIB level type */
-  int         lbounds;
-  int         level_sf;
-  int         level_unit;
-  int         zaxisID;
-  int         nlevels;
-  int         levelTableSize;
+  int           param;
+  int           prec;
+  int           tsteptype;
+  int           timave;
+  int           timaccu;
+  int           gridID;
+  int           zaxistype;
+  int           ltype;     /* GRIB level type */
+  int           lbounds;
+  int           level_sf;
+  int           level_unit;
+  int           zaxisID;
+  int           nlevels;
+  int           levelTableSize;
   leveltable_t *levelTable;
-  int         instID;
-  int         modelID;
-  int         tableID;
-  int         comptype;       // compression type
-  int         complevel;      // compression level
-  int         lmissval;
-  double      missval;
-  char       *name;
-  char       *longname;
-  char       *units;
-  ensinfo_t  *ensdata;
+  int           instID;
+  int           modelID;
+  int           tableID;
+  int           comptype;       // compression type
+  int           complevel;      // compression level
+  int           lmissval;
+  double        missval;
+  char         *name;
+  char         *longname;
+  char         *units;
+  ensinfo_t    *ensdata;
+  int           typeOfGeneratingProcess;
 #if  defined  (HAVE_LIBGRIB_API)
   /* (Optional) list of keyword/double value pairs */
-  int    opt_grib_dbl_nentries;
-  char*  opt_grib_dbl_keyword[MAX_OPT_GRIB_ENTRIES];
-  double opt_grib_dbl_val[MAX_OPT_GRIB_ENTRIES];
+  int           opt_grib_dbl_nentries;
+  char         *opt_grib_dbl_keyword[MAX_OPT_GRIB_ENTRIES];
+  double        opt_grib_dbl_val[MAX_OPT_GRIB_ENTRIES];
   /* (Optional) list of keyword/integer value pairs */
-  int    opt_grib_int_nentries;
-  char*  opt_grib_int_keyword[MAX_OPT_GRIB_ENTRIES];
-  int    opt_grib_int_val[MAX_OPT_GRIB_ENTRIES];
+  int           opt_grib_int_nentries;
+  char         *opt_grib_int_keyword[MAX_OPT_GRIB_ENTRIES];
+  int           opt_grib_int_val[MAX_OPT_GRIB_ENTRIES];
 #endif
 }
 vartable_t;
@@ -10127,6 +10455,7 @@ void paramInitEntry(int varID, int param)
   vartable[varID].instID         = UNDEFID;
   vartable[varID].modelID        = UNDEFID;
   vartable[varID].tableID        = UNDEFID;
+  vartable[varID].typeOfGeneratingProcess  = UNDEFID;
   vartable[varID].comptype       = COMPRESS_NONE;
   vartable[varID].complevel      = 1;
   vartable[varID].lmissval       = 0;
@@ -10593,6 +10922,13 @@ void cdi_generate_vars(stream_t *streamptr)
       zaxisID = varDefZaxis(vlistID, zaxistype, nlevels, dlevels, lbounds, dlevels1, dlevels2,
                             Vctsize, Vct, NULL, NULL, unitptr, 0, 0, ltype);
 
+      if ( zaxisInqType(zaxisID) == ZAXIS_REFERENCE )
+        {
+          if ( numberOfVerticalLevels > 0 ) zaxisDefNlevRef(zaxisID, numberOfVerticalLevels);
+          if ( numberOfVerticalGrid > 0 ) zaxisDefNumber(zaxisID, numberOfVerticalGrid);
+          if ( uuidVGrid[0] != 0 ) zaxisDefUUID(zaxisID, uuidVGrid);
+        }
+
       if ( lbounds ) free(dlevels1);
       if ( lbounds ) free(dlevels2);
       free(dlevels);
@@ -10606,6 +10942,9 @@ void cdi_generate_vars(stream_t *streamptr)
       vlistDefVarTimaccu(vlistID, varID, timaccu);
       vlistDefVarCompType(vlistID, varID, comptype);
 
+      if ( vartable[varid].typeOfGeneratingProcess != UNDEFID )
+        vlistDefVarTypeOfGeneratingProcess(vlistID, varID, vartable[varid].typeOfGeneratingProcess);
+
       if ( vartable[varid].lmissval ) vlistDefVarMissval(vlistID, varID, vartable[varid].missval);
 
       if ( vartable[varid].name )     vlistDefVarName(vlistID, varID, vartable[varid].name);
@@ -10722,9 +11061,9 @@ void varDefVCT(size_t vctsize, double *vctptr)
 }
 
 
-void varDefZAxisReference(int nlev, int nvgrid, char *uuid)
+void varDefZAxisReference(int nhlev, int nvgrid, char *uuid)
 {
-  numberOfVerticalLevels = nlev;
+  numberOfVerticalLevels = nhlev;
   numberOfVerticalGrid = nvgrid;
   memcpy(uuidVGrid, uuid, 16);
 }
@@ -11019,6 +11358,12 @@ void varDefEnsembleInfo(int varID, int ens_idx, int ens_count, int forecast_type
 }
 
 
+void varDefTypeOfGeneratingProcess(int varID, int typeOfGeneratingProcess)
+{
+  vartable[varID].typeOfGeneratingProcess = typeOfGeneratingProcess;
+}
+
+
 void varDefOptGribInt(int varID, long lval, const char *keyword)
 {
 #if  defined  (HAVE_LIBGRIB_API)
@@ -11065,6 +11410,7 @@ int varOptGribNentries(int varID)
 #endif
 
 
+
 #if  defined  (HAVE_LIBGRIB_API)
 /* list of additional GRIB2 keywords which are read by the open process */
 int    cdiNAdditionalGRIBKeys = 0;
@@ -11075,7 +11421,6 @@ extern void zaxisGetIndexList ( int, int * );
 
 static int VLIST_Debug = 0;
 
-static int vlistIsInitialized = 0;
 static void vlist_initialize(void);
 
 #if  defined  (HAVE_LIBPTHREAD)
@@ -11088,8 +11433,10 @@ static pthread_once_t  _vlist_init_thread = PTHREAD_ONCE_INIT;
 
 #else
 
+static int vlistIsInitialized = 0;
+
 #  define VLIST_INIT()               \
-  if ( vlistIsInitialized == FALSE ) vlist_initialize()
+  if ( !vlistIsInitialized ) vlist_initialize()
 #endif
 
 
@@ -11107,22 +11454,21 @@ vlist_compare(vlist_t *a, vlist_t *b)
 
 static void
 vlistPrintKernel(vlist_t *vlistptr, FILE * fp );
-#ifdef USE_MPI
-static int  vlistGetSizeP ( void * vlistptr, MPI_Comm comm );
+static void
+vlist_delete(vlist_t *vlistptr);
+
+static int  vlistGetSizeP ( void * vlistptr, void *context);
 static void vlistPackP    ( void * vlistptr, void * buff, int size,
-                            int *position, MPI_Comm comm );
+                            int *position, void *context);
 static int  vlistTxCode   ( void );
-#endif
 
 resOps vlist_ops = {
   (valCompareFunc)vlist_compare,
-  free,
+  (valDestroyFunc)vlist_delete,
   (valPrintFunc)vlistPrintKernel
-#ifdef USE_MPI
   , vlistGetSizeP,
   vlistPackP,
   vlistTxCode
-#endif
 };
 
 
@@ -11185,8 +11531,9 @@ void vlist_initialize(void)
 
   env = getenv("VLIST_DEBUG");
   if ( env ) VLIST_Debug = atoi(env);
-
+#ifndef HAVE_LIBPTHREAD
   vlistIsInitialized = TRUE;
+#endif
 }
 
 static
@@ -11247,31 +11594,18 @@ int vlistCreate(void)
   return (vlistID);
 }
 
-/*
- at Function  vlistDestroy
- at Title     Destroy a variable list
-
- at Prototype void vlistDestroy(int vlistID)
- at Parameter
-    @Item  vlistID  Variable list ID, from a previous call to @fref{vlistCreate}
-
- at EndFunction
-*/
-void vlistDestroy(int vlistID)
+static void
+vlist_delete(vlist_t *vlistptr)
 {
-  vlist_t *vlistptr;
-  int nvars;
-  int varID;
-
-  vlistptr = vlist_to_pointer(vlistID);
-
   vlist_check_ptr(__func__, vlistptr);
 
+  int vlistID = vlistptr->self;
+
   vlistDelAtts(vlistID, CDI_GLOBAL);
 
-  nvars = vlistptr->nvars;
+  int nvars = vlistptr->nvars;
 
-  for ( varID = 0; varID < nvars; varID++ )
+  for (int varID = 0; varID < nvars; varID++ )
     {
       if ( vlistptr->vars[varID].levinfo )  free(vlistptr->vars[varID].levinfo);
       if ( vlistptr->vars[varID].name )     free(vlistptr->vars[varID].name);
@@ -11301,6 +11635,26 @@ void vlistDestroy(int vlistID)
   vlist_delete_entry(vlistptr);
 }
 
+
+/*
+ at Function  vlistDestroy
+ at Title     Destroy a variable list
+
+ at Prototype void vlistDestroy(int vlistID)
+ at Parameter
+    @Item  vlistID  Variable list ID, from a previous call to @fref{vlistCreate}
+
+ at EndFunction
+*/
+void vlistDestroy(int vlistID)
+{
+  vlist_t *vlistptr;
+
+  vlistptr = vlist_to_pointer(vlistID);
+
+  vlist_delete(vlistptr);
+}
+
 /*
 @Function  vlistCopy
 @Title     Copy a variable list
@@ -11358,7 +11712,6 @@ void vlistCopy(int vlistID2, int vlistID1)
               memcpy(vlistptr2->vars[varID].ensdata,
                      vlistptr1->vars[varID].ensdata, sizeof(ensinfo_t));
             }
-
 #if  defined  (HAVE_LIBGRIB_API)
           /* ---------------------------------- */
           /* Local change: 2013-01-28, FP (DWD) */
@@ -11421,9 +11774,6 @@ int vlistDuplicate(int vlistID)
 
   vlistCopy(vlistIDnew, vlistID);
 
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    reshSetStatus ( vlistIDnew, &vlist_ops, SUSPENDED );
-
   return (vlistIDnew);
 }
 
@@ -12186,7 +12536,7 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
   int param, gridID, zaxisID, tsteptype, nlevs;
   int dtype;
 
-  int i, iorank, decoSize, size, rank, offset, chunk;
+  int iorank;
 
   char paramstr[32];
   char *name, *longname, *units;
@@ -12209,7 +12559,7 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
   if ( nvars > 0 )
     {
       fprintf(fp, " varID param    gridID zaxisID tsteptype nlevel flag "
-              " name     longname iorank decosize\n");
+              " name     longname iorank\n");
       for ( varID = 0; varID < nvars; varID++ )
         {
           param    = vlistptr->vars[varID].param;
@@ -12222,14 +12572,13 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
           units    = vlistptr->vars[varID].units;
           flag     = vlistptr->vars[varID].flag;
           iorank   = vlistptr->vars[varID].iorank;
-          decoSize = vlistptr->vars[varID].decoSize;
 
           cdiParamToString(param, paramstr, sizeof(paramstr));
           fprintf(fp, "%6d %-8s %6d %6d %6d %6d %5d %-8s"
-                  " %s %6d %6d",
+                  " %s %6d",
                   varID, paramstr, gridID, zaxisID, tsteptype, nlevs, flag,
                   name ? name : "", longname ? longname : "",
-                  iorank, decoSize);
+                  iorank);
 
           if ( units ) fprintf ( fp, "   [%s]", units);
           fprintf ( fp, "\n");
@@ -12258,24 +12607,12 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
         }
 
       fprintf(fp, "\n");
-      fprintf(fp, " varID  size iorank decosize corank offset  chunk\n");
+      fprintf(fp, " varID  size iorank\n");
       for ( varID = 0; varID < nvars; varID++ )
-        {
-          iorank    = vlistptr->vars[varID].iorank;
-          decoSize  = vlistptr->vars[varID].decoSize;
-          size      = vlistptr->vars[varID].nlevs *
-            gridInqSize ( vlistptr->vars[varID].gridID );
-
-          for ( i = 0; i < decoSize; i++ )
-            {
-              rank   = vlistptr->vars[varID].deco[i].rank;
-              offset = vlistptr->vars[varID].deco[i].offset;
-              offset = vlistptr->vars[varID].deco[i].offset;
-              chunk  = vlistptr->vars[varID].deco[i].chunk;
-              fprintf ( fp, "%3d %8d %6d %6d %6d %8d %6d\n",
-                        varID, size, iorank, decoSize, rank, offset, chunk );
-            }
-        }
+        fprintf(fp, "%3d %8d %6d\n", varID,
+                vlistptr->vars[varID].nlevs
+                * gridInqSize(vlistptr->vars[varID].gridID),
+                vlistptr->vars[varID].iorank);
     }
 }
 
@@ -12739,8 +13076,6 @@ int vlistHasTime(int vlistID)
   return (hastime);
 }
 
-#ifdef USE_MPI
-
 enum {
   vlist_nints=7,
 };
@@ -12753,21 +13088,21 @@ vlistTxCode ( void )
 
 
 static
-int  vlistGetSizeP ( void * vlistptr, MPI_Comm comm )
+int  vlistGetSizeP ( void * vlistptr, void *context)
 {
   int txsize, varID;
   vlist_t *p = vlistptr;
-  xmpi(MPI_Pack_size(vlist_nints, MPI_INT, comm, &txsize));
-  txsize += vlistAttsGetSize(p, CDI_GLOBAL, comm);
+  txsize = serializeGetSize(vlist_nints, DATATYPE_INT, context);
+  txsize += vlistAttsGetSize(p, CDI_GLOBAL, context);
   for ( varID = 0; varID <  p->nvars; varID++ )
-    txsize += vlistVarGetSize(p, varID, comm);
+    txsize += vlistVarGetSize(p, varID, context);
   return txsize;
 }
 
 
 static
 void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
-                  MPI_Comm comm )
+                  void *context )
 {
   int varID, tempbuf[vlist_nints];
   vlist_t *p = vlistptr;
@@ -12778,32 +13113,30 @@ void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
   tempbuf[4] = p->tableID;
   tempbuf[5] = p->instID;
   tempbuf[6] = p->modelID;
-  xmpi(MPI_Pack(tempbuf, vlist_nints, MPI_INT, buf, size, position, comm));
-  vlistAttsPack(p, CDI_GLOBAL, buf, size, position, comm);
+  serializePack(tempbuf, vlist_nints, DATATYPE_INT, buf, size, position, context);
+  vlistAttsPack(p, CDI_GLOBAL, buf, size, position, context);
   for ( varID = 0; varID < p->nvars; varID++ )
     {
-      vlistVarPack(p, varID, buf, size, position, comm);
+      vlistVarPack(p, varID, buf, size, position, context);
     }
 }
 
-void vlistUnpack(char * buf, int size, int *position, int nspTarget, MPI_Comm comm)
+void vlistUnpack(char * buf, int size, int *position, int nspTarget, void *context)
 {
   int newvlist;
   int varID, tempbuf[vlist_nints];
-  xmpi(MPI_Unpack(buf, size, position, tempbuf, vlist_nints, MPI_INT, comm));
+  serializeUnpack(buf, size, position, tempbuf, vlist_nints, DATATYPE_INT, context);
   newvlist = vlistCreate();
   /* xassert(newvlist == tempbuf[0]); */
   vlistDefTaxis ( newvlist, namespaceAdaptKey ( tempbuf[3], nspTarget ));
   vlistDefTable(newvlist, tempbuf[4]);
   vlistDefInstitut ( newvlist, namespaceAdaptKey ( tempbuf[5], nspTarget ));
   vlistDefModel ( newvlist, namespaceAdaptKey ( tempbuf[6], nspTarget ));
-  vlistAttsUnpack(newvlist, CDI_GLOBAL, buf, size, position, comm);
+  vlistAttsUnpack(newvlist, CDI_GLOBAL, buf, size, position, context);
   for ( varID = 0; varID < tempbuf[1]; varID++ )
-    vlistVarUnpack ( newvlist, buf, size, position, nspTarget, comm );
+    vlistVarUnpack(newvlist, buf, size, position, nspTarget, context);
 }
 
-#endif
-
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -12820,11 +13153,6 @@ void vlistUnpack(char * buf, int size, int *position, int nspTarget, MPI_Comm co
 #include <string.h>
 #include <assert.h>
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
-
 
 
 static
@@ -13262,69 +13590,64 @@ int vlistInqAttTxt(int vlistID, int varID, const char *name, int mlen, char *tp)
   return vlist_inq_att(DATATYPE_TXT, vlistID, varID, name, mlen*sizeof(char), (void *) tp);
 }
 
-#ifdef USE_MPI
-
 enum {
   vlist_att_nints = 4,          /* namesz, exdtype, indtype, nelems */
 };
 
-static int
-vlistAttGetSize(vlist_t *vlistptr, int varID, int attnum, MPI_Comm comm)
+static inline int
+vlistAttTypeLookup(cdi_att_t *attp)
 {
-  int txsize = 0, txinc;
-  cdi_atts_t *attsp;
-  cdi_att_t *attp;
-  char text[1024];
-
-  xassert(attsp = get_attsp(vlistptr, varID));
-  xassert(attnum >= 0 && attnum < (int)attsp->nelems);
-  attp = &(attsp->value[attnum]);
-  xmpi(MPI_Pack_size(vlist_att_nints, MPI_INT, comm, &txsize));
-  xmpi(MPI_Pack_size(attp->namesz, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
+  int type;
   switch (attp->indtype)
   {
   case DATATYPE_FLT:
-    xmpi(MPI_Pack_size((int)attp->nelems, MPI_DOUBLE, comm, &txinc));
+    type = DATATYPE_FLT64;
     break;
   case DATATYPE_INT:
-    xmpi(MPI_Pack_size((int)attp->nelems, MPI_INT, comm, &txinc));
-    break;
   case DATATYPE_TXT:
-    xmpi(MPI_Pack_size((int)attp->nelems, MPI_CHAR, comm, &txinc));
+    type = attp->indtype;
     break;
   default:
-    sprintf( text, "Unknown datatype encountered in attribute %s: %d\n",
+    xabort("Unknown datatype encountered in attribute %s: %d\n",
             attp->name, attp->indtype);
-    xabort ( text );
   }
-  txsize += txinc;
+  return type;
+}
+
+static int
+vlistAttGetSize(vlist_t *vlistptr, int varID, int attnum, void *context)
+{
+  cdi_atts_t *attsp;
+  cdi_att_t *attp;
+
+  xassert(attsp = get_attsp(vlistptr, varID));
+  xassert(attnum >= 0 && attnum < (int)attsp->nelems);
+  attp = &(attsp->value[attnum]);
+  int txsize = serializeGetSize(vlist_att_nints, DATATYPE_INT, context)
+    + serializeGetSize(attp->namesz, DATATYPE_TXT, context);
+  txsize += serializeGetSize((int)attp->nelems, vlistAttTypeLookup(attp), context);
   return txsize;
 }
 
 int
-vlistAttsGetSize(vlist_t *p, int varID, MPI_Comm comm)
+vlistAttsGetSize(vlist_t *p, int varID, void *context)
 {
   int numAtts, i;
-  int txsize;
   cdi_atts_t *attsp = get_attsp(p, varID);
+  int txsize = serializeGetSize(1, DATATYPE_INT, context);
   numAtts = attsp->nelems;
-  xmpi(MPI_Pack_size(1, MPI_INT, comm, &txsize));
   for (i = 0; i < numAtts; ++i)
-  {
-    txsize += vlistAttGetSize(p, varID, i, comm);
-  }
+    txsize += vlistAttGetSize(p, varID, i, context);
   return txsize;
 }
 
 static void
 vlistAttPack(vlist_t *vlistptr, int varID, int attnum,
-             void * buf, int size, int *position, MPI_Comm comm)
+             void * buf, int size, int *position, void *context)
 {
   cdi_atts_t *attsp;
   cdi_att_t *attp;
   int tempbuf[vlist_att_nints];
-  MPI_Datatype attVMPIDt;
 
   xassert(attsp = get_attsp(vlistptr, varID));
   xassert(attnum >= 0 && attnum < (int)attsp->nelems);
@@ -13333,74 +13656,58 @@ vlistAttPack(vlist_t *vlistptr, int varID, int attnum,
   tempbuf[1] = attp->exdtype;
   tempbuf[2] = attp->indtype;
   tempbuf[3] = attp->nelems;
-  xmpi(MPI_Pack(tempbuf, vlist_att_nints, MPI_INT, buf, size, position, comm));
-  xmpi(MPI_Pack(attp->name, attp->namesz, MPI_CHAR, buf, size, position, comm));
-  switch (attp->indtype)
-  {
-  case DATATYPE_FLT:
-    attVMPIDt = MPI_DOUBLE;
-    break;
-  case DATATYPE_INT:
-    attVMPIDt = MPI_INT;
-    break;
-  case DATATYPE_TXT:
-    attVMPIDt = MPI_CHAR;
-    break;
-  default:
-    xabort("Unknown datatype encountered in attribute %s: %d\n",
-           attp->name, attp->indtype);
-  }
-  xmpi(MPI_Pack(attp->xvalue, (int)attp->nelems, attVMPIDt,
-                buf, size, position, comm));
+  serializePack(tempbuf, vlist_att_nints, DATATYPE_INT, buf, size, position, context);
+  serializePack(attp->name, attp->namesz, DATATYPE_TXT, buf, size, position, context);
+  serializePack(attp->xvalue, (int)attp->nelems, vlistAttTypeLookup(attp),
+                buf, size, position, context);
 }
 
 void
 vlistAttsPack(vlist_t *p, int varID,
-              void * buf, int size, int *position, MPI_Comm comm)
+              void * buf, int size, int *position, void *context)
 {
   int numAtts, i;
   cdi_atts_t *attsp = get_attsp(p, varID);
   numAtts = attsp->nelems;
-  xmpi(MPI_Pack(&numAtts, 1, MPI_INT, buf, size, position, comm));
+  serializePack(&numAtts, 1, DATATYPE_INT, buf, size, position, context);
   for (i = 0; i < numAtts; ++i)
-    vlistAttPack(p, varID, i, buf, size, position, comm);
+    vlistAttPack(p, varID, i, buf, size, position, context);
 }
 
 static void
 vlistAttUnpack(int vlistID, int varID,
-               void * buf, int size, int *position, MPI_Comm comm)
+               void * buf, int size, int *position, void *context)
 {
   char *attName;
   int tempbuf[vlist_att_nints];
-  MPI_Datatype attVMPIDt;
+  int attVDt;
   int elemSize;
-  void *attData;
 
-  xmpi(MPI_Unpack(buf, size, position,
-                  tempbuf, vlist_att_nints, MPI_INT, comm));
+  serializeUnpack(buf, size, position,
+                  tempbuf, vlist_att_nints, DATATYPE_INT, context);
   attName = xmalloc(tempbuf[0] + 1);
-  xmpi(MPI_Unpack(buf, size, position, attName, tempbuf[0], MPI_CHAR, comm));
+  serializeUnpack(buf, size, position, attName, tempbuf[0], DATATYPE_TXT, context);
   attName[tempbuf[0]] = '\0';
   switch (tempbuf[2])
   {
   case DATATYPE_FLT:
-    attVMPIDt = MPI_DOUBLE;
+    attVDt = DATATYPE_FLT64;
     elemSize = sizeof(double);
     break;
   case DATATYPE_INT:
-    attVMPIDt = MPI_INT;
+    attVDt = DATATYPE_INT;
     elemSize = sizeof(int);
     break;
   case DATATYPE_TXT:
-    attVMPIDt = MPI_CHAR;
+    attVDt = DATATYPE_TXT;
     elemSize = 1;
     break;
   default:
     xabort("Unknown datatype encountered in attribute %s: %d\n",
            attName, tempbuf[2]);
   }
-  attData = xmalloc(elemSize * tempbuf[3]);
-  xmpi(MPI_Unpack(buf, size, position, attData, tempbuf[3], attVMPIDt, comm));
+  void *attData = xmalloc(elemSize * tempbuf[3]);
+  serializeUnpack(buf, size, position, attData, tempbuf[3], attVDt, context);
   vlist_def_att(tempbuf[2], tempbuf[1], vlistID, varID, attName,
                 tempbuf[3], tempbuf[3] * elemSize, attData);
   free(attName);
@@ -13409,19 +13716,16 @@ vlistAttUnpack(int vlistID, int varID,
 
 void
 vlistAttsUnpack(int vlistID, int varID,
-                void * buf, int size, int *position, MPI_Comm comm)
+                void * buf, int size, int *position, void *context)
 {
   int numAtts, i;
-  xmpi(MPI_Unpack(buf, size, position, &numAtts, 1, MPI_INT, comm));
+  serializeUnpack(buf, size, position, &numAtts, 1, DATATYPE_INT, context);
   for (i = 0; i < numAtts; ++i)
   {
-    vlistAttUnpack(vlistID, varID, buf, size, position, comm);
+    vlistAttUnpack(vlistID, varID, buf, size, position, context);
   }
 }
 
-
-
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -13435,9 +13739,6 @@ vlistAttsUnpack(int vlistID, int varID,
 #endif
 
 #include <limits.h>
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
 
 
 extern resOps vlist_ops;
@@ -13484,8 +13785,6 @@ void vlistvarInitEntry(int vlistID, int varID)
   vlistptr->vars[varID].validrange[1] = VALIDMISS;
   vlistptr->vars[varID].ensdata       = NULL;
   vlistptr->vars[varID].iorank        = CDI_UNDEFID;
-  vlistptr->vars[varID].decoSize      = 0;
-  vlistptr->vars[varID].deco          = NULL;
 
 #if  defined  (HAVE_LIBGRIB_API)
   /* ---------------------------------- */
@@ -13537,11 +13836,8 @@ int vlistvarNewEntry(int vlistID)
     }
   else
     {
-      while ( varID < vlistvarSize )
-	{
-	  if ( ! vlistvar[varID].isUsed ) break;
-	  varID++;
-	}
+      while (varID < vlistvarSize && vlistvar[varID].isUsed)
+        ++varID;
     }
   /*
     If the table overflows, double its size.
@@ -14667,9 +14963,6 @@ otherwise the result is an empty string.
 */
 void vlistInqVarExtra(int vlistID, int varID, char *extra)
 {
-  int tableID;
-  int param;
-  int pdis, pcat, pnum;
   vlist_t *vlistptr;
 
   vlistptr = vlist_to_pointer(vlistID);
@@ -14860,6 +15153,32 @@ int vlistInqVarTimaccu(int vlistID, int varID)
 }
 
 
+void vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGeneratingProcess)
+{
+  vlist_t *vlistptr;
+
+  if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
+    {
+      xwarning("%s", "Operation not executed.");
+      return;
+    }
+
+  vlistptr = vlist_to_pointer(vlistID);
+
+  vlistptr->vars[varID].typeOfGeneratingProcess = typeOfGeneratingProcess;
+}
+
+
+int vlistInqVarTypeOfGeneratingProcess(int vlistID, int varID)
+{
+  vlist_t *vlistptr;
+
+  vlistptr = vlist_to_pointer(vlistID);
+
+  return (vlistptr->vars[varID].typeOfGeneratingProcess);
+}
+
+
 void vlistDestroyVarName(int vlistID, int varID)
 {
   vlist_t *vlistptr;
@@ -15447,107 +15766,6 @@ int vlistInqVarIntKey(int vlistID, int varID, const char* name)
 }
 
 
-void vlistDefVarDeco ( int vlistID, int varID, int decoSize, deco_t * deco )
-{
-  vlist_t * vlistptr;
-  int i;
-
-  vlistptr = vlist_to_pointer(vlistID );
-
-  vlistCheckVarID ( __func__, vlistID, varID );
-
-  if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
-    {
-      xwarning("%s", "Operation not executed.");
-      return;
-    }
-
-  xassert ( decoSize && deco );
- 
-  vlistptr->vars[varID].deco = xmalloc ( decoSize * sizeof ( deco_t )); 
-
-  for ( i = 0; i < decoSize; i++ )
-    {
-      vlistptr->vars[varID].deco[i].rank   = deco[i].rank;
-      vlistptr->vars[varID].deco[i].offset = deco[i].offset;
-      vlistptr->vars[varID].deco[i].chunk  = deco[i].chunk;
-    }
-
-  vlistptr->vars[varID].decoSize = decoSize;
-}
-
-
-int vlistInqVarDecoChunk ( int vlistID, int varID, int rankModel  )
-{
-  vlist_t *vlistptr;
-  int iret = CDI_UNDEFID;
-
-  vlistptr = vlist_to_pointer(vlistID);
-
-  vlistCheckVarID(__func__, vlistID, varID);
-
-#ifdef USE_MPI
-  {
-    deco_t * deco;
-    int i, decoSize = 0;
-    xassert ( vlistptr->vars[varID].deco != NULL &&
-             vlistptr->vars[varID].decoSize != CDI_UNDEFID ); 
-    
-    deco  = vlistptr->vars[varID].deco;
-    decoSize = vlistptr->vars[varID].decoSize;
-    if ( decoSize && deco )
-      for ( i = 0; i < decoSize; i++ )
-        if ( deco[i].rank == rankModel ) 
-          {
-            iret = deco[i].chunk;
-            break;
-          }
-  }
-#else
-  iret = vlistInqVarSize ( vlistID, varID );
-#endif
-
-  xassert ( iret != CDI_UNDEFID );
-  return iret;
-}
-
-
-int vlistInqVarDecoOff ( int vlistID, int varID, int rankModel  )
-{
-  vlist_t *vlistptr;
-  int iret = CDI_UNDEFID;
-
-  vlistptr = vlist_to_pointer(vlistID);
-
-  vlistCheckVarID(__func__, vlistID, varID);
-
-#ifdef USE_MPI
-  {
-    deco_t * deco;
-    int i, decoSize = 0;
-    
-    xassert ( vlistptr->vars[varID].deco != NULL &&
-             vlistptr->vars[varID].decoSize != CDI_UNDEFID );
-    
-    deco  = vlistptr->vars[varID].deco;
-    decoSize = vlistptr->vars[varID].decoSize;
-    if ( decoSize && deco )
-      for ( i = 0; i < decoSize; i++ )
-        if ( deco[i].rank == rankModel ) 
-          {
-            iret = deco[i].offset;
-            break;
-          }
-  }
-#else
-  iret = 0;
-#endif
-
-  xassert (  iret != CDI_UNDEFID );  
-  return iret;
-}
-
-
 void     vlistDefVarIOrank   ( int vlistID, int varID, int iorank )
 {
   vlist_t * vlistptr;
@@ -15578,54 +15796,31 @@ int vlistInqVarIOrank(int vlistID, int varID)
 }
 
 
-#ifdef USE_MPI
-
 enum {
-  vlistvar_nints = 21,
+  vlistvar_nints = 20,
   vlistvar_ndbls = 3,
 };
 
-int vlistVarGetSize(vlist_t *p, int varID, MPI_Comm comm)
+int vlistVarGetSize(vlist_t *p, int varID, void *context)
 {
   var_t *var = p->vars + varID;
-  int varsize, txinc;
-
-  xmpi(MPI_Pack_size(vlistvar_nints, MPI_INT, comm, &varsize));
-  xmpi(MPI_Pack_size(vlistvar_ndbls, MPI_DOUBLE, comm, &txinc));
-  varsize += txinc;
+  int varsize = serializeGetSize(vlistvar_nints, DATATYPE_INT, context)
+    + serializeGetSize(vlistvar_ndbls, DATATYPE_FLT64, context);
   if (var->name)
-  {
-    xmpi(MPI_Pack_size(strlen(var->name), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
+    varsize += serializeGetSize(strlen(var->name), DATATYPE_TXT, context);
   if (var->longname)
-  {
-    xmpi(MPI_Pack_size(strlen(var->longname), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
+    varsize += serializeGetSize(strlen(var->longname), DATATYPE_TXT, context);
   if (var->stdname)
-  {
-    xmpi(MPI_Pack_size(strlen(var->stdname), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
+    varsize += serializeGetSize(strlen(var->stdname), DATATYPE_TXT, context);
   if (var->units)
-  {
-    xmpi(MPI_Pack_size(strlen(var->units), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
-  xmpi(MPI_Pack_size(4 * var->nlevs, MPI_INT, comm, &txinc));
-  varsize += txinc;
-  if ( var->deco != NULL )
-    {
-      xmpi(MPI_Pack_size(3 * var->decoSize, MPI_INT, comm, &txinc));
-      varsize += txinc;
-    }
-  varsize += vlistAttsGetSize(p, varID, comm);
+    varsize += serializeGetSize(strlen(var->units), DATATYPE_TXT, context);
+  varsize += serializeGetSize(4 * var->nlevs, DATATYPE_INT, context);
+  varsize += vlistAttsGetSize(p, varID, context);
   return varsize;
 }
 
 void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
-                  MPI_Comm comm)
+                  void *context)
 {
   double dtempbuf[vlistvar_ndbls];
   var_t *var = p->vars + varID;
@@ -15651,25 +15846,24 @@ void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
   tempbuf[17] = var->complevel;
   tempbuf[18] = var->nlevs;
   tempbuf[19] = var->iorank;
-  tempbuf[20] = var->decoSize;
   dtempbuf[0] = var->missval;
   dtempbuf[1] = var->scalefactor;
   dtempbuf[2] = var->addoffset;
-  xmpi(MPI_Pack(tempbuf, vlistvar_nints, MPI_INT,
-                buf, size, position, comm));
-  xmpi(MPI_Pack(dtempbuf, vlistvar_ndbls, MPI_DOUBLE,
-                buf, size, position, comm));
+  serializePack(tempbuf, vlistvar_nints, DATATYPE_INT,
+                buf, size, position, context);
+  serializePack(dtempbuf, vlistvar_ndbls, DATATYPE_FLT64,
+                buf, size, position, context);
   if (namesz)
-    xmpi(MPI_Pack(var->name, namesz, MPI_CHAR, buf, size, position, comm));
+    serializePack(var->name, namesz, DATATYPE_TXT, buf, size, position, context);
   if (longnamesz)
-    xmpi(MPI_Pack(var->longname, longnamesz, MPI_CHAR,
-                  buf, size, position, comm));
+    serializePack(var->longname, longnamesz, DATATYPE_TXT,
+                  buf, size, position, context);
   if (stdnamesz)
-    xmpi(MPI_Pack(var->stdname, stdnamesz, MPI_CHAR,
-                  buf, size, position, comm));
+    serializePack(var->stdname, stdnamesz, DATATYPE_TXT,
+                  buf, size, position, context);
   if (unitssz)
-    xmpi(MPI_Pack(var->units, unitssz, MPI_CHAR,
-                  buf, size, position, comm));
+    serializePack(var->units, unitssz, DATATYPE_TXT,
+                  buf, size, position, context);
   {
     int levbuf[var->nlevs][4];
     for (i = 0; i < var->nlevs; ++i)
@@ -15679,22 +15873,10 @@ void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
       levbuf[i][2] = var->levinfo[i].mlevelID;
       levbuf[i][3] = var->levinfo[i].flevelID;
     }
-    xmpi(MPI_Pack(levbuf, var->nlevs * 4, MPI_INT,
-                  buf, size, position, comm));
+    serializePack(levbuf, var->nlevs * 4, DATATYPE_INT,
+                  buf, size, position, context);
   }
-  if ( var->deco != NULL )
-    {
-      int deco[var->decoSize][3];
-      for (i = 0; i < var->decoSize; ++i)
-        {
-          deco[i][0] = var->deco[i].rank;
-          deco[i][1] = var->deco[i].offset;
-          deco[i][2] = var->deco[i].chunk;
-        }
-      xmpi(MPI_Pack(deco, var->decoSize * 3, MPI_INT,
-                    buf, size, position, comm));
-    }
-  vlistAttsPack(p, varID, buf, size, position, comm);
+  vlistAttsPack(p, varID, buf, size, position, context);
 }
 
 static inline int
@@ -15705,16 +15887,16 @@ imax(int a, int b)
 
 
 void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
-		    int nspTarget, MPI_Comm comm)
+		    int nspTarget, void *context)
 {
   double dtempbuf[vlistvar_ndbls];
   int tempbuf[vlistvar_nints];
   int newvar;
   char *varname = NULL;
-  xmpi(MPI_Unpack(buf, size, position,
-                  tempbuf, vlistvar_nints, MPI_INT, comm));
-  xmpi(MPI_Unpack(buf, size, position,
-                  dtempbuf, vlistvar_ndbls, MPI_DOUBLE, comm));
+  serializeUnpack(buf, size, position,
+                  tempbuf, vlistvar_nints, DATATYPE_INT, context);
+  serializeUnpack(buf, size, position,
+                  dtempbuf, vlistvar_ndbls, DATATYPE_FLT64, context);
 
   newvar = vlistDefVar ( vlistID,
 			 namespaceAdaptKey ( tempbuf[1], nspTarget ),
@@ -15725,29 +15907,29 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
                            tempbuf[7])+ 1);
   if (tempbuf[4])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[4], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[4], DATATYPE_TXT, context);
     varname[tempbuf[4]] = '\0';
     vlistDefVarName(vlistID, newvar, varname);
   }
   if (tempbuf[5])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[5], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[5], DATATYPE_TXT, context);
     varname[tempbuf[5]] = '\0';
     vlistDefVarLongname(vlistID, newvar, varname);
   }
   if (tempbuf[6])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[6], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[6], DATATYPE_TXT, context);
     varname[tempbuf[6]] = '\0';
     vlistDefVarStdname(vlistID, newvar, varname);
   }
   if (tempbuf[7])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[7], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[7], DATATYPE_TXT, context);
     varname[tempbuf[7]] = '\0';
     vlistDefVarUnits(vlistID, newvar, varname);
   }
@@ -15773,8 +15955,8 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
     var_t *var = vlist_to_pointer(vlistID)->vars + newvar;
     int nlevs=tempbuf[18], i, flagSetLev = 0;
     xassert(nlevs == var->nlevs);
-    xmpi(MPI_Unpack(buf, size, position,
-                    levbuf, nlevs * 4, MPI_INT, comm));
+    serializeUnpack(buf, size, position,
+                    levbuf, nlevs * 4, DATATYPE_INT, context);
     for (i = 0; i < nlevs; ++i)
     {
       vlistDefFlag(vlistID, newvar, i, levbuf[i][0]);
@@ -15787,29 +15969,11 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
     }
     vlistDefFlag(vlistID, newvar, flagSetLev, levbuf[flagSetLev][0]);
   }
-  if ( tempbuf[20] != 0 )
-    {
-      int decoSize = tempbuf[20], i;
-      deco_t deco[decoSize];
-      int decobuf[decoSize][3];
-
-      xmpi ( MPI_Unpack(buf, size, position,
-                        decobuf, decoSize * 3, MPI_INT, comm ));
-      for (i = 0; i < decoSize; ++i)
-        {
-          deco[i].rank   = decobuf[i][0];
-          deco[i].offset = decobuf[i][1];
-          deco[i].chunk  = decobuf[i][2];
-        }
-      vlistDefVarDeco(vlistID, newvar, decoSize, &deco[0]);
-    }
   vlistDefVarIOrank(vlistID, newvar, tempbuf[19]);
-  vlistAttsUnpack(vlistID, newvar, buf, size, position, comm);
+  vlistAttsUnpack(vlistID, newvar, buf, size, position, context);
 }
 
 
-#endif
-
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -17668,10 +17832,7 @@ int iegWrite(int fileID, iegrec_t *iegp)
 
 #include <string.h>
 #include <float.h>  /* FLT_EPSILON */
-
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
+#include <limits.h> /* INT_MAX     */
 
 
 #ifndef  RAD2DEG
@@ -17699,25 +17860,20 @@ char *Grids[] = {
   /* 12 */  "lcc2",
   /* 13 */  "laea",
   /* 14 */  "sinusoidal",
-  /* 15 */  "reference",
-  /* 16 */  "projection",
+  /* 15 */  "projection",
 };
 
 
 static int    gridCompareP    ( void * gridptr1, void * gridptr2 );
 static void   gridDestroyP    ( void * gridptr );
 static void   gridPrintP      ( void * gridptr, FILE * fp );
-#ifdef USE_MPI
-static int    gridGetPackSize ( void * gridptr, MPI_Comm comm );
+static int    gridGetPackSize ( void * gridptr, void *context);
 static void   gridPack        ( void * gridptr, void * buff, int size,
-				int *position, MPI_Comm comm );
+				int *position, void *context);
 static int    gridTxCode      ( void );
-#endif
 
 resOps gridOps = { gridCompareP, gridDestroyP, gridPrintP
-#ifdef USE_MPI
                    , gridGetPackSize, gridPack, gridTxCode
-#endif
 };
 
 
@@ -18010,8 +18166,7 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
     @Item  gridtype  The type of the grid, one of the set of predefined CDI grid types.
                      The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_GAUSSIAN},
                      @func{GRID_LONLAT}, @func{GRID_LCC}, @func{GRID_SPECTRAL},
-                     @func{GRID_GME}, @func{GRID_CURVILINEAR}, @func{GRID_UNSTRUCTURED} and
-                     @func{GRID_REFERENCE}.
+                     @func{GRID_GME}, @func{GRID_CURVILINEAR} and @func{GRID_UNSTRUCTURED} and.
     @Item  size      Number of gridpoints.
 
 @Description
@@ -18049,6 +18204,8 @@ int gridCreate(int gridtype, int size)
   if ( CDI_Debug )
     Message("gridtype: %d size: %d", gridtype, size);
 
+  if ( size < 0 || size > INT_MAX ) Error("grid size (%d) out of bounds (0 - %d)!", size, INT_MAX);
+
   gridInit ();
 
   gridptr = gridNewEntry();
@@ -18620,7 +18777,7 @@ The function @func{gridInqType} returns the type of a Grid.
 one of the set of predefined CDI grid types.
 The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_GAUSSIAN},
 @func{GRID_LONLAT}, @func{GRID_LCC}, @func{GRID_SPECTRAL}, @func{GRID_GME},
- at func{GRID_CURVILINEAR}, @func{GRID_UNSTRUCTURED} and @func{GRID_REFERENCE}.
+ at func{GRID_CURVILINEAR} and @func{GRID_UNSTRUCTURED}.
 
 @EndFunction
 */
@@ -19190,6 +19347,8 @@ int gridInqXvals(int gridID, double *xvals)
 
   if ( gridptr->type == GRID_CURVILINEAR || gridptr->type == GRID_UNSTRUCTURED )
     size = gridptr->size;
+  else if ( gridptr->type == GRID_GAUSSIAN_REDUCED )
+    size = 2;
   else
     size = gridptr->xsize;
 
@@ -19238,6 +19397,8 @@ void gridDefXvals(int gridID, const double *xvals)
 
   if ( gridtype == GRID_UNSTRUCTURED || gridtype == GRID_CURVILINEAR )
     size = gridptr->size;
+  else if ( gridtype == GRID_GAUSSIAN_REDUCED )
+    size = 2;
   else
     size = gridptr->xsize;
 
@@ -20010,6 +20171,9 @@ int compareXYvals2(int gridID, long gridsize, double *xvals, double *yvals)
 {
   int differ = 0;
 
+  if ( !differ && ((xvals == NULL && gridInqXvalsPtr(gridID) != NULL) || (xvals != NULL && gridInqXvalsPtr(gridID) == NULL)) ) differ = 1;
+  if ( !differ && ((yvals == NULL && gridInqYvalsPtr(gridID) != NULL) || (yvals != NULL && gridInqYvalsPtr(gridID) == NULL)) ) differ = 1;
+
   if ( !differ && xvals && gridInqXvalsPtr(gridID) )
     {
       if ( fabs(xvals[0] - gridInqXval(gridID, 0)) > 1.e-9 ||
@@ -20151,7 +20315,17 @@ int gridCompare(int gridID, grid_t grid)
 	    }
 	  else if ( grid.type == GRID_UNSTRUCTURED )
 	    {
-	      if ( grid.nvertex == gridInqNvertex(gridID) )
+              char uuidOfHGrid[17];
+              gridInqUUID(gridID, uuidOfHGrid);
+
+              if ( !differ && memcmp(uuidOfHGrid, grid.uuid, 16) != 0 ) differ = 1;
+
+              if ( !differ && grid.nvertex != gridInqNvertex(gridID) ) differ = 1;
+
+              if ( !differ && grid.number != gridInqNumber(gridID) ) differ = 1;
+              if ( !differ && grid.position != gridInqPosition(gridID) ) differ = 1;
+
+	      if ( !differ )
 		differ = compareXYvals2(gridID, grid.size, grid.xvals, grid.yvals);
 	    }
 	}
@@ -20449,6 +20623,20 @@ int gridGenerate(grid_t grid)
 		     grid.lcc_lat1, grid.lcc_lat2, grid.lcc_xinc, grid.lcc_yinc,
 		     grid.lcc_projflag, grid.lcc_scanflag);
 
+	if ( grid.type == GRID_UNSTRUCTURED )
+          {
+            int number = grid.number;
+            int position = grid.position;
+            if ( position < 0 ) position = 0;
+            if ( number > 0 )
+              {
+                gridDefNumber(gridID, number);
+                gridDefPosition(gridID, position);
+              }
+            if ( grid.uuid[0] != 0 ) gridDefUUID(gridID, grid.uuid);
+            if ( grid.reference ) gridDefReference(gridID, grid.reference);
+          }
+
 	if ( grid.type == GRID_PROJECTION )
 	  {
 	    gridptr->name = strdup(grid.name);
@@ -20462,6 +20650,14 @@ int gridGenerate(grid_t grid)
 	gridDefYsize(gridID, grid.ysize);
 	gridDefRowlon(gridID, grid.ysize, grid.rowlon);
 
+        if ( grid.xdef == 2 )
+          {
+            double xvals[2];
+            xvals[0] = grid.xfirst;
+            xvals[1] = grid.xlast;
+            gridDefXvals(gridID, xvals);
+          }
+
 	if ( grid.ydef == 1 )
 	  {
 	    gridDefYvals(gridID, grid.yvals);
@@ -20499,14 +20695,6 @@ int gridGenerate(grid_t grid)
         gridDefGMEni3(gridID, grid.ni3);
         break;
       }
-    case GRID_REFERENCE:
-      {
-        gridDefNumber(gridID, grid.number);
-        gridDefPosition(gridID, grid.position);
-        gridDefUUID(gridID, grid.uuid);
-        if ( grid.reference ) gridDefReference(gridID, grid.reference);
-        break;
-      }
       /*
     case GRID_GENERIC:
       {
@@ -20589,6 +20777,8 @@ int gridDuplicate(int gridID)
   strcpy(gridptrnew->xstdname, gridptr->xstdname);
   strcpy(gridptrnew->ystdname, gridptr->ystdname);
 
+  if ( gridptr->reference )  gridptrnew->reference = strdupx(gridptr->reference);
+
   nrowlon = gridptr->nrowlon;
   if ( nrowlon )
     {
@@ -21107,19 +21297,26 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
 
   if ( type != GRID_GME )
     {
-      if ( gridptr->xname[0]     )     fprintf(fp, "xname     = %s\n", gridptr->xname);
-      if ( gridptr->xlongname[0] )     fprintf(fp, "xlongname = %s\n", gridptr->xlongname);
-      if ( gridptr->xunits[0]    )     fprintf(fp, "xunits    = %s\n", gridptr->xunits);
-      if ( gridptr->yname[0]     )     fprintf(fp, "yname     = %s\n", gridptr->yname);
-      if ( gridptr->ylongname[0] )     fprintf(fp, "ylongname = %s\n", gridptr->ylongname);
-      if ( gridptr->yunits[0]    )     fprintf(fp, "yunits    = %s\n", gridptr->yunits);
-      if ( type == GRID_UNSTRUCTURED ) fprintf(fp, "nvertex   = %d\n", nvertex);
+      if ( xvals )
+        {
+          if ( gridptr->xname[0]     )     fprintf(fp, "xname     = %s\n", gridptr->xname);
+          if ( gridptr->xlongname[0] )     fprintf(fp, "xlongname = %s\n", gridptr->xlongname);
+          if ( gridptr->xunits[0]    )     fprintf(fp, "xunits    = %s\n", gridptr->xunits);
+        }
+      if ( yvals )
+        {
+          if ( gridptr->yname[0]     )     fprintf(fp, "yname     = %s\n", gridptr->yname);
+          if ( gridptr->ylongname[0] )     fprintf(fp, "ylongname = %s\n", gridptr->ylongname);
+          if ( gridptr->yunits[0]    )     fprintf(fp, "yunits    = %s\n", gridptr->yunits);
+        }
+      if ( type == GRID_UNSTRUCTURED && nvertex > 0 ) fprintf(fp, "nvertex   = %d\n", nvertex);
     }
 
   switch (type)
     {
     case GRID_LONLAT:
     case GRID_GAUSSIAN:
+    case GRID_GAUSSIAN_REDUCED:
     case GRID_GENERIC:
     case GRID_LCC2:
     case GRID_SINUSOIDAL:
@@ -21127,13 +21324,18 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
     case GRID_CURVILINEAR:
     case GRID_UNSTRUCTURED:
       {
-        if ( type == GRID_GAUSSIAN ) fprintf(fp, "np        = %d\n", gridptr->np);
+        if ( type == GRID_GAUSSIAN || type == GRID_GAUSSIAN_REDUCED ) fprintf(fp, "np        = %d\n", gridptr->np);
 
 	if ( type == GRID_CURVILINEAR || type == GRID_UNSTRUCTURED )
 	  {
 	    xdim = gridsize;
 	    ydim = gridsize;
 	  }
+        else if ( type == GRID_GAUSSIAN_REDUCED )
+          {
+	    xdim = 2;
+	    ydim = ysize;
+          }
 	else
 	  {
 	    xdim = xsize;
@@ -21146,6 +21348,31 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
 	    if ( ysize > 0 ) fprintf(fp, "ysize     = %d\n", ysize);
 	  }
 
+	if ( type == GRID_UNSTRUCTURED )
+          {
+            int number = gridInqNumber(gridID);
+            int position = gridInqPosition(gridID);
+            // const unsigned char *d;
+            if ( number > 0 )
+              {
+                fprintf(fp, "number    = %d\n", number);
+                if ( position >= 0 ) fprintf(fp, "position  = %d\n", position);
+              }
+            /*
+              gridInqUUID(gridID, uuidOfHGrid);
+              d = (unsigned char *) &uuidOfHGrid;
+              fprintf(fp, "uuid      = %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
+              d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
+              d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
+            */
+            if ( gridInqReference(gridID, NULL) )
+              {
+                char reference_link[8192];
+                gridInqReference(gridID, reference_link);
+                fprintf(fp, "uri       = %s\n", reference_link);
+              }
+          }
+
 	if ( type == GRID_LAEA )
 	  {
 	    double a = 0, lon_0 = 0, lat_0 = 0;
@@ -21284,28 +21511,28 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
 	      }
 	    fprintf(fp, "\n");
 	  }
-	break;
-      }
-   case GRID_GAUSSIAN_REDUCED:
-      {
-	int *rowlon;
-	fprintf(fp, "ysize = %d\n", ysize);
-	nbyte0 = fprintf(fp, "rowlon = %d  ", ysize);
-	nbyte  = nbyte0;
-	rowlon = (int *) malloc(ysize*sizeof(int));
-	gridInqRowlon(gridID, rowlon);
-	for ( i = 0; i < ysize; i++ )
-	  {
-	    if ( nbyte > 80 )
-	      {
-		fprintf(fp, "\n");
-		fprintf(fp, "%*s", nbyte0, "");
-		nbyte = nbyte0;
-	      }
-	    nbyte += fprintf(fp, "%d ", rowlon[i]);
-	  }
-	fprintf(fp, "\n");
-	free(rowlon);
+
+        if ( type == GRID_GAUSSIAN_REDUCED )
+          {
+            int *rowlon;
+            nbyte0 = fprintf(fp, "rowlon    = ");
+            nbyte  = nbyte0;
+            rowlon = (int *) malloc(ysize*sizeof(int));
+            gridInqRowlon(gridID, rowlon);
+            for ( i = 0; i < ysize; i++ )
+              {
+                if ( nbyte > 80 )
+                  {
+                    fprintf(fp, "\n");
+                    fprintf(fp, "%*s", nbyte0, "");
+                    nbyte = nbyte0;
+                  }
+                nbyte += fprintf(fp, "%d ", rowlon[i]);
+              }
+            fprintf(fp, "\n");
+            free(rowlon);
+          }
+
 	break;
       }
     case GRID_LCC:
@@ -21348,26 +21575,6 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
         fprintf(fp, "ni        = %d\n", gridptr->ni );
         break;
       }
-    case GRID_REFERENCE:
-      {
-        // const unsigned char *d;
-	fprintf(fp, "number    = %d\n", gridInqNumber(gridID));
-	fprintf(fp, "position  = %d\n", gridInqPosition(gridID));
-        /*
-        gridInqUUID(gridID, uuidOfHGrid);
-        d = (unsigned char *) &uuidOfHGrid;
-	fprintf(fp, "uuid      = %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", 
-                d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
-                d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
-        */
-	if ( gridInqReference(gridID, NULL) )
-	  {
-	    char reference_link[8192];
-	    gridInqReference(gridID, reference_link);
-	    fprintf(fp, "path      = %s\n", reference_link);
-	  }
-	break;
-      }
    default:
       {
 	fprintf(stderr, "Unsupported grid type: %s\n", gridNamePtr(type));
@@ -21510,7 +21717,7 @@ const double *gridInqYvalsPtr(int gridID)
     @Item  yinc      Y-direction grid lenght in meter.
     @Item  projflag  Projection centre flag.
     @Item  scanflag  Scanning mode flag.
- 
+
 @Description
 The function @func{gridDefLCC} defines the parameter of a Lambert Conformal Conic grid.
 
@@ -21743,20 +21950,21 @@ int gridInqComplexPacking(int gridID)
   return (lcomplex);
 }
 
+/*
+ at Function  gridDefNumber
+ at Title     Define the reference number for an unstructured grid
 
-int gridInqNumber(int gridID)
-{
-  grid_t *gridptr;
-
-  gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
-
-  grid_check_ptr(gridID, gridptr);
-
-  return (gridptr->number);
-}
+ at Prototype void gridDefNumber(int gridID, const int number)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  number   Reference number for an unstructured grid.
 
+ at Description
+The function @func{gridDefNumber} defines the reference number for an unstructured grid.
 
-void gridDefNumber(int gridID, int number)
+ at EndFunction
+*/
+void gridDefNumber(int gridID, const int number)
 {
   grid_t *gridptr;
 
@@ -21773,8 +21981,22 @@ void gridDefNumber(int gridID, int number)
   gridptr->number = number;
 }
 
+/*
+ at Function  gridInqNumber
+ at Title     Get the reference number to an unstructured grid
 
-int gridInqPosition(int gridID)
+ at Prototype int gridInqNumber(int gridID)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+
+ at Description
+The function @func{gridInqNumber} returns the reference number to an unstructured grid.
+
+ at Result
+ at func{gridInqNumber} returns the reference number to an unstructured grid.
+ at EndFunction
+*/
+int gridInqNumber(int gridID)
 {
   grid_t *gridptr;
 
@@ -21782,10 +22004,23 @@ int gridInqPosition(int gridID)
 
   grid_check_ptr(gridID, gridptr);
 
-  return (gridptr->position);
+  return (gridptr->number);
 }
 
+/*
+ at Function  gridDefPosition
+ at Title     Define the position of grid in the reference file
+
+ at Prototype void gridDefPosition(int gridID, const int position)
+ at Parameter
+    @Item  gridID     Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  position   Position of grid in the reference file.
+
+ at Description
+The function @func{gridDefPosition} defines the position of grid in the reference file.
 
+ at EndFunction
+*/
 void gridDefPosition(int gridID, int position)
 {
   grid_t *gridptr;
@@ -21803,28 +22038,46 @@ void gridDefPosition(int gridID, int position)
   gridptr->position = position;
 }
 
+/*
+ at Function  gridInqPosition
+ at Title     Get the position of grid in the reference file
 
-int gridInqReference(int gridID, char *reference)
+ at Prototype int gridInqPosition(int gridID)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+
+ at Description
+The function @func{gridInqPosition} returns the position of grid in the reference file.
+
+ at Result
+ at func{gridInqPosition} returns the position of grid in the reference file.
+ at EndFunction
+*/
+int gridInqPosition(int gridID)
 {
   grid_t *gridptr;
-  int len = 0;
 
   gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
 
   grid_check_ptr(gridID, gridptr);
 
-  if ( gridptr->reference )
-    {
-      len = (int) strlen(gridptr->reference);
+  return (gridptr->position);
+}
 
-      if ( reference )
-        strcpy(reference, gridptr->reference);
-    }
+/*
+ at Function  gridDefReference
+ at Title     Define the reference URI for an unstructured grid
 
-  return (len);
-}
+ at Prototype void gridDefReference(int gridID, const char *reference)
+ at Parameter
+    @Item  gridID      Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  reference   Reference URI for an unstructured grid.
 
+ at Description
+The function @func{gridDefReference} defines the reference URI for an unstructured grid.
 
+ at EndFunction
+*/
 void gridDefReference(int gridID, const char *reference)
 {
   grid_t *gridptr;
@@ -21851,26 +22104,55 @@ void gridDefReference(int gridID, const char *reference)
     }
 }
 
+/*
+ at Function  gridInqReference
+ at Title     Get the reference URI to an unstructured grid
 
-void gridGetIndexList ( int ngrids, int * gridIndexList )
-{
-  reshGetResHListOfType ( ngrids, gridIndexList, &gridOps );
-}
+ at Prototype char *gridInqReference(int gridID, char *reference)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
 
-char *gridInqUUID(int gridID, char *uuid)
+ at Description
+The function @func{gridInqReference} returns the reference URI to an unstructured grid.
+
+ at Result
+ at func{gridInqReference} returns the reference URI to an unstructured grid.
+ at EndFunction
+*/
+int gridInqReference(int gridID, char *reference)
 {
   grid_t *gridptr;
+  int len = 0;
 
   gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
 
   grid_check_ptr(gridID, gridptr);
 
-  memcpy(uuid, gridptr->uuid, 16);
+  if ( gridptr->reference )
+    {
+      len = (int) strlen(gridptr->reference);
 
-  return (uuid);
+      if ( reference )
+        strcpy(reference, gridptr->reference);
+    }
+
+  return (len);
 }
 
+/*
+ at Function  gridDefUUID
+ at Title     Define the UUID for an unstructured grid
+
+ at Prototype void gridDefUUID(int gridID, const char *uuid)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  uuid     UUID for an unstructured grid.
 
+ at Description
+The function @func{gridDefUUID} defines the UUID for an unstructured grid.
+
+ at EndFunction
+*/
 void gridDefUUID(int gridID, const char *uuid)
 {
   grid_t *gridptr;
@@ -21890,8 +22172,40 @@ void gridDefUUID(int gridID, const char *uuid)
   return;
 }
 
+/*
+ at Function  gridInqUUID
+ at Title     Get the UUID to an unstructured grid
+
+ at Prototype char *gridInqUUID(int gridID, char *uuid)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+
+ at Description
+The function @func{gridInqUUID} returns the UUID to an unstructured grid.
+
+ at Result
+ at func{gridInqUUID} returns the UUID to an unstructured grid.
+ at EndFunction
+*/
+char *gridInqUUID(int gridID, char *uuid)
+{
+  grid_t *gridptr;
+
+  gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
+
+  grid_check_ptr(gridID, gridptr);
+
+  memcpy(uuid, gridptr->uuid, 16);
+
+  return (uuid);
+}
+
+
+void gridGetIndexList ( int ngrids, int * gridIndexList )
+{
+  reshGetResHListOfType ( ngrids, gridIndexList, &gridOps );
+}
 
-#ifdef USE_MPI
 
 static int
 gridTxCode ()
@@ -21899,343 +22213,310 @@ gridTxCode ()
   return GRID;
 }
 
-enum { gridNint    = 26, 
-       gridNdouble = 24,
+enum { gridNint    = 27,
+       gridNdouble = 25,
        gridNstrings= 8,
-       mask        = 1 << 0,
-       mask_gme    = 1 << 1,
-       xvals       = 1 << 2,
-       yvals       = 1 << 3,
-       area        = 1 << 4,
-       xbounds     = 1 << 5,
-       ybounds     = 1 << 6,
-       reference   = 1 << 7,
-       rowlon      = 1 << 8
+       gridHasMaskFlag = 1 << 0,
+       gridHasGMEMaskFlag = 1 << 1,
+       gridHasXValsFlag = 1 << 2,
+       gridHasYValsFlag = 1 << 3,
+       gridHasAreaFlag = 1 << 4,
+       gridHasXBoundsFlag = 1 << 5,
+       gridHasYBoundsFlag = 1 << 6,
+       gridHasReferenceFlag = 1 << 7,
+       gridHasRowLonFlag = 1 << 8
 };
 
 
-static int getMemberMask ( grid_t * gridP )
+static int gridGetComponentFlags ( grid_t * gridP )
 {
-  int memberMask = 0;
+  int flags = (gridHasMaskFlag & (int)((unsigned)(gridP->mask == NULL) - 1U))
+    | (gridHasGMEMaskFlag & (int)((unsigned)(gridP->mask_gme == NULL) - 1U))
+    | (gridHasXValsFlag & (int)((unsigned)(gridP->xvals == NULL) - 1U))
+    | (gridHasYValsFlag & (int)((unsigned)(gridP->yvals == NULL) - 1U))
+    | (gridHasAreaFlag & (int)((unsigned)(gridP->area == NULL) - 1U))
+    | (gridHasXBoundsFlag & (int)((unsigned)(gridP->xbounds == NULL) - 1U))
+    | (gridHasYBoundsFlag & (int)((unsigned)(gridP->ybounds == NULL) - 1U))
+    | (gridHasReferenceFlag & (int)((unsigned)(gridP->reference == NULL) - 1U))
+    | (gridHasRowLonFlag & (int)((unsigned)(gridP->rowlon == NULL) - 1U));
 
-  if ( gridP->mask )       memberMask |= mask;
-  if ( gridP->mask_gme )   memberMask |= mask_gme;
-  if ( gridP->xvals )      memberMask |= xvals;
-  if ( gridP->yvals )      memberMask |= yvals; 
-  if ( gridP->area )       memberMask |= area;
-  if ( gridP->xbounds )    memberMask |= xbounds;
-  if ( gridP->ybounds )    memberMask |= ybounds;
-  if ( gridP->reference )  memberMask |= reference;
-  if ( gridP->rowlon )     memberMask |= rowlon;
-
-  return memberMask;
+  return flags;
 }
 
 
-static
-int gridGetPackSize ( void * voidP, MPI_Comm comm )
+static int
+gridGetPackSize(void * voidP, void *context)
 {
   grid_t * gridP = ( grid_t * ) voidP;
-  int packBuffSize = 0, size, count;
+  int packBuffSize = 0, count;
 
-  xmpi ( MPI_Pack_size ( gridNint + 1, MPI_INT, comm, &size ));
-  packBuffSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBuffSize += size;
+  packBuffSize += serializeGetSize(gridNint, DATATYPE_INT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
 
-  if ( gridP->rowlon )
+  if (gridP->rowlon)
     {
-      xassert ( gridP->nrowlon );
-
-      xmpi ( MPI_Pack_size ( gridP->nrowlon, MPI_INT, comm, &size ));
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
-    }  
+      xassert(gridP->nrowlon);
+      packBuffSize += serializeGetSize(gridP->nrowlon, DATATYPE_INT, context)
+        + serializeGetSize( 1, DATATYPE_FLT64, context);
+    }
 
-  xmpi ( MPI_Pack_size ( gridNdouble + 1, MPI_DOUBLE, comm, &size ));
-  packBuffSize += size;  
+  packBuffSize += serializeGetSize(gridNdouble, DATATYPE_FLT64, context);
 
-  if ( gridP->xvals )
+  if (gridP->xvals)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
-	count =  gridP->size;
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
+	count = gridP->size;
       else
-	count =  gridP->xsize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->xsize;
+      xassert(count);
+      packBuffSize += serializeGetSize(count + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->yvals )
+  if (gridP->yvals)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
-	count =  gridP->size;
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
+	count = gridP->size;
       else
-	count =  gridP->ysize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->ysize;
+      xassert(count);
+      packBuffSize += serializeGetSize(count + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->area )
+  if (gridP->area)
     {
-      xassert ( gridP->size );
-      
-      xmpi ( MPI_Pack_size ( gridP->size, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      xassert(gridP->size);
+      packBuffSize +=
+        serializeGetSize(gridP->size + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->xbounds )
+  if (gridP->xbounds)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
-	count = gridP->nvertex * gridP->size;
+      xassert(gridP->nvertex);
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
+	count = gridP->size;
       else
-	count = gridP->nvertex * gridP->xsize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->xsize;
+      xassert(count);
+      packBuffSize
+        += serializeGetSize(gridP->nvertex * count + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->ybounds )
+  if (gridP->ybounds)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
-	count = gridP->nvertex * gridP->size;
+      xassert(gridP->nvertex);
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
+	count = gridP->size;
       else
-	count = gridP->nvertex * gridP->ysize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->ysize;
+      xassert(count);
+      packBuffSize
+        += serializeGetSize(gridP->nvertex * count + 1, DATATYPE_FLT64, context);
     }
 
-  xmpi ( MPI_Pack_size ( gridNstrings * CDI_MAX_NAME , MPI_CHAR, comm, &size ));
-  packBuffSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBuffSize += size;
+  packBuffSize +=
+    serializeGetSize(gridNstrings * CDI_MAX_NAME , DATATYPE_TXT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
 
-  if ( gridP->reference )
+  if (gridP->reference)
     {
-      count = strlen ( gridP->reference ) + 1;
-      xmpi ( MPI_Pack_size ( 1, MPI_INT, comm, &size ));
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( count, MPI_CHAR, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      packBuffSize += serializeGetSize(1, DATATYPE_INT, context)
+        + serializeGetSize(strlen(gridP->reference) + 1, DATATYPE_TXT, context)
+        + serializeGetSize(1, DATATYPE_FLT64, context);
     }
- 
-  if ( gridP->mask )
+
+  if (gridP->mask)
     {
-      xassert ( gridP->size );
-      xmpi ( MPI_Pack_size ( gridP->size, MPI_UNSIGNED_CHAR, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      xassert(gridP->size);
+      packBuffSize
+        += serializeGetSize(gridP->size, DATATYPE_UCHAR, context)
+        + serializeGetSize(1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->mask_gme )
+  if (gridP->mask_gme)
     {
-      xassert ( gridP->size );
-      xmpi ( MPI_Pack_size ( gridP->size, MPI_UNSIGNED_CHAR, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      xassert(gridP->size);
+      packBuffSize += serializeGetSize(gridP->size, DATATYPE_UCHAR, context)
+        + serializeGetSize( 1, DATATYPE_FLT64, context);
     }
-  
-  return packBuffSize; 
+
+  return packBuffSize;
 }
 
 
-void gridUnpack ( char * unpackBuffer, int unpackBufferSize, 
-		  int * unpackBufferPos, int nspTarget, MPI_Comm comm )
+void
+gridUnpack(char * unpackBuffer, int unpackBufferSize,
+           int * unpackBufferPos, int nspTarget, void *context)
 {
   grid_t * gridP;
-  int intBuffer[gridNint + 1], memberMask, size, referenceSize;
-  double doubleBuffer[gridNdouble + 1], d;
+  int memberMask, size;
+  double d;
   char charBuffer[gridNstrings * CDI_MAX_NAME];
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      intBuffer, gridNint + 1, MPI_INT, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &d, 1, MPI_DOUBLE, comm ));
+  gridInit();
 
-  xassert ( xchecksum ( DATATYPE_INT , gridNint + 1, intBuffer ) == d );
+  gridP = gridNewEntry();
+  xassert(gridP);
+  {
+    int intBuffer[gridNint];
+    serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                    intBuffer, gridNint, DATATYPE_INT, context);
+    serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                    &d, 1, DATATYPE_FLT64, context);
+
+    xassert(xchecksum(DATATYPE_INT, gridNint, intBuffer) == d);
+    xassert(namespaceAdaptKey(intBuffer[0], nspTarget) == gridP->self);
+
+    gridP->type          =   intBuffer[1];
+    gridP->prec          =   intBuffer[2];
+    gridP->lcc_projflag  =   intBuffer[3];
+    gridP->lcc_scanflag  =   intBuffer[4];
+    gridP->lcc_defined   =   intBuffer[5];
+    gridP->lcc2_defined  =   intBuffer[6];
+    gridP->laea_defined  =   intBuffer[7];
+    gridP->isCyclic      =   intBuffer[8];
+    gridP->isRotated     =   intBuffer[9];
+    gridP->xdef          =   intBuffer[10];
+    gridP->ydef          =   intBuffer[11];
+    gridP->nd            =   intBuffer[12];
+    gridP->ni            =   intBuffer[13];
+    gridP->ni2           =   intBuffer[14];
+    gridP->ni3           =   intBuffer[15];
+    gridP->number        =   intBuffer[16];
+    gridP->position      =   intBuffer[17];
+    gridP->trunc         =   intBuffer[18];
+    gridP->nvertex       =   intBuffer[19];
+    gridP->nrowlon       =   intBuffer[20];
+    gridP->size          =   intBuffer[21];
+    gridP->xsize         =   intBuffer[22];
+    gridP->ysize         =   intBuffer[23];
+    gridP->locked        =   intBuffer[24];
+    gridP->lcomplex      =   intBuffer[25];
+    memberMask           =   intBuffer[26];
+  }
 
-  gridInit ();
+  if (memberMask & gridHasRowLonFlag)
+    {
+      xassert(gridP->nrowlon);
+      gridP->rowlon = xmalloc(gridP->nrowlon * sizeof (int));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->rowlon, gridP->nrowlon , DATATYPE_INT, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_INT, gridP->nrowlon, gridP->rowlon) == d);
+    }
 
-  gridP = gridNewEntry();
-  xassert ( gridP );
-
-  xassert ( namespaceAdaptKey ( intBuffer[0], nspTarget ) == gridP->self );
-
-  gridP->type          =   intBuffer[1] ;
-  gridP->prec          =   intBuffer[2] ;
-  gridP->lcc_projflag  =   intBuffer[3] ;
-  gridP->lcc_scanflag  =   intBuffer[4] ;
-  gridP->lcc_defined   =   intBuffer[5] ;
-  gridP->lcc2_defined  =   intBuffer[6] ;
-  gridP->laea_defined  =   intBuffer[7] ;
-  gridP->isCyclic      =   intBuffer[8] ;
-  gridP->isRotated     =   intBuffer[9] ;
-  gridP->xdef          =   intBuffer[10] ;
-  gridP->ydef          =   intBuffer[11];
-  gridP->nd            =   intBuffer[12];
-  gridP->ni            =   intBuffer[13];
-  gridP->ni2           =   intBuffer[14];
-  gridP->ni3           =   intBuffer[15];
-  gridP->number        =   intBuffer[16];
-  gridP->position      =   intBuffer[17];
-  gridP->trunc         =   intBuffer[18];
-  gridP->nvertex       =   intBuffer[19];
-  gridP->nrowlon       =   intBuffer[20];
-  gridP->size          =   intBuffer[21];
-  gridP->xsize         =   intBuffer[22];
-  gridP->ysize         =   intBuffer[23];
-  gridP->locked        =   intBuffer[24];
-  gridP->lcomplex      =   intBuffer[25];
-  memberMask           =   intBuffer[26];
-
-  if ( memberMask & rowlon )
-    {
-      xassert ( gridP->nrowlon );
-      gridP->rowlon = xmalloc ( gridP->nrowlon * sizeof ( int ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			gridP->rowlon, gridP->nrowlon , MPI_INT, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_INT , gridP->nrowlon, gridP->rowlon ) == d );
-    } 
+  {
+    double doubleBuffer[gridNdouble];
+    serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                    doubleBuffer, gridNdouble, DATATYPE_FLT64, context);
+    xassert(doubleBuffer[24]
+            == xchecksum(DATATYPE_FLT, gridNdouble, doubleBuffer));
+
+    gridP->xfirst = doubleBuffer[0];
+    gridP->yfirst = doubleBuffer[1];
+    gridP->xlast = doubleBuffer[2];
+    gridP->ylast = doubleBuffer[3];
+    gridP->xinc = doubleBuffer[4];
+    gridP->yinc = doubleBuffer[5];
+    gridP->lcc_originLon = doubleBuffer[6];
+    gridP->lcc_originLat = doubleBuffer[7];
+    gridP->lcc_lonParY = doubleBuffer[8];
+    gridP->lcc_lat1 = doubleBuffer[9];
+    gridP->lcc_lat2 = doubleBuffer[10];
+    gridP->lcc_xinc = doubleBuffer[11];
+    gridP->lcc_yinc = doubleBuffer[12];
+    gridP->lcc2_lon_0 = doubleBuffer[13];
+    gridP->lcc2_lat_0 = doubleBuffer[14];
+    gridP->lcc2_lat_1 = doubleBuffer[15];
+    gridP->lcc2_lat_2 = doubleBuffer[16];
+    gridP->lcc2_a = doubleBuffer[17];
+    gridP->laea_lon_0 = doubleBuffer[18];
+    gridP->laea_lat_0 = doubleBuffer[19];
+    gridP->laea_a = doubleBuffer[20];
+    gridP->xpole = doubleBuffer[21];
+    gridP->ypole = doubleBuffer[22];
+    gridP->angle = doubleBuffer[23];
+  }
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      doubleBuffer, gridNdouble + 1, MPI_DOUBLE, comm ));
-
-  xassert ( doubleBuffer[24] == xchecksum ( DATATYPE_FLT, gridNdouble, 
-                                            doubleBuffer ));
-
-  gridP->xfirst        =   doubleBuffer[0] ;       
-  gridP->yfirst	       =   doubleBuffer[1] ;
-  gridP->xlast	       =   doubleBuffer[2] ;
-  gridP->ylast	       =   doubleBuffer[3] ;
-  gridP->xinc	       =   doubleBuffer[4] ;
-  gridP->yinc	       =   doubleBuffer[5] ;
-  gridP->lcc_originLon =   doubleBuffer[6] ;         
-  gridP->lcc_originLat =   doubleBuffer[7] ;
-  gridP->lcc_lonParY   =   doubleBuffer[8] ;
-  gridP->lcc_lat1      =   doubleBuffer[9] ;
-  gridP->lcc_lat2      =   doubleBuffer[10];
-  gridP->lcc_xinc      =   doubleBuffer[11];
-  gridP->lcc_yinc      =   doubleBuffer[12];
-  gridP->lcc2_lon_0    =   doubleBuffer[13];         
-  gridP->lcc2_lat_0    =   doubleBuffer[14];
-  gridP->lcc2_lat_1    =   doubleBuffer[15];
-  gridP->lcc2_lat_2    =   doubleBuffer[16];
-  gridP->lcc2_a	       =   doubleBuffer[17];
-  gridP->laea_lon_0    =   doubleBuffer[18];         
-  gridP->laea_lat_0    =   doubleBuffer[19];
-  gridP->laea_a	       =   doubleBuffer[20];
-  gridP->xpole 	       =   doubleBuffer[21];
-  gridP->ypole	       =   doubleBuffer[22];
-  gridP->angle         =   doubleBuffer[23]; 
-
-  if ( memberMask & xvals )
+  if (memberMask & gridHasXValsFlag)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
 	size = gridP->size;
       else
 	size = gridP->xsize;
-      
-      gridP->xvals =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->xvals, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->xvals ) == d );
+
+      gridP->xvals = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->xvals, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->xvals) == d );
     }
 
-  if ( memberMask & yvals )
+  if (memberMask & gridHasYValsFlag)
     {
       if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
 	size = gridP->size;
       else
 	size = gridP->ysize;
-      
-      gridP->yvals =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->yvals, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->yvals ) == d );
+
+      gridP->yvals =  xmalloc( size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->yvals, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->yvals ) == d);
     }
 
-  if ( memberMask & area )
+  if (memberMask & gridHasAreaFlag)
     {
-      xassert ( gridP->size );
-      
-      gridP->area =  xmalloc( gridP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->area, gridP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, gridP->size, gridP->area ) == d );
+      xassert((size = gridP->size));
+      gridP->area = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->area, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->area) == d);
     }
 
-  if ( memberMask & xbounds )
+  if (memberMask & gridHasXBoundsFlag)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->xsize;
-      xassert ( size );
-      
-      gridP->xbounds =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->xbounds, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->xbounds ) == d );
+      xassert(size);
+
+      gridP->xbounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->xbounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->xbounds ) == d);
     }
 
-  if ( memberMask & ybounds )
+  if (memberMask & gridHasYBoundsFlag)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->ysize;
-      xassert ( size );
-      
-      gridP->ybounds =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->ybounds, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->ybounds ) == d );
+      xassert(size);
+
+      gridP->ybounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+			  gridP->ybounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->ybounds ) == d);
     }
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      charBuffer, gridNstrings * CDI_MAX_NAME, MPI_CHAR, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( d == xchecksum ( DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, 
-                             charBuffer ));
+  xassert(d == xchecksum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer));
 
   memcpy ( gridP->xname    , &charBuffer[CDI_MAX_NAME * 0], CDI_MAX_NAME );
   memcpy ( gridP->yname    , &charBuffer[CDI_MAX_NAME * 1], CDI_MAX_NAME );
@@ -22246,197 +22527,203 @@ void gridUnpack ( char * unpackBuffer, int unpackBufferSize,
   memcpy ( gridP->xunits   , &charBuffer[CDI_MAX_NAME * 6], CDI_MAX_NAME );
   memcpy ( gridP->yunits   , &charBuffer[CDI_MAX_NAME * 7], CDI_MAX_NAME );
 
-  if ( memberMask & reference )
+  if (memberMask & gridHasReferenceFlag)
     {
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &referenceSize, 1, MPI_INT, comm ));
-      gridP->reference = xmalloc ( referenceSize );
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->reference, referenceSize, MPI_CHAR, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_TXT, referenceSize, 
-                            gridP->reference ) == d );
+      int referenceSize;
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &referenceSize, 1, DATATYPE_INT, context);
+      gridP->reference = xmalloc(referenceSize);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->reference, referenceSize, DATATYPE_TXT, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_TXT, referenceSize, gridP->reference ) == d );
     }
 
-  if ( memberMask & mask )
+  if (memberMask & gridHasMaskFlag)
     {
-      xassert ( gridP->size );
-      gridP->mask = xmalloc ( gridP->size * sizeof ( mask_t ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->mask, gridP->size, MPI_UNSIGNED_CHAR, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask ) == d );
+      xassert((size = gridP->size));
+      gridP->mask = xmalloc(size * sizeof (mask_t));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->mask, gridP->size, DATATYPE_UCHAR, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_TXT, gridP->size, gridP->mask ) == d);
     }
 
-  if ( memberMask & mask_gme )
+  if (memberMask & gridHasGMEMaskFlag)
     {
-      xassert ( gridP->size );
-      gridP->mask_gme = xmalloc ( gridP->size * sizeof ( mask_t ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->mask_gme, gridP->size, MPI_UNSIGNED_CHAR, 
-                          comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask_gme ) == d );
+      xassert((size = gridP->size));
+      gridP->mask_gme = xmalloc(size * sizeof (mask_t));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->mask_gme, gridP->size, DATATYPE_UCHAR, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_TXT, gridP->size, gridP->mask_gme ) == d);
     }
-} 							       
+}
 
 
-static
-void gridPack ( void * voidP, void * packBuffer, int packBufferSize, 
-		int * packBufferPos, MPI_Comm comm )
+static void
+gridPack(void * voidP, void * packBuffer, int packBufferSize,
+         int * packBufferPos, void *context)
 {
   grid_t   * gridP = ( grid_t * )   voidP;
-  int intBuffer[gridNint + 1], size;
-  double doubleBuffer[gridNdouble + 1], d;
+  int size;
+  double d;
   char charBuffer[gridNstrings * CDI_MAX_NAME];
 
-  intBuffer[0]  = gridP->self;
-  intBuffer[1]  = gridP->type;
-  intBuffer[2]  = gridP->prec;
-  intBuffer[3]  = gridP->lcc_projflag;
-  intBuffer[4]  = gridP->lcc_scanflag;
-  intBuffer[5]  = gridP->lcc_defined;
-  intBuffer[6]  = gridP->lcc2_defined;
-  intBuffer[7]  = gridP->laea_defined;
-  intBuffer[8]  = gridP->isCyclic;
-  intBuffer[9]  = gridP->isRotated; 
-  intBuffer[10] = gridP->xdef; 
-  intBuffer[11] = gridP->ydef;
-  intBuffer[12] = gridP->nd;
-  intBuffer[13] = gridP->ni;
-  intBuffer[14] = gridP->ni2;
-  intBuffer[15] = gridP->ni3; 
-  intBuffer[16] = gridP->number;
-  intBuffer[17] = gridP->position;
-  intBuffer[18] = gridP->trunc;
-  intBuffer[19] = gridP->nvertex;
-  intBuffer[20] = gridP->nrowlon;
-  intBuffer[21] = gridP->size;
-  intBuffer[22] = gridP->xsize;
-  intBuffer[23] = gridP->ysize;
-  intBuffer[24] = gridP->locked;
-  intBuffer[25] = gridP->lcomplex;
-  intBuffer[26] = getMemberMask ( gridP );
-  
-  xmpi ( MPI_Pack ( intBuffer, gridNint + 1, MPI_INT, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT , gridNint + 1, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-
-  if ( gridP->rowlon )
-    {
-      xassert ( gridP->nrowlon );
-      xmpi ( MPI_Pack ( gridP->rowlon, gridP->nrowlon, MPI_INT,
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_INT , gridP->nrowlon, gridP->rowlon );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
-    }  
+  {
+    int intBuffer[gridNint];
+
+    intBuffer[0]  = gridP->self;
+    intBuffer[1]  = gridP->type;
+    intBuffer[2]  = gridP->prec;
+    intBuffer[3]  = gridP->lcc_projflag;
+    intBuffer[4]  = gridP->lcc_scanflag;
+    intBuffer[5]  = gridP->lcc_defined;
+    intBuffer[6]  = gridP->lcc2_defined;
+    intBuffer[7]  = gridP->laea_defined;
+    intBuffer[8]  = gridP->isCyclic;
+    intBuffer[9]  = gridP->isRotated;
+    intBuffer[10] = gridP->xdef;
+    intBuffer[11] = gridP->ydef;
+    intBuffer[12] = gridP->nd;
+    intBuffer[13] = gridP->ni;
+    intBuffer[14] = gridP->ni2;
+    intBuffer[15] = gridP->ni3;
+    intBuffer[16] = gridP->number;
+    intBuffer[17] = gridP->position;
+    intBuffer[18] = gridP->trunc;
+    intBuffer[19] = gridP->nvertex;
+    intBuffer[20] = gridP->nrowlon;
+    intBuffer[21] = gridP->size;
+    intBuffer[22] = gridP->xsize;
+    intBuffer[23] = gridP->ysize;
+    intBuffer[24] = gridP->locked;
+    intBuffer[25] = gridP->lcomplex;
+    intBuffer[26] = gridGetComponentFlags(gridP);
+
+    serializePack(intBuffer, gridNint, DATATYPE_INT,
+                  packBuffer, packBufferSize, packBufferPos, context);
+    d = xchecksum(DATATYPE_INT, gridNint, intBuffer);
+    serializePack(&d, 1, DATATYPE_FLT64,
+                  packBuffer, packBufferSize, packBufferPos, context);
+  }
 
-  doubleBuffer[0]  = gridP->xfirst;         
-  doubleBuffer[1]  = gridP->yfirst;
-  doubleBuffer[2]  = gridP->xlast;
-  doubleBuffer[3]  = gridP->ylast;
-  doubleBuffer[4]  = gridP->xinc;
-  doubleBuffer[5]  = gridP->yinc;
-  doubleBuffer[6]  = gridP->lcc_originLon;          
-  doubleBuffer[7]  = gridP->lcc_originLat;
-  doubleBuffer[8]  = gridP->lcc_lonParY;
-  doubleBuffer[9]  = gridP->lcc_lat1;
-  doubleBuffer[10] = gridP->lcc_lat2;
-  doubleBuffer[11] = gridP->lcc_xinc;
-  doubleBuffer[12] = gridP->lcc_yinc;
-  doubleBuffer[13] = gridP->lcc2_lon_0;             
-  doubleBuffer[14] = gridP->lcc2_lat_0;
-  doubleBuffer[15] = gridP->lcc2_lat_1;
-  doubleBuffer[16] = gridP->lcc2_lat_2;
-  doubleBuffer[17] = gridP->lcc2_a;
-  doubleBuffer[18] = gridP->laea_lon_0;             
-  doubleBuffer[19] = gridP->laea_lat_0;
-  doubleBuffer[20] = gridP->laea_a;
-  doubleBuffer[21] = gridP->xpole; 
-  doubleBuffer[22] = gridP->ypole;
-  doubleBuffer[23] = gridP->angle;
-  doubleBuffer[24] = xchecksum ( DATATYPE_FLT, gridNdouble - 1, doubleBuffer );
-
-  xmpi ( MPI_Pack ( doubleBuffer, gridNdouble + 1, MPI_DOUBLE, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-
-  if ( gridP->xvals )
+  if (gridP->rowlon)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
+      xassert((size = gridP->nrowlon));
+      serializePack(gridP->rowlon, size, DATATYPE_INT,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_INT , size, gridP->rowlon);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+    }
+
+  {
+    double doubleBuffer[gridNdouble];
+
+    doubleBuffer[0]  = gridP->xfirst;
+    doubleBuffer[1]  = gridP->yfirst;
+    doubleBuffer[2]  = gridP->xlast;
+    doubleBuffer[3]  = gridP->ylast;
+    doubleBuffer[4]  = gridP->xinc;
+    doubleBuffer[5]  = gridP->yinc;
+    doubleBuffer[6]  = gridP->lcc_originLon;
+    doubleBuffer[7]  = gridP->lcc_originLat;
+    doubleBuffer[8]  = gridP->lcc_lonParY;
+    doubleBuffer[9]  = gridP->lcc_lat1;
+    doubleBuffer[10] = gridP->lcc_lat2;
+    doubleBuffer[11] = gridP->lcc_xinc;
+    doubleBuffer[12] = gridP->lcc_yinc;
+    doubleBuffer[13] = gridP->lcc2_lon_0;
+    doubleBuffer[14] = gridP->lcc2_lat_0;
+    doubleBuffer[15] = gridP->lcc2_lat_1;
+    doubleBuffer[16] = gridP->lcc2_lat_2;
+    doubleBuffer[17] = gridP->lcc2_a;
+    doubleBuffer[18] = gridP->laea_lon_0;
+    doubleBuffer[19] = gridP->laea_lat_0;
+    doubleBuffer[20] = gridP->laea_a;
+    doubleBuffer[21] = gridP->xpole;
+    doubleBuffer[22] = gridP->ypole;
+    doubleBuffer[23] = gridP->angle;
+    doubleBuffer[24] = xchecksum(DATATYPE_FLT, gridNdouble - 1, doubleBuffer);
+
+    serializePack(doubleBuffer, gridNdouble, DATATYPE_FLT64,
+                  packBuffer, packBufferSize, packBufferPos, context);
+  }
+
+  if (gridP->xvals)
+    {
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
 	size = gridP->size;
       else
 	size = gridP->xsize;
-      xassert ( size );
-      
-      xmpi ( MPI_Pack ( gridP->xvals, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->xvals );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(size);
+
+      serializePack(gridP->xvals, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->xvals);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->yvals )
+  if (gridP->yvals)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
 	size = gridP->size;
       else
 	size = gridP->ysize;
-      xassert ( size );
-      
-      xmpi ( MPI_Pack ( gridP->yvals, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->yvals );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(size);
+      serializePack(gridP->yvals, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->yvals);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->area )
+  if (gridP->area)
     {
-      xassert ( gridP->size );
+      xassert(gridP->size);
 
-      xmpi ( MPI_Pack ( gridP->area, gridP->size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, gridP->size, gridP->area );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(gridP->area, gridP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, gridP->size, gridP->area);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->xbounds )
+  if (gridP->xbounds)
     {
       xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->xsize;
       xassert ( size );
 
-      xmpi ( MPI_Pack ( gridP->xbounds, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->xbounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(gridP->xbounds, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->xbounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->ybounds )
+  if (gridP->ybounds)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      xassert(gridP->nvertex);
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->ysize;
       xassert ( size );
 
-      xmpi ( MPI_Pack ( gridP->ybounds, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->ybounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(gridP->ybounds, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->ybounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
   memcpy ( &charBuffer[CDI_MAX_NAME * 0], gridP->xname,     CDI_MAX_NAME );
@@ -22448,48 +22735,46 @@ void gridPack ( void * voidP, void * packBuffer, int packBufferSize,
   memcpy ( &charBuffer[CDI_MAX_NAME * 6], gridP->xunits,    CDI_MAX_NAME );
   memcpy ( &charBuffer[CDI_MAX_NAME * 7], gridP->yunits,    CDI_MAX_NAME );
 
-  xmpi ( MPI_Pack ( charBuffer, gridNstrings * CDI_MAX_NAME, MPI_CHAR, 
-		    packBuffer, packBufferSize, packBufferPos, comm )); 
-  d = xchecksum  ( DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack( charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT,
+		    packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
 
   if ( gridP->reference )
     {
       size = strlen ( gridP->reference ) + 1;
-      xmpi ( MPI_Pack ( &size, 1, MPI_INT, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      xmpi ( MPI_Pack ( gridP->reference, size, MPI_CHAR, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_TXT, size, gridP->reference );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm )); 
+      serializePack(&size, 1, DATATYPE_INT,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      serializePack(gridP->reference, size, DATATYPE_TXT,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_TXT, size, gridP->reference);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
- 
+
   if ( gridP->mask )
     {
-      xassert ( gridP->size );
-      xmpi ( MPI_Pack ( gridP->mask, gridP->size, MPI_UNSIGNED_CHAR, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm )); 
+      xassert((size = gridP->size));
+      serializePack(gridP->mask, size, DATATYPE_UCHAR,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_TXT, size, gridP->mask);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->mask_gme )
+  if (gridP->mask_gme)
     {
-      xassert ( gridP->size );
+      xassert((size = gridP->size));
 
-      xmpi ( MPI_Pack ( gridP->mask_gme, gridP->size, MPI_UNSIGNED_CHAR, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm )); 
+      serializePack(gridP->mask_gme, size, DATATYPE_UCHAR,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_TXT, size, gridP->mask);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 }
 
-#endif
-
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -22520,27 +22805,32 @@ static struct {
   char *units;
 }
 ZaxistypeEntry[] = {
-  { /*  0 */ 0, "sfc",        "surface",           "",               ""},
-  { /*  1 */ 0, "lev",        "generic",           "",               "level"},
-  { /*  2 */ 2, "lev",        "hybrid",            "",               "level"},
-  { /*  3 */ 2, "lev",        "hybrid_half",       "",               "level"},
-  { /*  4 */ 2, "lev",        "pressure",          "air_pressure",   "Pa"},
-  { /*  5 */ 1, "height",     "height",            "height",         "m"},
-  { /*  6 */ 2, "depth",      "depth_below_sea",   "depth",          "m"},
-  { /*  7 */ 2, "depth",      "depth_below_land",  "",               "cm"},
-  { /*  8 */ 0, "lev",        "isentropic",        "",               "K"},
-  { /*  9 */ 0, "lev",        "trajectory",        "",               ""},
-  { /* 10 */ 1, "alt",        "altitude",          "",               "m"},
-  { /* 11 */ 0, "lev",        "sigma",             "",               "level"},
-  { /* 12 */ 0, "lev",        "meansea",           "",               "level"},
-  { /* 13 */ 0, "toa",        "top_of_atmosphere", "",               ""},
-  { /* 14 */ 0, "seabottom",  "sea_bottom",        "",               ""},
-  { /* 15 */ 0, "atmosphere", "atmosphere",        "",               ""},
-  { /* 16 */ 0, "cloudbase",  "cloud_base",        "",               ""},
-  { /* 17 */ 0, "cloudtop",   "cloud_top",         "",               ""},
-  { /* 18 */ 0, "isotherm0",  "isotherm_zero",     "",               ""},
-  { /* 19 */ 0, "snow",       "snow",              "",               ""},
-  { /* 20 */ 0, "height",     "generalized height","height",         "m"},
+  { /*  0 */ 0, "sfc",               "surface",                "",               ""},
+  { /*  1 */ 0, "lev",               "generic",                "",               "level"},
+  { /*  2 */ 2, "lev",               "hybrid",                 "",               "level"},
+  { /*  3 */ 2, "lev",               "hybrid_half",            "",               "level"},
+  { /*  4 */ 2, "lev",               "pressure",               "air_pressure",   "Pa"},
+  { /*  5 */ 1, "height",            "height",                 "height",         "m"},
+  { /*  6 */ 2, "depth",             "depth_below_sea",        "depth",          "m"},
+  { /*  7 */ 2, "depth",             "depth_below_land",       "",               "cm"},
+  { /*  8 */ 0, "lev",               "isentropic",             "",               "K"},
+  { /*  9 */ 0, "lev",               "trajectory",             "",               ""},
+  { /* 10 */ 1, "alt",               "altitude",               "",               "m"},
+  { /* 11 */ 0, "lev",               "sigma",                  "",               "level"},
+  { /* 12 */ 0, "lev",               "meansea",                "",               "level"},
+  { /* 13 */ 0, "toa",               "top_of_atmosphere",      "",               ""},
+  { /* 14 */ 0, "seabottom",         "sea_bottom",             "",               ""},
+  { /* 15 */ 0, "atmosphere",        "atmosphere",             "",               ""},
+  { /* 16 */ 0, "cloudbase",         "cloud_base",             "",               ""},
+  { /* 17 */ 0, "cloudtop",          "cloud_top",              "",               ""},
+  { /* 18 */ 0, "isotherm0",         "isotherm_zero",          "",               ""},
+  { /* 19 */ 0, "snow",              "snow",                   "",               ""},
+  { /* 20 */ 0, "lakebottom",        "lake_bottom",            "",               ""},
+  { /* 21 */ 0, "sedimentbottom",    "sediment_bottom",        "",               ""},
+  { /* 22 */ 0, "sedimentbottomta",  "sediment_bottom_ta",     "",               ""},
+  { /* 23 */ 0, "sedimentbottomtw",  "sediment_bottom_tw",     "",               ""},
+  { /* 24 */ 0, "mixlayer",          "mix_layer",              "",               ""},
+  { /* 25 */ 0, "height",            "generalized height",     "height",         ""},
 };
 
 static int CDI_MaxZaxistype = sizeof(ZaxistypeEntry) / sizeof(ZaxistypeEntry[0]);
@@ -22564,7 +22854,8 @@ typedef struct {
   int      direction;
   int      vctsize;
   double  *vct;
-  int      reference;
+  int      number;   /* Reference number to a generalized Z-axis */
+  int      nhlev;
   char     uuid[17];
 }
 zaxis_t;
@@ -22572,17 +22863,12 @@ zaxis_t;
 static int    zaxisCompareP    ( void * zaxisptr1, void * zaxisptr2 );
 static void   zaxisDestroyP    ( void * zaxisptr );
 static void   zaxisPrintP      ( void * zaxisptr, FILE * fp );
-#ifdef USE_MPI
-static int    zaxisGetPackSize ( void * zaxisptr, MPI_Comm comm );
-static void   zaxisPack        ( void * zaxisptr, void * buffer, int size,
-                                 int *pos, MPI_Comm comm);
+static int    zaxisGetPackSize ( void * zaxisptr, void *context);
+static void   zaxisPack        ( void * zaxisptr, void * buffer, int size, int *pos, void *context);
 static int    zaxisTxCode      ( void );
-#endif
 
 resOps zaxisOps = { zaxisCompareP, zaxisDestroyP, zaxisPrintP
-#ifdef USE_MPI
                     , zaxisGetPackSize, zaxisPack, zaxisTxCode
-#endif
 };
 
 static int  ZAXIS_Debug = 0;   /* If set to 1, debugging */
@@ -22607,7 +22893,8 @@ void zaxisDefaultValue ( zaxis_t *zaxisptr )
   zaxisptr->size        = 0;
   zaxisptr->vctsize     = 0;
   zaxisptr->vct         = NULL;
-  zaxisptr->reference   = CDI_UNDEFID;
+  zaxisptr->number      = 0;
+  zaxisptr->nhlev       = 0;
   zaxisptr->uuid[0]     = 0;
 }
 
@@ -22677,6 +22964,8 @@ int zaxisSize(void)
                       @func{ZAXIS_ISENTROPIC}, @func{ZAXIS_ALTITUDE}, @func{ZAXIS_MEANSEA}, @func{ZAXIS_TOA},
                       @func{ZAXIS_SEA_BOTTOM}, @func{ZAXIS_ATMOSPHERE}, @func{ZAXIS_CLOUD_BASE},
                       @func{ZAXIS_CLOUD_TOP}, @func{ZAXIS_ISOTHERM_ZERO}, @func{ZAXIS_SNOW},
+                      @func{ZAXIS_LAKE_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM_TA},
+                      @func{ZAXIS_SEDIMENT_BOTTOM_TW}, @func{ZAXIS_MIX_LAYER},
                       @func{ZAXIS_DEPTH_BELOW_SEA} and @func{ZAXIS_DEPTH_BELOW_LAND}.
     @Item  size       Number of levels.
 
@@ -23037,6 +23326,24 @@ int zaxisInqPrec(int zaxisID)
 }
 
 
+void zaxisDefPositive(int zaxisID, int positive)
+{
+  zaxis_t *zaxisptr;
+
+  if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
+    {
+      xwarning("%s", "Operation not executed.");
+      return;
+    }
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  zaxisptr->positive = positive;
+}
+
+
 int zaxisInqPositive(int zaxisID)
 {
   zaxis_t *zaxisptr;
@@ -23150,25 +23457,58 @@ void zaxisDefLevel(int zaxisID, int levelID, double level)
     zaxisptr->vals[levelID] = level;
 }
 
+
+void zaxisDefNlevRef(int zaxisID, const int nhlev)
+{
+  zaxis_t *zaxisptr;
+
+  if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
+    {
+      xwarning("%s", "Operation not executed.");
+      return;
+    }
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  zaxisptr->nhlev = nhlev;
+}
+
+
+int zaxisInqNlevRef(int zaxisID)
+{
+  int nhlev = -1;
+  zaxis_t *zaxisptr;
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  nhlev = zaxisptr->nhlev;
+
+  return (nhlev);
+}
+
 /*
- at Function  zaxisDefReference
- at Title     Define the reference for a genralized Z-axis
+ at Function  zaxisDefNumber
+ at Title     Define the reference number for a generalized Z-axis
 
- at Prototype void zaxisDefReference(int zaxisID, const int reference)
+ at Prototype void zaxisDefNumber(int zaxisID, const int number)
 @Parameter
     @Item  zaxisID     Z-axis ID, from a previous call to @fref{zaxisCreate}.
-    @Item  reference   Reference for a generalized Z-axis.
+    @Item  number      Reference number for a generalized Z-axis.
 
 @Description
-The function @func{zaxisDefReference} defines the reference for a generalized  Z-axis.
+The function @func{zaxisDefNumber} defines the reference number for a generalized Z-axis.
 
 @EndFunction
 */
-void zaxisDefReference(int zaxisID, const int reference)
+void zaxisDefNumber(int zaxisID, const int number)
 {
   zaxis_t *zaxisptr;
 
-    if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
+  if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
     {
       xwarning("%s", "Operation not executed.");
       return;
@@ -23178,7 +23518,36 @@ void zaxisDefReference(int zaxisID, const int reference)
 
   zaxis_check_ptr(zaxisID, zaxisptr);
 
-  zaxisptr->reference = reference;
+  zaxisptr->number = number;
+}
+
+/*
+ at Function  zaxisInqNumber
+ at Title     Get the reference number to a generalized Z-axis
+
+ at Prototype int zaxisInqNumber(int zaxisID)
+ at Parameter
+    @Item  zaxisID  Z-axis ID, from a previous call to @fref{zaxisCreate}.
+
+ at Description
+The function @func{zaxisInqNumber} returns the reference number to a generalized Z-axis.
+
+ at Result
+ at func{zaxisInqNumber} returns the reference number to a generalized Z-axis.
+ at EndFunction
+*/
+int zaxisInqNumber(int zaxisID)
+{
+  int number = -1;
+  zaxis_t *zaxisptr;
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  number = zaxisptr->number;
+
+  return (number);
 }
 
 /*
@@ -23216,7 +23585,7 @@ void zaxisDefUUID(int zaxisID, const char *uuid)
 
 /*
 @Function  zaxisInqUUID
- at Title     Get the uuid to a generalized Z-axis.
+ at Title     Get the uuid to a generalized Z-axis
 
 @Prototype char *zaxisInqUUID(int zaxisID, char *uuid)
 @Parameter
@@ -23243,35 +23612,6 @@ char *zaxisInqUUID(int zaxisID, char *uuid)
 }
 
 /*
- at Function  zaxisInqReference
- at Title     Get the reference to a generalized Z-axis.
-
- at Prototype int zaxisInqReference(int zaxisID)
- at Parameter
-    @Item  zaxisID  Z-axis ID, from a previous call to @fref{zaxisCreate}.
-
- at Description
-The function @func{zaxisInqReference} returns the reference to a generalized Z-axis.
-
- at Result
- at func{zaxisInqReference} returns the reference to a generalized Z-axis.
- at EndFunction
-*/
-int zaxisInqReference(int zaxisID)
-{
-  int reference = -1;
-  zaxis_t *zaxisptr;
-
-  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
-
-  zaxis_check_ptr(zaxisID, zaxisptr);
-
-  reference = zaxisptr->reference;
-
-  return (reference);
-}
-
-/*
 @Function  zaxisInqLevel
 @Title     Get one level of a Z-axis
 
@@ -23488,6 +23828,8 @@ The valid CDI Z-axis types are @func{ZAXIS_GENERIC}, @func{ZAXIS_SURFACE},
 @func{ZAXIS_ISENTROPIC}, @func{ZAXIS_ALTITUDE}, @func{ZAXIS_MEANSEA}, @func{ZAXIS_TOA},
 @func{ZAXIS_SEA_BOTTOM}, @func{ZAXIS_ATMOSPHERE}, @func{ZAXIS_CLOUD_BASE},
 @func{ZAXIS_CLOUD_TOP}, @func{ZAXIS_ISOTHERM_ZERO}, @func{ZAXIS_SNOW},
+ at func{ZAXIS_LAKE_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM_TA},
+ at func{ZAXIS_SEDIMENT_BOTTOM_TW}, @func{ZAXIS_MIX_LAYER},
 @func{ZAXIS_DEPTH_BELOW_SEA} and @func{ZAXIS_DEPTH_BELOW_LAND}.
 
 @EndFunction
@@ -24046,14 +24388,13 @@ int  zaxisCompareP ( void * zaxisptr1, void * zaxisptr2 )
 }
 
 
-#ifdef USE_MPI
 static int
 zaxisTxCode ( void )
 {
   return ZAXIS;
 }
 
-enum { zaxisNint     = 7,
+enum { zaxisNint     = 8,
        zaxisNstrings = 4,
        vals     = 1 << 0,
        lbounds  = 1 << 1,
@@ -24077,99 +24418,63 @@ int zaxisGetMemberMask ( zaxis_t * zaxisP )
   return memberMask;
 }
 
-static
-int zaxisGetPackSize ( void * voidP, MPI_Comm comm )
+static int
+zaxisGetPackSize(void * voidP, void *context)
 {
   zaxis_t * zaxisP = ( zaxis_t * ) voidP;
-  int packBufferSize = 0, size;
+  int packBufferSize = serializeGetSize(zaxisNint, DATATYPE_INT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
 
-  xmpi ( MPI_Pack_size ( zaxisNint + 1, MPI_INT, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
+  if (zaxisP->vals || zaxisP->lbounds || zaxisP->ubounds || zaxisP->weights)
+    xassert(zaxisP->size);
 
   if ( zaxisP->vals )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize( zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->lbounds )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize(zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->ubounds )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize(zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->weights )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize(zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->vct )
     {
       xassert ( zaxisP->vctsize );
-
-      xmpi ( MPI_Pack_size ( zaxisP->vctsize, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
+      packBufferSize += serializeGetSize(zaxisP->vctsize + 1, DATATYPE_FLT64, context);
     }
 
-  xmpi ( MPI_Pack_size ( zaxisNstrings * CDI_MAX_NAME , MPI_CHAR, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_UNSIGNED_CHAR, comm, &size ));
-  packBufferSize += size;
-
+  packBufferSize += serializeGetSize(zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context)
+    + serializeGetSize(1, DATATYPE_UCHAR, context);
   return packBufferSize;
 }
 
 
-void zaxisUnpack ( char * unpackBuffer, int unpackBufferSize,
-                   int * unpackBufferPos, int nspTarget, MPI_Comm comm )
+void
+zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
+            int * unpackBufferPos, int nspTarget, void *context)
 {
   zaxis_t * zaxisP;
-  int intBuffer[zaxisNint + 1], memberMask;
+  int intBuffer[zaxisNint], memberMask;
   double d;
   char charBuffer[zaxisNstrings * CDI_MAX_NAME];
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      intBuffer, zaxisNint + 1, MPI_INT, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  intBuffer, zaxisNint, DATATYPE_INT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( xchecksum ( DATATYPE_INT, zaxisNint + 1, intBuffer ) == d );
+  xassert ( xchecksum ( DATATYPE_INT, zaxisNint, intBuffer ) == d );
 
   zaxisInit ();
 
   zaxisP = zaxisNewEntry();
   if ( ! zaxisP ) Error("No memory");
 
-  xassert ( namespaceAdaptKey ( intBuffer[0], nspTarget ) == zaxisP->self );
+  xassert(namespaceAdaptKey(intBuffer[0], nspTarget) == zaxisP->self);
 
   zaxisP->prec      = intBuffer[1];
   zaxisP->type      = intBuffer[2];
@@ -24179,88 +24484,93 @@ void zaxisUnpack ( char * unpackBuffer, int unpackBufferSize,
   zaxisP->vctsize   = intBuffer[6];
   memberMask        = intBuffer[7];
 
-  if ( memberMask & vals )
+  if (memberMask & vals)
     {
-      xassert ( zaxisP->size );
+      int size;
+      xassert((size = zaxisP->size));
 
-      zaxisP->vals = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->vals, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->vals ) == d );
+      zaxisP->vals = xmalloc(size * sizeof ( double ));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->vals, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->vals) == d);
     }
 
-  if ( memberMask & lbounds )
+  if (memberMask & lbounds)
     {
-      xassert ( zaxisP->size );
+      int size;
+      xassert((size = zaxisP->size));
 
-      zaxisP->lbounds = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->lbounds, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->lbounds ) == d );
+      zaxisP->lbounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->lbounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->lbounds) == d);
     }
 
-  if ( memberMask & ubounds )
+  if (memberMask & ubounds)
     {
-      xassert ( zaxisP->size );
+      int size;
+      xassert((size = zaxisP->size));
 
-      zaxisP->ubounds = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->ubounds, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->ubounds ) == d );
+      zaxisP->ubounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->ubounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->ubounds) == d);
     }
 
-  if ( memberMask & weights )
+  if (memberMask & weights)
     {
-      xassert ( zaxisP->size );
+      int size;
+      xassert((size = zaxisP->size));
 
-      zaxisP->weights = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->weights, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->weights ) == d );
+      zaxisP->weights = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->weights, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->weights) == d);
     }
 
   if ( memberMask & vct )
     {
-      xassert ( zaxisP->vctsize );
+      int size;
+      xassert((size = zaxisP->vctsize));
 
-      zaxisP->vct = xmalloc ( zaxisP->vctsize * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->vct, zaxisP->vctsize, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->vctsize, zaxisP->vct ) == d );
+      zaxisP->vct = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->vct, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->vct) == d);
     }
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      charBuffer, zaxisNstrings * CDI_MAX_NAME, MPI_CHAR, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( d == xchecksum ( DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer ));
+  xassert(d == xchecksum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer));
 
   memcpy ( zaxisP->name,     &charBuffer[CDI_MAX_NAME * 0], CDI_MAX_NAME );
   memcpy ( zaxisP->longname, &charBuffer[CDI_MAX_NAME * 1], CDI_MAX_NAME );
   memcpy ( zaxisP->stdname,  &charBuffer[CDI_MAX_NAME * 2], CDI_MAX_NAME );
   memcpy ( zaxisP->units,    &charBuffer[CDI_MAX_NAME * 3], CDI_MAX_NAME );
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      &zaxisP->positive, 1, MPI_UNSIGNED_CHAR, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &zaxisP->positive, 1, DATATYPE_UCHAR, context);
 }
 
-static
-void zaxisPack ( void * voidP, void * packBuffer, int packBufferSize,
-                 int * packBufferPos, MPI_Comm comm )
+static void
+zaxisPack(void * voidP, void * packBuffer, int packBufferSize,
+          int * packBufferPos, void *context)
 {
   zaxis_t   * zaxisP = ( zaxis_t * ) voidP;
-  int intBuffer[zaxisNint + 1];
+  int intBuffer[zaxisNint];
   double d;
   char charBuffer[zaxisNstrings * CDI_MAX_NAME];
 
@@ -24273,66 +24583,64 @@ void zaxisPack ( void * voidP, void * packBuffer, int packBufferSize,
   intBuffer[6]  = zaxisP->vctsize;
   intBuffer[7]  = zaxisGetMemberMask ( zaxisP );
 
-  xmpi ( MPI_Pack ( intBuffer, zaxisNint + 1, MPI_INT,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT, zaxisNint + 1, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(intBuffer, zaxisNint, DATATYPE_INT,
+                packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum ( DATATYPE_INT, zaxisNint, intBuffer );
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
+
 
   if ( zaxisP->vals )
     {
-
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack ( zaxisP->vals, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->vals );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(zaxisP->size);
+      serializePack(zaxisP->vals, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->vals );
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->lbounds )
+  if (zaxisP->lbounds)
     {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack ( zaxisP->lbounds, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->lbounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(zaxisP->size);
+      serializePack(zaxisP->lbounds, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->lbounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->ubounds )
+  if (zaxisP->ubounds)
     {
-      xassert ( zaxisP->size );
+      xassert(zaxisP->size);
 
-      xmpi ( MPI_Pack ( zaxisP->ubounds, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->ubounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(zaxisP->ubounds, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->ubounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->weights )
+  if (zaxisP->weights)
     {
-      xassert ( zaxisP->size );
+      xassert(zaxisP->size);
 
-      xmpi ( MPI_Pack ( zaxisP->weights, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->weights );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(zaxisP->weights, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->weights);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->vct )
+  if (zaxisP->vct)
     {
-      xassert ( zaxisP->vctsize );
+      xassert(zaxisP->vctsize);
 
-      xmpi ( MPI_Pack ( zaxisP->vct, zaxisP->vctsize, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->vctsize, zaxisP->vct );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(zaxisP->vct, zaxisP->vctsize, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->vctsize, zaxisP->vct);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
   memcpy ( &charBuffer[CDI_MAX_NAME * 0], zaxisP->name,     CDI_MAX_NAME );
@@ -24340,17 +24648,16 @@ void zaxisPack ( void * voidP, void * packBuffer, int packBufferSize,
   memcpy ( &charBuffer[CDI_MAX_NAME * 2], zaxisP->stdname,  CDI_MAX_NAME );
   memcpy ( &charBuffer[CDI_MAX_NAME * 3], zaxisP->units,    CDI_MAX_NAME );
 
-  xmpi ( MPI_Pack ( charBuffer, zaxisNstrings * CDI_MAX_NAME, MPI_CHAR,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum  ( DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT,
+                packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
 
-  xmpi ( MPI_Pack ( &zaxisP->positive, 1, MPI_UNSIGNED_CHAR,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(&zaxisP->positive, 1, DATATYPE_UCHAR,
+                packBuffer, packBufferSize, packBufferPos, context);
 }
 
-#endif
 
 void zaxisGetIndexList ( int nzaxis, int * zaxisResHs )
 {
@@ -24374,7 +24681,6 @@ void zaxisGetIndexList ( int nzaxis, int * zaxisResHs )
 #include <string.h>
 
 
-
 extern int CDF_Fatal;
 extern int CDF_Verbose;
 extern int CDF_Debug;
@@ -24387,7 +24693,6 @@ extern int CDF_Debug;
 
 static size_t ChunkSizeMin = MIN_BUF_SIZE;
 */
-
 void cdf_create(const char *path, int cmode, int *ncidp)
 {
   int status;
@@ -24422,7 +24727,9 @@ void cdf_create(const char *path, int cmode, int *ncidp)
 
   if ( cdiNcChunksizehint != CDI_UNDEFID ) chunksizehint = cdiNcChunksizehint;
 
-  status = nc__create(path, cmode, initialsz, &chunksizehint, ncidp);
+  cdi_nc__create_funcp my_nc__create =
+    (cdi_nc__create_funcp)namespaceSwitchGet(NSSWITCH_NC__CREATE).func;
+  status = my_nc__create(path, cmode, initialsz, &chunksizehint, ncidp);
 
   if ( CDF_Debug || status != NC_NOERR )
     Message("ncid = %d  mode = %d  file = %s", *ncidp, cmode, path);
@@ -24465,6 +24772,7 @@ int cdf_open(const char *path, int omode, int *ncidp)
       */
       if ( cdiNcChunksizehint != CDI_UNDEFID ) chunksizehint = cdiNcChunksizehint;
 
+      /* FIXME: parallel part missing */
       status = nc__open(path, omode, &chunksizehint, ncidp);
 
       if ( CDF_Debug ) Message("chunksizehint %d", chunksizehint);
@@ -24599,11 +24907,18 @@ void cdf_inq_dimlen(int ncid, int dimid, size_t * lengthp)
 
 
 void cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims,
-	    const int dimids[], int *varidp)
+                 const int dimids[], int *varidp)
 {
-  int status;
+  cdi_cdf_def_var_funcp my_cdf_def_var
+    = (cdi_cdf_def_var_funcp)namespaceSwitchGet(NSSWITCH_CDF_DEF_VAR).func;
+  my_cdf_def_var(ncid, name, xtype, ndims, dimids, varidp);
+}
 
-  status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp);
+void
+cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
+                   const int dimids[], int *varidp)
+{
+  int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp);
 
   if ( CDF_Debug || status != NC_NOERR )
     Message("ncid = %d  name = %s  xtype = %d  ndims = %d  varid = %d",
@@ -24613,6 +24928,7 @@ void cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims,
 }
 
 
+
 void cdf_inq_varid(int ncid, const char *name, int *varidp)
 {
   int status;
@@ -25357,10 +25673,14 @@ char *cdiUnitNamePtr(int cdi_unit)
 #include <ctype.h>
 
 
+#ifdef HAVE_LIBNETCDF
+#endif
 
 #if  defined  (HAVE_LIBCGRIBEX)
 #endif
 
+extern int cdiPioSerialOpenFileMap(int streamID);
+
 int cdiDefaultCalendar = CALENDAR_PROLEPTIC;
 
 int cdiDefaultInstID   = CDI_UNDEFID;
@@ -25412,19 +25732,14 @@ static int cdiHaveMissval = 0;
 static int    streamCompareP ( void * streamptr1, void * streamptr2 );
 static void   streamDestroyP ( void * streamptr );
 static void   streamPrintP   ( void * streamptr, FILE * fp );
-#ifdef USE_MPI
-static int    streamGetPackSize ( void * streamptr, MPI_Comm comm );
-static void   streamPack        ( void * streamptr, void * buff, int size,
-				  int * position, MPI_Comm comm );
+static int    streamGetPackSize ( void * streamptr, void *context);
+static void   streamPack        ( void * streamptr, void * buff, int size, int * position, void *context );
 static int    streamTxCode      ( void );
-#endif
 
 resOps streamOps = { streamCompareP, streamDestroyP, streamPrintP,
-#ifdef USE_MPI
                      streamGetPackSize,
 		     streamPack,
                      streamTxCode
-#endif
 };
 
 long cdiGetenvInt(char *envName)
@@ -25903,19 +26218,19 @@ int  streamCompareP ( void * streamptr1, void * streamptr2 )
   xassert ( s2 );
 
   if ( s1->filetype  != s2->filetype  ) return differ;
-  if (  namespaceAdaptKey2 ( s1->vlistIDorig ) != 			     
+  if (  namespaceAdaptKey2 ( s1->vlistIDorig ) !=
 	namespaceAdaptKey2 ( s2->vlistIDorig )) return differ;
   if ( s1->byteorder != s2->byteorder ) return differ;
   if ( s1->comptype  != s2->comptype  ) return differ;
-  if ( s1->complevel != s2->complevel ) return differ; 
+  if ( s1->complevel != s2->complevel ) return differ;
 
   if ( s1->filename )
     {
       len = strlen ( s1->filename ) + 1;
-      if ( memcmp ( s1->filename, s2->filename, len )) 
+      if ( memcmp ( s1->filename, s2->filename, len ))
 	return differ;
     }
-  else if ( s2->filename ) 
+  else if ( s2->filename )
     return differ;
 
   return equal;
@@ -25998,10 +26313,47 @@ void streamGetIndexList ( int nstreams, int * streamIndexList )
   reshGetResHListOfType ( nstreams, streamIndexList, &streamOps );
 }
 
+void
+cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig)
+{
+  int nvars = vlistNvars(vlistID);
+  streamptr->vlistID = vlistID;
+  streamptr->vlistIDorig = vlistIDorig;
+  for (int varID = 0; varID < nvars; varID++ )
+    {
+      int gridID  = vlistInqVarGrid(vlistID, varID);
+      int zaxisID = vlistInqVarZaxis(vlistID, varID);
+      stream_new_var(streamptr, gridID, zaxisID);
+      if ( streamptr->have_missval )
+        vlistDefVarMissval(vlistID, varID,
+                           vlistInqVarMissval(vlistID, varID));
+    }
+
+  if (streamptr->filemode == 'w' )
+    {
+      if ( streamptr->filetype == FILETYPE_NC  ||
+           streamptr->filetype == FILETYPE_NC2 ||
+           streamptr->filetype == FILETYPE_NC4 ||
+           streamptr->filetype == FILETYPE_NC4C )
+        {
+#ifdef HAVE_LIBNETCDF
+          void (*myCdfDefVars)(stream_t *streamptr)
+            = (void (*)(stream_t *))
+            namespaceSwitchGet(NSSWITCH_CDF_STREAM_SETUP).func;
+          myCdfDefVars(streamptr);
+#endif
+        }
+      else if ( streamptr->filetype == FILETYPE_GRB  ||
+                streamptr->filetype == FILETYPE_GRB2 )
+        {
+          gribContainersNew(streamptr);
+        }
+    }
+}
+
 
-#ifdef USE_MPI
 static int
-streamTxCode ( void )
+streamTxCode(void)
 {
   return STREAM;
 }
@@ -26010,65 +26362,85 @@ streamTxCode ( void )
 int streamNint = 11 ;
 
 
-static
-int streamGetPackSize ( void * voidP, MPI_Comm comm )
+static int
+streamGetPackSize(void * voidP, void *context)
 {
   stream_t * streamP = ( stream_t * ) voidP;
-  int packBufferSize = 0, size;
-
-  xmpi ( MPI_Pack_size ( streamNint, MPI_INT, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += 2 * size;
-
-
-  xmpi ( MPI_Pack_size (( int ) strlen ( streamP->filename ) + 1,
-			MPI_CHAR, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
-
+  int packBufferSize
+    = serializeGetSize(streamNint, DATATYPE_INT, context)
+    + serializeGetSize(2, DATATYPE_FLT64, context)
+    + serializeGetSize((int)strlen(streamP->filename) + 1,
+                       DATATYPE_TXT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
   return packBufferSize;
 }
 
 
-static
-void streamPack ( void * streamptr, void * packBuffer, int packBufferSize,
-                  int * packBufferPos, MPI_Comm comm )
+static void
+streamPack(void * streamptr, void * packBuffer, int packBufferSize,
+           int * packBufferPos, void *context)
 {
   stream_t * streamP = ( stream_t * ) streamptr;
-  int intBuffer[streamNint];  
+  int intBuffer[streamNint];
   double d;
 
   intBuffer[0]  = streamP->self;
   intBuffer[1]  = streamP->filetype;
-  intBuffer[2]  =  ( int ) strlen ( streamP->filename ) + 1;
+  intBuffer[2]  = (int)strlen(streamP->filename) + 1;
   intBuffer[3]  = streamP->vlistID;
   intBuffer[4]  = streamP->vlistIDorig;
   intBuffer[5]  = streamP->byteorder;
   intBuffer[6]  = streamP->comptype;
-  intBuffer[7]  = streamP->complevel; 
+  intBuffer[7]  = streamP->complevel;
   intBuffer[8]  = cdiDataUnreduced;
   intBuffer[9]  = cdiSortName;
   intBuffer[10] = cdiHaveMissval;
-  
-  xmpi ( MPI_Pack ( intBuffer, streamNint, MPI_INT, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT , streamNint, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
 
-  xmpi ( MPI_Pack ( &cdiDefaultMissval, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(intBuffer, streamNint, DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_INT, streamNint, intBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context);
 
-  xmpi ( MPI_Pack ( streamP->filename, intBuffer[2], MPI_CHAR, 
-		    packBuffer, packBufferSize, packBufferPos, comm )); 
-  d = xchecksum  ( DATATYPE_TXT, intBuffer[2], &streamP->filename );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(&cdiDefaultMissval, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context);
+  serializePack(streamP->filename, intBuffer[2], DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_TXT, intBuffer[2], &streamP->filename);
+  serializePack(&d, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context);
 }
 
-#endif
+struct streamAssoc
+streamUnpack(char * unpackBuffer, int unpackBufferSize,
+             int * unpackBufferPos, int nspTarget, void *context)
+{
+  int intBuffer[streamNint], streamID;
+  double d;
+  char filename[CDI_MAX_NAME];
+
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  intBuffer, streamNint, DATATYPE_INT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
+  xassert(xchecksum(DATATYPE_INT, streamNint, intBuffer ) == d);
+
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &cdiDefaultMissval, 1, DATATYPE_FLT64, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &filename, intBuffer[2], DATATYPE_TXT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
+  xassert(d == xchecksum(DATATYPE_TXT, intBuffer[2], filename));
+  streamID = streamOpenWrite ( filename, intBuffer[1] );
+  xassert ( streamID >= 0 &&
+            namespaceAdaptKey ( intBuffer[0], nspTarget ) == streamID );
+  streamDefByteorder(streamID, intBuffer[5]);
+  streamDefCompType(streamID, intBuffer[6]);
+  streamDefCompLevel(streamID, intBuffer[7]);
+  cdiDefGlobal("REGULARGRID", intBuffer[8]);
+  cdiDefGlobal("SORTNAME", intBuffer[9]);
+  cdiDefGlobal("HAVE_MISSVAL", intBuffer[10]);
+  struct streamAssoc retval = { streamID, intBuffer[3], intBuffer[4] };
+  return retval;
+}
+
+
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -26095,7 +26467,8 @@ extern resOps streamOps;
 FILE *popen(const char *command, const char *type);
 int pclose(FILE *stream);
 
-void cdiPrintDefaults(void)
+static void
+cdiPrintDefaults(void)
 {
   fprintf (stderr, "default instID     :  %d\n", cdiDefaultInstID);
   fprintf (stderr, "default modelID    :  %d\n", cdiDefaultModelID);
@@ -26580,7 +26953,7 @@ int streamInqByteorder(int streamID)
 
 char *streamFilesuffix(int filetype)
 {
-  static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc2", ".nc4", ".nc4", ".srv", ".ext", ".ieg", ".h5"};
+  static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc", ".nc4", ".nc4", ".srv", ".ext", ".ieg"};
   int size = (int) (sizeof(fileSuffix)/sizeof(char *));
 
   if ( filetype > 0 && filetype < size )
@@ -26700,132 +27073,129 @@ int cdiInqContents(stream_t * streamptr)
   return (status);
 }
 
-
-int streamOpen(const char *filename, const char *filemode, int filetype)
+int cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
+                                 int filetype, stream_t *streamptr,
+                                 int recordBufIsToBeCreated)
 {
-  int fileID = CDI_UNDEFID;
-  int streamID = CDI_ESYSTEM;
-  int status;
-  Record *record = NULL;
-  stream_t *streamptr = NULL;
-  int hasLocalFile = namespaceHasLocalFile ( namespaceGetActive ());
-
-  if ( CDI_Debug )
-    Message("Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
-
-  if ( ! filename || ! filemode || filetype < 0 ) return (CDI_EINVAL);
-
-  xdebug("START, filename = %s, filemode = %s, filetype = %d, "
-         "namespaceHasLocalFile(%d)=%s",
-         filename, filemode, filetype, namespaceGetActive(),
-	 namespaceHasLocalFile ( namespaceGetActive ()) ? "true":"false");
-
-  if ( hasLocalFile )
+  int fileID;
+  switch (filetype)
     {
-      switch (filetype)
-	{
 #if  defined  (HAVE_LIBGRIB)
-	case FILETYPE_GRB:
-	case FILETYPE_GRB2:
-	  {
-	    fileID = gribOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-            xdebug("%s OPENED, fileID=%d", filename, fileID);
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    break;
-	  }
+    case FILETYPE_GRB:
+    case FILETYPE_GRB2:
+      {
+        fileID = gribOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBSERVICE)
-	case FILETYPE_SRV:
-	  {
-	    fileID = fileOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    record->srvp   = srvNew();
-	    break;
-	  }
+    case FILETYPE_SRV:
+      {
+        fileID = fileOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+            streamptr->record->srvp   = srvNew();
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBEXTRA)
-	case FILETYPE_EXT:
-	  {
-	    fileID = fileOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    record->extp   = extNew();
-	    break;
-	  }
+    case FILETYPE_EXT:
+      {
+        fileID = fileOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+            streamptr->record->extp   = extNew();
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBIEG)
-	case FILETYPE_IEG:
-	  {
-	    fileID = fileOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    record->iegp   = iegNew();
-	    break;
-	  }
+    case FILETYPE_IEG:
+      {
+        fileID = fileOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+            streamptr->record->iegp   = iegNew();
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBNETCDF)
-	case FILETYPE_NC:
-	  {
-	    fileID = cdfOpen(filename, filemode);
-	    break;
-	  }
-	case FILETYPE_NC2:
-	  {
-	    fileID = cdfOpen64(filename, filemode);
-	    break;
-	  }
-	case FILETYPE_NC4:
-	case FILETYPE_NC4C:
-	  {
-	    fileID = cdf4Open(filename, filemode, &filetype);
-	    break;
-	  }
-#endif
-	default:
-	  {
-	    if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
-	    return (CDI_ELIBNAVAIL);
-	  }
-	}
-    }
-#ifdef USE_MPI
-  else if ( tolower ( * filemode ) == 'w' )
-    {
-      statusCode nspStatus = namespaceInqResStatus ();
-      switch ( nspStatus )
-        {
-        case STAGE_DEFINITION:
-          break;
-        case STAGE_TIMELOOP:
-          pioBufferFuncCall(STREAMOPEN, 2, filename, filetype);
-          break;
-        case STAGE_CLEANUP:
-          xabort ( "TRANSITION TO IO PROCESSES ALREADY FINISHED." );
+    case FILETYPE_NC:
+      {
+        fileID = cdfOpen(filename, filemode);
         break;
-        default:
-          xabort ( "INTERNAL ERROR" );
-        }
-    }
+      }
+    case FILETYPE_NC2:
+      {
+        fileID = cdfOpen64(filename, filemode);
+        break;
+      }
+    case FILETYPE_NC4:
+    case FILETYPE_NC4C:
+      {
+        fileID = cdf4Open(filename, filemode, &filetype);
+        break;
+      }
 #endif
+    default:
+      {
+        if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
+        return (CDI_ELIBNAVAIL);
+      }
+    }
+  return fileID;
+}
+
+
+int streamOpen(const char *filename, const char *filemode, int filetype)
+{
+  int fileID = CDI_UNDEFID;
+  int streamID = CDI_ESYSTEM;
+  int status;
+  stream_t *streamptr = stream_new_entry();
+
+  if ( CDI_Debug )
+    Message("Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
+
+  if ( ! filename || ! filemode || filetype < 0 ) return (CDI_EINVAL);
+
+  {
+    int (*streamOpenDelegate)(const char *filename, const char *filemode,
+                              int filetype, stream_t *streamptr)
+      = (int (*)(const char *, const char *, int, stream_t *))
+      namespaceSwitchGet(NSSWITCH_STREAM_OPEN_BACKEND).func;
+    fileID = streamOpenDelegate(filename, filemode, filetype, streamptr);
+  }
 
-  if ( fileID < 0 && hasLocalFile )
+  if (fileID < 0)
     {
+      free(streamptr->record);
+      stream_delete_entry(streamptr);
       streamID = fileID;
     }
   else
     {
-      streamptr = stream_new_entry();
       streamID  = streamptr->self;
 
       if ( streamID < 0 ) return (CDI_ELIMIT);
 
-      streamptr->record   = record;
       streamptr->filetype = filetype;
       streamptr->filemode = tolower(*filemode);
       streamptr->filename = strdupx(filename);
@@ -26851,87 +27221,29 @@ int streamOpen(const char *filename, const char *filemode, int filetype)
 }
 
 
-int streamOpenA(const char *filename, const char *filemode, int filetype)
+static int streamOpenA(const char *filename, const char *filemode, int filetype)
 {
   int fileID = CDI_UNDEFID;
   int streamID = CDI_ESYSTEM;
   int status;
   Record *record = NULL;
-  stream_t *streamptr = NULL;
+  stream_t *streamptr = stream_new_entry();
 
   if ( CDI_Debug )
     Message("Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
 
   if ( ! filename || ! filemode || filetype < 0 ) return (CDI_EINVAL);
 
-  switch (filetype)
-    {
-#if  defined  (HAVE_LIBGRIB)
-    case FILETYPE_GRB:
-    case FILETYPE_GRB2:
-      {
-        fileID = gribOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBSERVICE)
-    case FILETYPE_SRV:
-      {
-        fileID = fileOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	record->srvp   = srvNew();
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBEXTRA)
-    case FILETYPE_EXT:
-      {
-        fileID = fileOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	record->extp   = extNew();
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBIEG)
-    case FILETYPE_IEG:
-      {
-        fileID = fileOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	record->iegp   = iegNew();
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBNETCDF)
-    case FILETYPE_NC:
-      {
-	fileID = cdfOpen(filename, "r");
-	break;
-      }
-    case FILETYPE_NC2:
-      {
-	fileID = cdfOpen64(filename, "r");
-	break;
-      }
-    case FILETYPE_NC4:
-    case FILETYPE_NC4C:
-      {
-	fileID = cdf4Open(filename, "r", &filetype);
-	break;
-      }
-#endif
-    default:
-      {
-	if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
-	return (CDI_ELIBNAVAIL);
-      }
-    }
+  {
+    int (*streamOpenDelegate)(const char *filename, const char *filemode,
+                              int filetype, stream_t *streamptr)
+      = (int (*)(const char *, const char *, int, stream_t *))
+      namespaceSwitchGet(NSSWITCH_STREAM_OPEN_BACKEND).func;
+    fileID = streamOpenDelegate(filename, "r", filetype, streamptr);
+  }
 
-  if ( fileID == CDI_UNDEFID || fileID == CDI_ELIBNAVAIL )
+  if (fileID == CDI_UNDEFID || fileID == CDI_ELIBNAVAIL
+      || fileID == CDI_ESYSTEM )
     {
       streamID = fileID;
       return (streamID);
@@ -26939,7 +27251,6 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
   else
     {
       vlist_t *vlistptr;
-      streamptr = stream_new_entry();
       streamID = streamptr->self;
 
       streamptr->record   = record;
@@ -26956,53 +27267,12 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
       vlistptr->ntsteps = cdiInqTimeSize(streamID);
     }
 
-  switch (filetype)
-    {
-#if  defined  (HAVE_LIBGRIB)
-    case FILETYPE_GRB:
-    case FILETYPE_GRB2:
-      {
-	gribClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBSERVICE)
-    case FILETYPE_SRV:
-      {
-	fileClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBEXTRA)
-    case FILETYPE_EXT:
-      {
-	fileClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBIEG)
-    case FILETYPE_IEG:
-      {
-	fileClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBNETCDF)
-    case FILETYPE_NC:
-    case FILETYPE_NC2:
-    case FILETYPE_NC4:
-    case FILETYPE_NC4C:
-      {
-	cdfClose(fileID);
-	break;
-      }
-#endif
-    default:
-      {
-	if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
-	return (CDI_ELIBNAVAIL);
-      }
-    }
+  {
+    void (*streamCloseDelegate)(stream_t *streamptr, int recordBufIsToBeDeleted)
+      = (void (*)(stream_t *, int))
+      namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func;
+    streamCloseDelegate(streamptr, 0);
+  }
 
   switch (filetype)
     {
@@ -27225,6 +27495,72 @@ int streamOpenWrite(const char *filename, int filetype)
   return (streamOpen(filename, "w", filetype));
 }
 
+void
+cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted)
+{
+  int fileID   = streamptr->fileID;
+  int filetype = streamptr->filetype;
+  if ( fileID == CDI_UNDEFID )
+    Warning("File %s not open!", streamptr->filename);
+  else
+    switch (filetype)
+      {
+#if  defined  (HAVE_LIBGRIB)
+      case FILETYPE_GRB:
+      case FILETYPE_GRB2:
+        {
+          gribClose(fileID);
+          if (recordBufIsToBeDeleted)
+            gribContainersDelete(streamptr);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBSERVICE)
+      case FILETYPE_SRV:
+        {
+          fileClose(fileID);
+          if (recordBufIsToBeDeleted)
+            srvDelete(streamptr->record->srvp);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBEXTRA)
+      case FILETYPE_EXT:
+        {
+          fileClose(fileID);
+          if (recordBufIsToBeDeleted)
+            extDelete(streamptr->record->extp);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBIEG)
+      case FILETYPE_IEG:
+        {
+          fileClose(fileID);
+          if (recordBufIsToBeDeleted)
+            iegDelete(streamptr->record->iegp);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBNETCDF)
+      case FILETYPE_NC:
+      case FILETYPE_NC2:
+      case FILETYPE_NC4:
+      case FILETYPE_NC4C:
+        {
+          cdfClose(fileID);
+          break;
+        }
+#endif
+      default:
+        {
+          Error("%s support not compiled in!", strfiletype(filetype));
+          break;
+        }
+      }
+}
+
+
 /*
 @Function  streamClose
 @Title     Close an open dataset
@@ -27240,8 +27576,6 @@ The function @func{streamClose} closes an open dataset.
 */
 void streamClose(int streamID)
 {
-  int filetype;
-  int fileID;
   int index;
   int vlistID;
   stream_t *streamptr;
@@ -27251,87 +27585,15 @@ void streamClose(int streamID)
   stream_check_ptr(__func__, streamptr);
 
   if ( CDI_Debug )
-    Message("fileID = %d filename = %s", streamID, streamptr->filename);
+    Message("streamID = %d filename = %s", streamID, streamptr->filename);
 
-  fileID   = streamptr->fileID;
-  filetype = streamptr->filetype;
   vlistID  = streamptr->vlistID;
 
-  if ( namespaceHasLocalFile ( namespaceGetActive ()))
-    {
-      if ( fileID == CDI_UNDEFID )
-        Warning("File %s not open!", streamptr->filename);
-      else
-	switch (filetype)
-	  {
-#if  defined  (HAVE_LIBGRIB)
-	  case FILETYPE_GRB:
-	  case FILETYPE_GRB2:
-	    {
-	      gribClose(fileID);
-	      gribContainersDelete(streamptr);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBSERVICE)
-	  case FILETYPE_SRV:
-	    {
-	      fileClose(fileID);
-	      srvDelete(streamptr->record->srvp);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBEXTRA)
-	  case FILETYPE_EXT:
-	    {
-	      fileClose(fileID);
-	      extDelete(streamptr->record->extp);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBIEG)
-	  case FILETYPE_IEG:
-	    {
-	      fileClose(fileID);
-	      iegDelete(streamptr->record->iegp);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBNETCDF)
-	  case FILETYPE_NC:
-	  case FILETYPE_NC2:
-	  case FILETYPE_NC4:
-	  case FILETYPE_NC4C:
-	    {
-	      cdfClose(fileID);
-	      break;
-	    }
-#endif
-	  default:
-	    {
-	      Error("%s support not compiled in!", strfiletype(filetype));
-	      break;
-	    }
-	  }
-    }
-#ifdef USE_MPI
-  else
-    {
-      statusCode nspStatus = namespaceInqResStatus ();
-      switch ( nspStatus )
-        {
-        case STAGE_DEFINITION:
-          break;
-        case STAGE_TIMELOOP:
-          pioBufferFuncCall(STREAMCLOSE, 1, streamID);
-          break;
-        case STAGE_CLEANUP:
-        break;
-        default:
-          xabort ( "INTERNAL ERROR" );
-        }
-    }
-#endif
+  void (*streamCloseDelegate)(stream_t *streamptr, int recordBufIsToBeDeleted)
+    = (void (*)(stream_t *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func;
+
+  streamCloseDelegate(streamptr, 1);
 
   if ( streamptr->record )
       {
@@ -27385,37 +27647,12 @@ void streamClose(int streamID)
   stream_delete_entry(streamptr);
 }
 
-/*
- at Function  streamSync
- at Title     Synchronize an Open Dataset to Disk
-
- at Prototype  void streamSync(int streamID)
- at Parameter
-    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
-
- at Description
-The function @func{streamSync} offers a way to synchronize the disk copy of a dataset with in-memory buffers.
-
- at EndFunction
-*/
-void streamSync(int streamID)
+void cdiStreamSync_(stream_t *streamptr)
 {
-  int filetype;
-  int fileID;
-  int vlistID;
-  int nvars;
-  stream_t *streamptr;
-
-  if ( !namespaceHasLocalFile ( namespaceGetActive ())) return;
-
-  streamptr = stream_to_pointer(streamID);
-
-  stream_check_ptr(__func__, streamptr);
-
-  fileID   = streamptr->fileID;
-  filetype = streamptr->filetype;
-  vlistID  = streamptr->vlistID;
-  nvars    = vlistNvars(vlistID);
+  int fileID   = streamptr->fileID;
+  int filetype = streamptr->filetype;
+  int vlistID  = streamptr->vlistID;
+  int nvars    = vlistNvars(vlistID);
 
   if ( fileID == CDI_UNDEFID )
     Warning("File %s not open!", streamptr->filename);
@@ -27451,36 +27688,43 @@ void streamSync(int streamID)
 }
 
 /*
- at Function  streamDefTimestep
- at Title     Define time step
+ at Function  streamSync
+ at Title     Synchronize an Open Dataset to Disk
 
- at Prototype int streamDefTimestep(int streamID, int tsID)
+ at Prototype  void streamSync(int streamID)
 @Parameter
     @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
-    @Item  tsID      Timestep identifier.
 
 @Description
-The function @func{streamDefTimestep} defines the time step of a stream.
-
- at Result
- at func{streamDefTimestep} returns the number of records of the time step.
+The function @func{streamSync} offers a way to synchronize the disk copy of a dataset with in-memory buffers.
 
 @EndFunction
 */
-int streamDefTimestep(int streamID, int tsID)
+void streamSync(int streamID)
+{
+  stream_t *streamptr;
+
+  streamptr = stream_to_pointer(streamID);
+
+  stream_check_ptr(__func__, streamptr);
+
+  void (*myStreamSync_)(stream_t *streamptr)
+    = (void (*)(stream_t *))namespaceSwitchGet(NSSWITCH_STREAM_SYNC).func;
+  myStreamSync_(streamptr);
+}
+
+
+int cdiStreamDefTimestep_(stream_t *streamptr, int tsID)
 {
   int newtsID;
   int taxisID;
   int vlistID;
   int time_is_varying;
-  stream_t *streamptr;
   taxis_t *taxisptr1;
   taxis_t *taxisptr2;
 
-  streamptr = stream_to_pointer(streamID);
-
   if ( CDI_Debug )
-    Message("streamID = %d  tsID = %d", streamID, tsID);
+    Message("streamID = %d  tsID = %d", streamptr->self, tsID);
 
   stream_check_ptr(__func__, streamptr);
 
@@ -27493,7 +27737,7 @@ int streamDefTimestep(int streamID, int tsID)
       taxisID = vlistInqTaxis(vlistID);
       if ( taxisID == CDI_UNDEFID )
         {
-          Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamID);
+          Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamptr->self);
           taxisID = taxisCreate(TAXIS_ABSOLUTE);
           vlistDefTaxis(vlistID, taxisID);
         }
@@ -27520,13 +27764,19 @@ int streamDefTimestep(int streamID, int tsID)
 
   streamptr->ntsteps = tsID + 1;
 
-  if ( namespaceHasLocalFile(namespaceGetActive())
-       && (streamptr->filetype == FILETYPE_NC  ||
-           streamptr->filetype == FILETYPE_NC2 ||
-           streamptr->filetype == FILETYPE_NC4 ||
-           streamptr->filetype == FILETYPE_NC4C)
-       && time_is_varying )
-    cdfDefTimestep(streamptr, tsID);
+#ifdef HAVE_LIBNETCDF
+  if ((streamptr->filetype == FILETYPE_NC  ||
+       streamptr->filetype == FILETYPE_NC2 ||
+       streamptr->filetype == FILETYPE_NC4 ||
+       streamptr->filetype == FILETYPE_NC4C)
+      && vlistHasTime(vlistID))
+    {
+      void (*myCdfDefTimestep)(stream_t *streamptr, int tsID)
+        = (void (*)(stream_t *, int))
+        namespaceSwitchGet(NSSWITCH_CDF_DEF_TIMESTEP).func;
+      myCdfDefTimestep(streamptr, tsID);
+    }
+#endif
 
   cdi_create_records(streamptr, tsID);
 
@@ -27534,6 +27784,32 @@ int streamDefTimestep(int streamID, int tsID)
 }
 
 /*
+ at Function  streamDefTimestep
+ at Title     Define time step
+
+ at Prototype int streamDefTimestep(int streamID, int tsID)
+ at Parameter
+    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
+    @Item  tsID      Timestep identifier.
+
+ at Description
+The function @func{streamDefTimestep} defines the time step of a stream.
+
+ at Result
+ at func{streamDefTimestep} returns the number of records of the time step.
+
+ at EndFunction
+*/
+int streamDefTimestep(int streamID, int tsID)
+{
+  stream_t *streamptr = stream_to_pointer(streamID);
+  int (*myStreamDefTimestep_)(stream_t *streamptr, int tsID)
+    = (int (*)(stream_t *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_DEF_TIMESTEP_).func;
+  return myStreamDefTimestep_(streamptr, tsID);
+}
+
+/*
 @Function  streamInqTimestep
 @Title     Get time step
 
@@ -27728,8 +28004,36 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
     }
 }
 
-static
-void stream_write_var(int streamID, int varID, int memtype, const void *data, int nmiss)
+
+/*
+ at Function  streamWriteVar
+ at Title     Write a variable
+
+ at Prototype void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
+ at Parameter
+    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
+    @Item  varID     Variable identifier.
+    @Item  data      Pointer to a block of double precision floating point data values to be written.
+    @Item  nmiss     Number of missing values.
+
+ at Description
+The function streamWriteVar writes the values of one time step of a variable to an open dataset.
+The values are converted to the external data type of the variable, if necessary.
+ at EndFunction
+*/
+void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
+{
+  void (*myCdiStreamWriteVar_)(int streamID, int varID, int memtype,
+                               const void *data, int nmiss)
+    = (void (*)(int, int, int, const void *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_).func;
+  myCdiStreamWriteVar_(streamID, varID, MEMTYPE_DOUBLE, data, nmiss);
+}
+
+/* the single image implementation */
+void
+cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
+                   int nmiss)
 {
   int filetype;
   stream_t *streamptr;
@@ -27738,29 +28042,6 @@ void stream_write_var(int streamID, int varID, int memtype, const void *data, in
 
   check_parg(data);
 
-  /* begin deike */
-#ifdef USE_MPI
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    {
-      statusCode nspStatus = namespaceInqResStatus ();
-      switch ( nspStatus )
-        {
-        case STAGE_DEFINITION:
-          xabort ( "DEFINITION STAGE: PARALLEL WRITING NOT POSSIBLE." );
-          break;
-        case STAGE_TIMELOOP:
-          pioBufferData ( streamID, varID, data, nmiss );
-          return;
-        case STAGE_CLEANUP:
-          xabort ( "CLEANUP STAGE: PARALLEL WRITING NOT POSSIBLE." );
-          break;
-        default:
-          xabort ( "INTERNAL ERROR" );
-        }
-    }
-#endif
-  /* end deike */
-
   streamptr = stream_to_pointer(streamID);
 
   stream_check_ptr(__func__, streamptr);
@@ -27823,27 +28104,6 @@ void stream_write_var(int streamID, int varID, int memtype, const void *data, in
 }
 
 /*
- at Function  streamWriteVar
- at Title     Write a variable
-
- at Prototype void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
- at Parameter
-    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
-    @Item  varID     Variable identifier.
-    @Item  data      Pointer to a block of double precision floating point data values to be written.
-    @Item  nmiss     Number of missing values.
-
- at Description
-The function streamWriteVar writes the values of one time step of a variable to an open dataset.
-The values are converted to the external data type of the variable, if necessary.
- at EndFunction
-*/
-void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
-{
-  stream_write_var(streamID, varID, MEMTYPE_DOUBLE, data, nmiss);
-}
-
-/*
 @Function  streamWriteVarF
 @Title     Write a variable
 
@@ -27862,7 +28122,11 @@ Only support for netCDF was implemented in this function.
 */
 void streamWriteVarF(int streamID, int varID, const float *data, int nmiss)
 {
-  stream_write_var(streamID, varID, MEMTYPE_FLOAT, data, nmiss);
+  void (*myCdiStreamWriteVar_)(int streamID, int varID, int memtype,
+                               const void *data, int nmiss)
+    = (void (*)(int, int, int, const void *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_).func;
+  myCdiStreamWriteVar_(streamID, varID, MEMTYPE_FLOAT, data, nmiss);
 }
 
 /*
@@ -28067,6 +28331,72 @@ void streamWriteVarSliceF(int streamID, int varID, int levelID, const float *dat
 }
 
 
+void
+streamWriteVarChunk(int streamID, int varID,
+                    const int rect[][2], const double *data, int nmiss)
+{
+  void (*myCdiStreamWriteVarChunk_)(int streamID, int varID, int memtype,
+                                    const int rect[][2], const void *data,
+                                    int nmiss)
+    = (void (*)(int, int, int, const int [][2], const void *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_).func;
+  myCdiStreamWriteVarChunk_(streamID, varID, MEMTYPE_DOUBLE, rect, data, nmiss);
+}
+
+/* single image implementation */
+void
+cdiStreamwriteVarChunk_(int streamID, int varID, int memtype,
+                        const int rect[][2], const void *data, int nmiss)
+{
+  int filetype;
+  stream_t *streamptr;
+
+  if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
+
+  streamptr = stream_to_pointer(streamID);
+
+  stream_check_ptr(__func__, streamptr);
+
+  // streamDefineTaxis(streamID);
+
+  filetype = streamptr->filetype;
+
+  switch (filetype)
+    {
+#if defined (HAVE_LIBGRIB)
+    case FILETYPE_GRB:
+    case FILETYPE_GRB2:
+#endif
+#if defined (HAVE_LIBSERVICE)
+    case FILETYPE_SRV:
+#endif
+#if defined (HAVE_LIBEXTRA)
+    case FILETYPE_EXT:
+#endif
+#if defined (HAVE_LIBIEG)
+    case FILETYPE_IEG:
+#endif
+#if  defined (HAVE_LIBGRIB) || defined (HAVE_LIBSERVICE)      \
+  || defined (HAVE_LIBEXTRA) || defined (HAVE_LIBIEG)
+      xabort("streamWriteVarChunk not implemented for filetype %s!",
+             strfiletype(filetype));
+      break;
+#endif
+#if  defined  (HAVE_LIBNETCDF)
+    case FILETYPE_NC:
+    case FILETYPE_NC2:
+    case FILETYPE_NC4:
+    case FILETYPE_NC4C:
+      if ( streamptr->accessmode == 0 ) cdfEndDef(streamptr);
+      cdf_write_var_chunk(streamptr, varID, memtype, rect, data, nmiss);
+      break;
+#endif
+    default:
+      Error("%s support not compiled in!", strfiletype(filetype));
+      break;
+    }
+}
+
 void streamWriteContents(int streamID, char *cname)
 {
   FILE *cnp;
@@ -28259,69 +28589,23 @@ The function @func{streamDefVlist} defines the variable list of a stream.
 */
 void streamDefVlist(int streamID, int vlistID)
 {
-  int nvars, varID;
-  int gridID, zaxisID;
-  stream_t *streamptr;
+  void (*myStreamDefVlist)(int streamID, int vlistID)
+    = (void (*)(int, int))namespaceSwitchGet(NSSWITCH_STREAM_DEF_VLIST_).func;
+  myStreamDefVlist(streamID, vlistID);
+}
 
-  streamptr = stream_to_pointer(streamID);
+/* the single image implementation of streamDefVlist */
+void
+cdiStreamDefVlist_(int streamID, int vlistID)
+{
+  stream_t *streamptr = stream_to_pointer(streamID);
 
   stream_check_ptr(__func__, streamptr);
-#ifdef USE_MPI
-  if (!namespaceHasLocalFile(namespaceGetActive()))
-  {
-    statusCode nspStatus = namespaceInqResStatus ();
-    switch ( nspStatus )
-      {
-      case STAGE_DEFINITION:
-        break;
-      case STAGE_TIMELOOP:
-        pioBufferFuncCall(STREAMDEFVLIST, 2, streamID, vlistID);
-        break;
-      case STAGE_CLEANUP:
-        xabort ( "TRANSITION TO IO PROCESSES ALREADY FINISHED." );
-        break;
-      default:
-        xabort ( "INTERNAL ERROR" );
-      }
-  }
-
-#endif
 
   if ( streamptr->vlistID == CDI_UNDEFID )
-    {
-      streamptr->vlistID = vlistDuplicate(vlistID);
-      streamptr->vlistIDorig = vlistID ;
-
-      nvars = vlistNvars(vlistID);
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID  = vlistInqVarGrid(vlistID, varID);
-	  zaxisID = vlistInqVarZaxis(vlistID, varID);
-	  stream_new_var(streamptr, gridID, zaxisID);
-	  if ( streamptr->have_missval )
-	    vlistDefVarMissval(streamptr->vlistID, varID, vlistInqVarMissval(vlistID, varID));
-	}
-
-      if ( namespaceHasLocalFile(namespaceGetActive()) && streamptr->filemode == 'w' )
-	{
-	  if ( streamptr->filetype == FILETYPE_NC  ||
-	       streamptr->filetype == FILETYPE_NC2 ||
-	       streamptr->filetype == FILETYPE_NC4 ||
-	       streamptr->filetype == FILETYPE_NC4C )
-	    {
-	      cdfDefVars(streamptr);
-	    }
-	  else if ( streamptr->filetype == FILETYPE_GRB  ||
-		    streamptr->filetype == FILETYPE_GRB2 )
-	    {
-	      gribContainersNew(streamptr);
-	    }
-	}
-    }
+    cdiStreamSetupVlist(streamptr, vlistDuplicate(vlistID), vlistID);
   else
-    {
-      Warning("vlist already defined for %s!", streamptr->filename);
-    }
+    Warning("vlist already defined for %s!", streamptr->filename);
 }
 
 /*
@@ -28670,8 +28954,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
     case GRID_GAUSSIAN:
       {
 	if ( ISEC4_NumValues != ISEC2_NumLon*ISEC2_NumLat )
-	  Error("numberOfPoints (%d) and gridSize (%d) differ!",
-		ISEC4_NumValues, ISEC2_NumLon*ISEC2_NumLat);
+	  Error("numberOfPoints (%d) and gridSize (%d) differ!", ISEC4_NumValues, ISEC2_NumLon*ISEC2_NumLat);
 	grid->size  = ISEC4_NumValues;
 	grid->xsize = ISEC2_NumLon;
 	grid->ysize = ISEC2_NumLat;
@@ -30415,14 +30698,14 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
       }
     case ZAXIS_CLOUD_BASE:
       {
-	ISEC1_LevelType = GRIB1_LTYPE_CLOUDBASE;
+	ISEC1_LevelType = GRIB1_LTYPE_CLOUD_BASE;
 	ISEC1_Level1    = 0;
 	ISEC1_Level2    = 0;
 	break;
       }
     case ZAXIS_CLOUD_TOP:
       {
-	ISEC1_LevelType = GRIB1_LTYPE_CLOUDTOP;
+	ISEC1_LevelType = GRIB1_LTYPE_CLOUD_TOP;
 	ISEC1_Level1    = 0;
 	ISEC1_Level2    = 0;
 	break;
@@ -30815,21 +31098,21 @@ int gribapiGetGridType(grib_handle *gh)
 
       switch (gribgridtype)
 	{
-	case  GRIB2_GTYPE_LATLON:     { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
-	                                if ( lpar == (long) GRIB_MISSING_LONG ) break;
-                                      }
-	case  GRIB2_GTYPE_LATLON_ROT: { gridtype = GRID_LONLAT;    break; }
-	case  GRIB2_GTYPE_LCC:        { gridtype = GRID_LCC;       break; }
-	case  GRIB2_GTYPE_GAUSSIAN:   { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
-	                                if ( lpar == (long) GRIB_MISSING_LONG )
-					  gridtype = GRID_GAUSSIAN_REDUCED;
-					else
-					  gridtype = GRID_GAUSSIAN;
-					break;
-                                      }
-	case  GRIB2_GTYPE_SPECTRAL:   { gridtype = GRID_SPECTRAL;  break; }
-	case  GRIB2_GTYPE_GME:        { gridtype = GRID_GME;       break; }
-	case  GRIB2_GTYPE_NUMBER:     { gridtype = GRID_REFERENCE; break; }
+	case  GRIB2_GTYPE_LATLON:        { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
+	                                   if ( lpar == (long) GRIB_MISSING_LONG ) break;
+                                         }
+	case  GRIB2_GTYPE_LATLON_ROT:    { gridtype = GRID_LONLAT;    break; }
+	case  GRIB2_GTYPE_LCC:           { gridtype = GRID_LCC;       break; }
+	case  GRIB2_GTYPE_GAUSSIAN:      { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
+	                                   if ( lpar == (long) GRIB_MISSING_LONG )
+					     gridtype = GRID_GAUSSIAN_REDUCED;
+					   else
+					     gridtype = GRID_GAUSSIAN;
+				  	   break;
+                                         }
+	case  GRIB2_GTYPE_SPECTRAL:      { gridtype = GRID_SPECTRAL;  break; }
+	case  GRIB2_GTYPE_GME:           { gridtype = GRID_GME;       break; }
+	case  GRIB2_GTYPE_UNSTRUCTURED:  { gridtype = GRID_UNSTRUCTURED; break; }
 	}
     }
 
@@ -31066,6 +31349,10 @@ int gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
     {
       GRIB_CHECK(grib_get_long(gh, "significanceOfReferenceTime", &sigofrtime), 0);
     }
+  else
+    {
+      GRIB_CHECK(grib_get_long(gh, "timeRangeIndicator", &sigofrtime), 0);
+    }
 
   if ( sigofrtime == 3 )
     {
@@ -31350,7 +31637,7 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
 
 	break;
       }
-    case GRID_REFERENCE:
+    case GRID_UNSTRUCTURED:
       {
         char uuid[17];
     	char reference_link[8192];
@@ -31362,11 +31649,13 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
           {
             grid->number   = lpar;
             if ( grib_get_long(gh, "numberOfGridInReference", &lpar) == 0 ) grid->position = lpar;
+            /*
             if ( grib_get_string(gh, "gridDescriptionFile", reference_link, &len) == 0 )
               {
                 if ( strncmp(reference_link, "file://", 7) == 0 )
                   grid->reference = strdupx(reference_link);
               }
+            */
             len = (size_t) 16;
             if ( grib_get_bytes(gh, "uuidOfHGrid", (unsigned char *) uuid, &len) == 0)
               {
@@ -31507,6 +31796,7 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
       if ( status == 0 ) leveltype2 = lpar;
 
       if ( *leveltype != 255 && leveltype2 != 255 && leveltype2 > 0 ) *lbounds = 1;
+      if ( *leveltype == GRIB2_LTYPE_REFERENCE && leveltype2 == 1 ) *lbounds = 0;
 
       if ( *leveltype == GRIB2_LTYPE_LANDDEPTH )
         {
@@ -31521,8 +31811,13 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
 
       GRIB_CHECK(grib_get_long(gh, "scaleFactorOfFirstFixedSurface", &factor), 0);
       GRIB_CHECK(grib_get_long(gh, "scaledValueOfFirstFixedSurface", &llevel), 0);
-      if ( llevel != GRIB_MISSING_LONG && factor != GRIB_MISSING_LONG )
-        dlevel1 = llevel*grib2ScaleFactor(factor);
+      if ( llevel != GRIB_MISSING_LONG )
+        {
+          if ( factor != GRIB_MISSING_LONG )
+            dlevel1 = llevel*grib2ScaleFactor(factor);
+          else
+            dlevel1 = llevel;
+        }
 
       if ( *level_sf != 0 ) dlevel1 *= (*level_sf);
 
@@ -31530,8 +31825,13 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
 	{
           GRIB_CHECK(grib_get_long(gh, "scaleFactorOfSecondFixedSurface", &factor), 0);
           GRIB_CHECK(grib_get_long(gh, "scaledValueOfSecondFixedSurface", &llevel), 0);
-          if ( llevel != GRIB_MISSING_LONG && factor != GRIB_MISSING_LONG )
-            dlevel2 = llevel*grib2ScaleFactor(factor);
+          if ( llevel != GRIB_MISSING_LONG )
+            {
+              if ( factor != GRIB_MISSING_LONG )
+                dlevel2 = llevel*grib2ScaleFactor(factor);
+              else
+                dlevel2 = llevel;
+            }
 
           if ( *level_sf != 0 ) dlevel2 *= (*level_sf);
         }
@@ -31625,22 +31925,22 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
       {
         size_t len;
         char uuid[17];
-        double dtmp;
-        long nlev, nvgrid;
+        long ltmp;
+        long nhlev, nvgrid;
 
         GRIB_CHECK(grib_get_long(gh, "NV", &lpar), 0);
         if ( lpar != 6 )
           {
             fprintf(stderr, "Warning ...\n");
           }
-        GRIB_CHECK(grib_get_double(gh, "nlev", &dtmp), 0);
-        nlev = (int) NINT(dtmp);
-        GRIB_CHECK(grib_get_double(gh, "numberOfVGridUsed", &dtmp), 0);
-        nvgrid = NINT(dtmp);
+        GRIB_CHECK(grib_get_long(gh, "nlev", &ltmp), 0);
+        nhlev = ltmp;
+        GRIB_CHECK(grib_get_long(gh, "numberOfVGridUsed", &ltmp), 0);
+        nvgrid = ltmp;
         len = (size_t) 16;
         uuid[16] = 0;
         GRIB_CHECK(grib_get_bytes(gh, "uuidOfVGrid", (unsigned char *) uuid, &len), 0);
-        varDefZAxisReference((int) nlev, (int) nvgrid, uuid);
+        varDefZAxisReference((int) nhlev, (int) nvgrid, uuid);
         break;
       }
     }
@@ -31673,18 +31973,21 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
     Get the ensemble Info from the grib-2 Tables and update the intermediate datastructure.
     Further update to the "vlist" is handled in the same way as for GRIB-1 by "cdi_generate_vars"
   */
-  {
-    int status;
-    status = grib_get_long(gh, "typeOfEnsembleForecast", &ens_forecast_type );
-    if ( status == 0 )
-      {
-        GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", &ens_count ), 0);
-        GRIB_CHECK(grib_get_long(gh, "perturbationNumber", &ens_index ), 0);
-      }
-  }
+  status = grib_get_long(gh, "typeOfEnsembleForecast", &ens_forecast_type );
+  if ( status == 0 )
+    {
+      GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", &ens_count ), 0);
+      GRIB_CHECK(grib_get_long(gh, "perturbationNumber", &ens_index ), 0);
+    }
+
   if ( ens_index > 0 )
     varDefEnsembleInfo(varID, (int)ens_index, (int)ens_count, (int)ens_forecast_type);
 
+  long typeOfGeneratingProcess = 0;
+  status = grib_get_long(gh, "typeOfGeneratingProcess", &typeOfGeneratingProcess);
+  if ( status == 0 )
+    varDefTypeOfGeneratingProcess(varID, (int) typeOfGeneratingProcess);
+
   int    i;
   long   lval;
   double dval;
@@ -31957,7 +32260,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
 
       gribapiGetValidityDateTime(gh, &vdate, &vtime);
       /*
-      printf("%d %d %d.%d.%d %d\n", vdate, vtime, pnum, pcat, pdis, leveltype);
+      printf("%d %d %d\n", vdate, vtime, leveltype);
       */
       if ( lieee )
         {
@@ -32003,9 +32306,22 @@ int gribapiScanTimestep1(stream_t * streamptr)
 	      if ( warn_time )
 		if ( memcmp(&datetime, &datetime0, sizeof(DateTime)) != 0 )
 		  {
-		    Warning("Inconsistent verification time (param=%s level=%d)", paramstr, level1);
-		    warn_time = FALSE;
-		  }
+                    if ( datetime0.date == 10101 && datetime0.time == 0 )
+                      {
+                        datetime0.date = datetime.date;
+                        datetime0.time = datetime.time;
+
+                        gribapiGetDataDateTime(gh, &rdate, &rtime);
+
+                        fcast = gribapiTimeIsFC(gh);
+                        if ( fcast ) tunit = gribapiGetTimeUnits(gh);
+                      }
+                    else
+                      {
+                        Warning("Inconsistent verification time (param=%s level=%d)", paramstr, level1);
+                        warn_time = FALSE;
+                      }
+                  }
 	    }
 	  else
 	    {
@@ -32932,17 +33248,23 @@ int gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, int rdate, int rti
 }
 
 static
-void gribapiDefTime(int editionNumber, grib_handle *gh , int vdate, int vtime, int tsteptype, int numavg, int taxisID, int gcinit)
+void gribapiDefTime(int editionNumber, int typeOfGeneratingProcess, grib_handle *gh , int vdate, int vtime, int tsteptype, int numavg, int taxisID, int gcinit)
 {
   int taxistype = -1;
-  int timeunit;
-  int factor;
 
   if ( taxisID != -1 ) taxistype = taxisInqType(taxisID);
 
-  timeunit = taxisInqTunit(taxisID);
-
-  factor = gribapiDefStepUnits(gh, timeunit, gcinit);
+  if ( typeOfGeneratingProcess == 196 )
+    {
+      vdate = 10101;
+      vtime = 0;
+      taxistype = TAXIS_ABSOLUTE;
+    }
+  /*
+  else if ( typeOfGeneratingProcess == 9 )
+    {
+    }
+  */
 
   if ( taxistype == TAXIS_RELATIVE )
     {
@@ -32950,6 +33272,8 @@ void gribapiDefTime(int editionNumber, grib_handle *gh , int vdate, int vtime, i
       int calendar = taxisInqCalendar(taxisID);
       int rdate    = taxisInqRdate(taxisID);
       int rtime    = taxisInqRtime(taxisID);
+      int timeunit = taxisInqTunit(taxisID);
+      int factor   = gribapiDefStepUnits(gh, timeunit, gcinit);
 
       status = gribapiDefDateTimeRel(editionNumber, gh, rdate, rtime, vdate, vtime,
                                      tsteptype, factor, calendar, gcinit);
@@ -32968,7 +33292,6 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
 {
   int gridtype;
   int status;
-  char uuid[17];
   static short lwarn = TRUE;
   size_t len;
   char *mesg;
@@ -32976,7 +33299,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
   gridtype = gridInqType(gridID);
 
   if ( editionNumber <= 1 )
-    if ( gridtype == GRID_GME || gridtype == GRID_REFERENCE )
+    if ( gridtype == GRID_GME || gridtype == GRID_UNSTRUCTURED )
       gridtype = -1;
 
   if ( gridtype == GRID_GENERIC )
@@ -33297,7 +33620,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
 	GRIB_CHECK(grib_set_long(gh, "Ni", gridInqGMEni(gridID)), 0);
 	GRIB_CHECK(grib_set_long(gh, "n2", gridInqGMEni2(gridID)), 0);
 	GRIB_CHECK(grib_set_long(gh, "n3", gridInqGMEni3(gridID)), 0);
-	GRIB_CHECK(grib_set_long(gh, "latitudeOfThePolePoint", 90000), 0);
+	GRIB_CHECK(grib_set_long(gh, "latitudeOfThePolePoint", 90000000), 0);
 	GRIB_CHECK(grib_set_long(gh, "longitudeOfThePolePoint", 0), 0);
 
 	GRIB_CHECK(grib_set_long(gh, "numberOfDataPoints", gridInqSize(gridID)), 0);
@@ -33305,21 +33628,26 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
 
 	break;
       }
-    case GRID_REFERENCE:
+    case GRID_UNSTRUCTURED:
       {
 	static int warning = 1;
-	status = grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_NUMBER);
+	status = grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_UNSTRUCTURED);
 	if ( status != 0 && warning )
 	  {
 	    warning = 0;
 	    Warning("Can't write reference grid!");
 	    Warning("gridDefinitionTemplateNumber %d not found (grib2/template.3.%d.def)!",
-		    GRIB2_GTYPE_NUMBER, GRIB2_GTYPE_NUMBER);
+		    GRIB2_GTYPE_UNSTRUCTURED, GRIB2_GTYPE_UNSTRUCTURED);
 	  }
 	else
 	  {
-	    GRIB_CHECK(grib_set_long(gh, "numberOfGridUsed", gridInqNumber(gridID)), 0);
-	    GRIB_CHECK(grib_set_long(gh, "numberOfGridInReference", gridInqPosition(gridID)), 0);
+            char uuid[17];
+            int position = gridInqPosition(gridID);
+            int number = gridInqNumber(gridID);
+            if ( position < 0 ) position = 0;
+            if ( number < 0 ) number = 0;
+	    GRIB_CHECK(grib_set_long(gh, "numberOfGridUsed", number), 0);
+	    GRIB_CHECK(grib_set_long(gh, "numberOfGridInReference", position), 0);
             len = 16;
 	    if (grib_set_bytes(gh, "uuidOfHGrid", (unsigned char *) gridInqUUID(gridID, uuid), &len) != 0)
 	      Warning("Can't write UUID!");
@@ -33389,7 +33717,6 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
   int lbounds = 0;
   int zaxistype, ltype;
   static int warning = 1;
-  int reference;
   char uuid[17];
   size_t len;
   double scalefactor;
@@ -33423,80 +33750,58 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
   switch (zaxistype)
     {
     case ZAXIS_SURFACE:
+    case ZAXIS_MEANSEA:
+    case ZAXIS_HEIGHT:
+    case ZAXIS_ALTITUDE:
+    case ZAXIS_SIGMA:
+    case ZAXIS_DEPTH_BELOW_SEA:
+    case ZAXIS_ISENTROPIC:
       {
 	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SURFACE);
+          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", zaxisTypeToGrib1ltype(zaxistype));
         else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SURFACE);
+          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
 
         GRIB_CHECK(grib_set_long(gh, "level", level), 0);
 
 	break;
       }
     case ZAXIS_CLOUD_BASE:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_CLOUDBASE);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_CLOUDBASE);
-
-        break;
-      }
     case ZAXIS_CLOUD_TOP:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_CLOUDTOP);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_CLOUDTOP);
-
-        break;
-      }
     case ZAXIS_ISOTHERM_ZERO:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ISOTHERM0);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ISOTHERM0);
-
-        break;
-      }
     case ZAXIS_TOA:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_TOA);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_TOA);
-
-        break;
-      }
     case ZAXIS_SEA_BOTTOM:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SEA_BOTTOM);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SEA_BOTTOM);
-
-        break;
-      }
+    case ZAXIS_LAKE_BOTTOM:
+    case ZAXIS_SEDIMENT_BOTTOM:
+    case ZAXIS_SEDIMENT_BOTTOM_TA:
+    case ZAXIS_SEDIMENT_BOTTOM_TW:
+    case ZAXIS_MIX_LAYER:
     case ZAXIS_ATMOSPHERE:
       {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ATMOSPHERE);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ATMOSPHERE);
+        if ( lbounds )
+          {
+            if ( editionNumber <= 1 )
+              gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", zaxisTypeToGrib1ltype(zaxistype));
+            else
+              {
+                gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
+                gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
+              }
 
-        break;
-      }
-    case ZAXIS_MEANSEA:
-      {
-	if ( editionNumber <= 1 )
-	  gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_MEANSEA);
+            GRIB_CHECK(grib_set_long(gh, "topLevel", (long) dlevel1), 0);
+            GRIB_CHECK(grib_set_long(gh, "bottomLevel", (long) dlevel2), 0);
+          }
         else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_MEANSEA);
+          {
+            if ( editionNumber <= 1 )
+              gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", zaxisTypeToGrib1ltype(zaxistype));
+            else
+              gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
 
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+            GRIB_CHECK(grib_set_long(gh, "level", (long) level), 0);
+          }
 
-	break;
+        break;
       }
     case ZAXIS_HYBRID:
     case ZAXIS_HYBRID_HALF:
@@ -33585,39 +33890,6 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
 
 	break;
       }
-    case ZAXIS_HEIGHT:
-      {
-        if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_HEIGHT);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_HEIGHT);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
-    case ZAXIS_ALTITUDE:
-      {
-        if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ALTITUDE);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ALTITUDE);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
-    case ZAXIS_SIGMA:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SIGMA);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SIGMA);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
     case ZAXIS_DEPTH_BELOW_LAND:
       {
 	char units[128];
@@ -33643,50 +33915,57 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
 
             level   *= scalefactor;
             dlevel1 *= scalefactor;
-            dlevel1 *= scalefactor;
+            dlevel2 *= scalefactor;
 
             grib2DefLevel(gh, gcinit, GRIB2_LTYPE_LANDDEPTH, lbounds, level, dlevel1, dlevel2);
 	  }
 
 	break;
       }
-    case ZAXIS_DEPTH_BELOW_SEA:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SEADEPTH);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SEADEPTH);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
-    case ZAXIS_ISENTROPIC:
+    case ZAXIS_REFERENCE:
       {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ISENTROPIC);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ISENTROPIC);
+        int number;
 
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+        if ( !gcinit )
+          {
+            GRIB_CHECK(grib_set_long(gh, "genVertHeightCoords", 1), 0);
+          }
 
-	break;
-      }
-    case ZAXIS_REFERENCE:
-      {
-        if ( editionNumber <= 1 )
-          ; // not available
+        if ( lbounds )
+          {
+            if ( editionNumber <= 1 )
+              ; // not available
+            else
+              {
+                number = zaxisInqNumber(zaxisID);
+                gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
+                gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", GRIB2_LTYPE_REFERENCE);
+                GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
+                GRIB_CHECK(grib_set_long(gh, "nlev", zaxisInqNlevRef(zaxisID)), 0);
+                GRIB_CHECK(grib_set_long(gh, "numberOfVGridUsed", number), 0);
+                len = 16;
+                if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
+                  Warning("Can't write UUID!");
+                GRIB_CHECK(grib_set_long(gh, "topLevel", (long) dlevel1), 0);
+                GRIB_CHECK(grib_set_long(gh, "bottomLevel", (long) dlevel2), 0);
+              }
+          }
         else
           {
-            reference = zaxisInqReference(zaxisID);
-            gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
-            GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
-            GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)), 0);
-            GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
-            len = 16;
-	    if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
-	      Warning("Can't write UUID!");
-            GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+            if ( editionNumber <= 1 )
+              ; // not available
+            else
+              {
+                number = zaxisInqNumber(zaxisID);
+                gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
+                GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
+                GRIB_CHECK(grib_set_long(gh, "nlev", zaxisInqNlevRef(zaxisID)), 0);
+                GRIB_CHECK(grib_set_long(gh, "numberOfVGridUsed", number), 0);
+                len = 16;
+                if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
+                  Warning("Can't write UUID!");
+                GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+              }
           }
 
         break;
@@ -33750,6 +34029,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
   int param;
   int lieee = FALSE;
   int ensID, ensCount, forecast_type; /* Ensemble Data */
+  int typeOfGeneratingProcess;
   long bitsPerValue;
   long editionNumber = 2;
   char name[256];
@@ -33759,6 +34039,8 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
 
   param    = vlistInqVarParam(vlistID, varID);
   datatype = vlistInqVarDatatype(vlistID, varID);
+  typeOfGeneratingProcess = vlistInqVarTypeOfGeneratingProcess(vlistID, varID);
+
   vlistInqVarName(vlistID, varID, name);
 
 #if defined(GRIBAPIENCODETEST)
@@ -33769,6 +34051,9 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
 
   GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
 
+  if ( typeOfGeneratingProcess == -1 ) typeOfGeneratingProcess = 0;
+  if ( ! gc->init ) GRIB_CHECK(grib_set_long(gh, "typeOfGeneratingProcess", typeOfGeneratingProcess), 0);
+
   if ( ! gc->init ) gribapiDefInstitut(gh, vlistID, varID);
   if ( ! gc->init ) gribapiDefModel(gh, vlistID, varID);
 
@@ -33781,7 +34066,8 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
       GRIB_CHECK(grib_set_long(gh, "perturbationNumber", ensID ), 0);
     }
   */
-  gribapiDefTime(editionNumber, gh, vdate, vtime, tsteptype, numavg, vlistInqTaxis(vlistID), gc->init);
+
+  gribapiDefTime(editionNumber, typeOfGeneratingProcess, gh, vdate, vtime, tsteptype, numavg, vlistInqTaxis(vlistID), gc->init);
 
   if ( editionNumber == 2 && (datatype == DATATYPE_FLT32 || datatype == DATATYPE_FLT64) ) lieee = TRUE;
 
@@ -33864,9 +34150,6 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
 #include <string.h>
 
 
-#ifdef USE_MPI
-#endif
-
 
 int grib1ltypeToZaxisType(int grib_ltype)
 {
@@ -33874,26 +34157,31 @@ int grib1ltypeToZaxisType(int grib_ltype)
 
   switch ( grib_ltype )
     {
-    case GRIB1_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;           break; }
-    case GRIB1_LTYPE_CLOUDBASE:          { zaxistype = ZAXIS_CLOUD_BASE;        break; }
-    case GRIB1_LTYPE_CLOUDTOP:           { zaxistype = ZAXIS_CLOUD_TOP;         break; }
-    case GRIB1_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;     break; }
-    case GRIB1_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;               break; }
-    case GRIB1_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;        break; }
-    case GRIB1_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;        break; }
-    case GRIB1_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;           break; }
+    case GRIB1_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;                break; }
+    case GRIB1_LTYPE_CLOUD_BASE:         { zaxistype = ZAXIS_CLOUD_BASE;             break; }
+    case GRIB1_LTYPE_CLOUD_TOP:          { zaxistype = ZAXIS_CLOUD_TOP;              break; }
+    case GRIB1_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;          break; }
+    case GRIB1_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;                    break; }
+    case GRIB1_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;             break; }
+    case GRIB1_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;             break; }
+    case GRIB1_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;                break; }
     case GRIB1_LTYPE_99:
-    case GRIB1_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;          break; }
-    case GRIB1_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;            break; }
-    case GRIB1_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;	        break; }
+    case GRIB1_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;               break; }
+    case GRIB1_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;                 break; }
+    case GRIB1_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;	             break; }
     case GRIB1_LTYPE_SIGMA:
-    case GRIB1_LTYPE_SIGMA_LAYER:        { zaxistype = ZAXIS_SIGMA;	        break; }
+    case GRIB1_LTYPE_SIGMA_LAYER:        { zaxistype = ZAXIS_SIGMA;	             break; }
     case GRIB1_LTYPE_HYBRID:
-    case GRIB1_LTYPE_HYBRID_LAYER:       { zaxistype = ZAXIS_HYBRID;	        break; }
+    case GRIB1_LTYPE_HYBRID_LAYER:       { zaxistype = ZAXIS_HYBRID;	             break; }
     case GRIB1_LTYPE_LANDDEPTH:
-    case GRIB1_LTYPE_LANDDEPTH_LAYER:    { zaxistype = ZAXIS_DEPTH_BELOW_LAND;  break; }
-    case GRIB1_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;	break; }
-    case GRIB1_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;   break; }
+    case GRIB1_LTYPE_LANDDEPTH_LAYER:    { zaxistype = ZAXIS_DEPTH_BELOW_LAND;       break; }
+    case GRIB1_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;             break; }
+    case GRIB1_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;        break; }
+    case GRIB1_LTYPE_LAKE_BOTTOM:        { zaxistype = ZAXIS_LAKE_BOTTOM;            break; }
+    case GRIB1_LTYPE_SEDIMENT_BOTTOM:    { zaxistype = ZAXIS_SEDIMENT_BOTTOM;        break; }
+    case GRIB1_LTYPE_SEDIMENT_BOTTOM_TA: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;     break; }
+    case GRIB1_LTYPE_SEDIMENT_BOTTOM_TW: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;     break; }
+    case GRIB1_LTYPE_MIX_LAYER:          { zaxistype = ZAXIS_MIX_LAYER;              break; }
     }
 
   return (zaxistype);
@@ -33906,31 +34194,97 @@ int grib2ltypeToZaxisType(int grib_ltype)
 
   switch ( grib_ltype )
     {
-    case GRIB2_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;           break; }
-    case GRIB2_LTYPE_CLOUDBASE:          { zaxistype = ZAXIS_CLOUD_BASE;        break; }
-    case GRIB2_LTYPE_CLOUDTOP:           { zaxistype = ZAXIS_CLOUD_TOP;         break; }
-    case GRIB2_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;     break; }
-    case GRIB2_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;               break; }
-    case GRIB2_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;        break; }
-    case GRIB2_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;        break; }
-    case GRIB2_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;           break; }
-    case GRIB2_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;          break; }
-    case GRIB2_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;            break; }
-    case GRIB2_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;          break; }
-    case GRIB2_LTYPE_SIGMA:              { zaxistype = ZAXIS_SIGMA;             break; }
+    case GRIB2_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;                break; }
+    case GRIB2_LTYPE_CLOUD_BASE:         { zaxistype = ZAXIS_CLOUD_BASE;             break; }
+    case GRIB2_LTYPE_CLOUD_TOP:          { zaxistype = ZAXIS_CLOUD_TOP;              break; }
+    case GRIB2_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;          break; }
+    case GRIB2_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;                    break; }
+    case GRIB2_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;             break; }
+    case GRIB2_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;             break; }
+    case GRIB2_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;                break; }
+    case GRIB2_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;               break; }
+    case GRIB2_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;                 break; }
+    case GRIB2_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;               break; }
+    case GRIB2_LTYPE_SIGMA:              { zaxistype = ZAXIS_SIGMA;                  break; }
     case GRIB2_LTYPE_HYBRID:
- /* case GRIB2_LTYPE_HYBRID_LAYER: */    { zaxistype = ZAXIS_HYBRID;            break; }
+ /* case GRIB2_LTYPE_HYBRID_LAYER: */    { zaxistype = ZAXIS_HYBRID;                 break; }
     case GRIB2_LTYPE_LANDDEPTH:
- /* case GRIB2_LTYPE_LANDDEPTH_LAYER: */ { zaxistype = ZAXIS_DEPTH_BELOW_LAND;  break; }
-    case GRIB2_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;        break; }
-    case GRIB2_LTYPE_SNOW:               { zaxistype = ZAXIS_SNOW;              break; }
-    case GRIB2_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;   break; }
+ /* case GRIB2_LTYPE_LANDDEPTH_LAYER: */ { zaxistype = ZAXIS_DEPTH_BELOW_LAND;       break; }
+    case GRIB2_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;             break; }
+    case GRIB2_LTYPE_SNOW:               { zaxistype = ZAXIS_SNOW;                   break; }
+    case GRIB2_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;        break; }
+    case GRIB2_LTYPE_LAKE_BOTTOM:        { zaxistype = ZAXIS_LAKE_BOTTOM;            break; }
+    case GRIB2_LTYPE_SEDIMENT_BOTTOM:    { zaxistype = ZAXIS_SEDIMENT_BOTTOM;        break; }
+    case GRIB2_LTYPE_SEDIMENT_BOTTOM_TA: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;     break; }
+    case GRIB2_LTYPE_SEDIMENT_BOTTOM_TW: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;     break; }
+    case GRIB2_LTYPE_MIX_LAYER:          { zaxistype = ZAXIS_MIX_LAYER;              break; }
+    case GRIB2_LTYPE_REFERENCE:          { zaxistype = ZAXIS_REFERENCE;              break; }
     }
 
   return (zaxistype);
 }
 
 
+int zaxisTypeToGrib1ltype(int zaxistype)
+{
+  int grib_ltype = -1;
+
+  switch (zaxistype)
+    {
+    case ZAXIS_SURFACE:               { grib_ltype = GRIB1_LTYPE_SURFACE;            break; }
+    case ZAXIS_MEANSEA:               { grib_ltype = GRIB1_LTYPE_MEANSEA;            break; }
+    case ZAXIS_HEIGHT:                { grib_ltype = GRIB1_LTYPE_HEIGHT;             break; }
+    case ZAXIS_ALTITUDE:              { grib_ltype = GRIB1_LTYPE_ALTITUDE;           break; }
+    case ZAXIS_SIGMA:                 { grib_ltype = GRIB1_LTYPE_SIGMA;              break; }
+    case ZAXIS_DEPTH_BELOW_SEA:       { grib_ltype = GRIB1_LTYPE_SEADEPTH;           break; }
+    case ZAXIS_ISENTROPIC:            { grib_ltype = GRIB1_LTYPE_ISENTROPIC;         break; }
+    case ZAXIS_CLOUD_BASE:            { grib_ltype = GRIB1_LTYPE_CLOUD_BASE;         break; }
+    case ZAXIS_CLOUD_TOP:             { grib_ltype = GRIB1_LTYPE_CLOUD_TOP;          break; }
+    case ZAXIS_ISOTHERM_ZERO:         { grib_ltype = GRIB1_LTYPE_ISOTHERM0;          break; }
+    case ZAXIS_TOA:                   { grib_ltype = GRIB1_LTYPE_TOA;                break; }
+    case ZAXIS_SEA_BOTTOM:            { grib_ltype = GRIB1_LTYPE_SEA_BOTTOM;         break; }
+    case ZAXIS_LAKE_BOTTOM:           { grib_ltype = GRIB1_LTYPE_LAKE_BOTTOM;        break; }
+    case ZAXIS_SEDIMENT_BOTTOM:       { grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM;    break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TA:    { grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TA; break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TW:    { grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TW; break; }
+    case ZAXIS_MIX_LAYER:             { grib_ltype = GRIB1_LTYPE_MIX_LAYER;          break; }
+    case ZAXIS_ATMOSPHERE:            { grib_ltype = GRIB1_LTYPE_ATMOSPHERE;         break; }
+    }
+
+  return (grib_ltype);
+}
+
+
+int zaxisTypeToGrib2ltype(int zaxistype)
+{
+  int grib_ltype = -1;
+
+  switch (zaxistype)
+    {
+    case ZAXIS_SURFACE:               { grib_ltype = GRIB2_LTYPE_SURFACE;            break; }
+    case ZAXIS_MEANSEA:               { grib_ltype = GRIB2_LTYPE_MEANSEA;            break; }
+    case ZAXIS_HEIGHT:                { grib_ltype = GRIB2_LTYPE_HEIGHT;             break; }
+    case ZAXIS_ALTITUDE:              { grib_ltype = GRIB2_LTYPE_ALTITUDE;           break; }
+    case ZAXIS_SIGMA:                 { grib_ltype = GRIB2_LTYPE_SIGMA;              break; }
+    case ZAXIS_DEPTH_BELOW_SEA:       { grib_ltype = GRIB2_LTYPE_SEADEPTH;           break; }
+    case ZAXIS_ISENTROPIC:            { grib_ltype = GRIB2_LTYPE_ISENTROPIC;         break; }
+    case ZAXIS_CLOUD_BASE:            { grib_ltype = GRIB2_LTYPE_CLOUD_BASE;         break; }
+    case ZAXIS_CLOUD_TOP:             { grib_ltype = GRIB2_LTYPE_CLOUD_TOP;          break; }
+    case ZAXIS_ISOTHERM_ZERO:         { grib_ltype = GRIB2_LTYPE_ISOTHERM0;          break; }
+    case ZAXIS_TOA:                   { grib_ltype = GRIB2_LTYPE_TOA;                break; }
+    case ZAXIS_SEA_BOTTOM:            { grib_ltype = GRIB2_LTYPE_SEA_BOTTOM;         break; }
+    case ZAXIS_LAKE_BOTTOM:           { grib_ltype = GRIB2_LTYPE_LAKE_BOTTOM;        break; }
+    case ZAXIS_SEDIMENT_BOTTOM:       { grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM;    break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TA:    { grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TA; break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TW:    { grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TW; break; }
+    case ZAXIS_MIX_LAYER:             { grib_ltype = GRIB2_LTYPE_MIX_LAYER;          break; }
+    case ZAXIS_ATMOSPHERE:            { grib_ltype = GRIB2_LTYPE_ATMOSPHERE;         break; }
+    }
+
+  return (grib_ltype);
+}
+
+
 int grbBitsPerValue(int datatype)
 {
   int bitsPerValue = 16;
@@ -34406,14 +34760,13 @@ int grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype
   if ( streamptr->comptype == COMPRESS_SZIP )
     nbytes = grbSzip(filetype, gribbuffer, nbytes);
 
-  /* begin deike */
-#ifdef USE_MPI
-  if ( commInqIOMode () != PIO_NONE )
-    nwrite = pioFileWrite ( fileID, tsID, gribbuffer, nbytes );
-  else
-#endif
-  /* end deike */
-    nwrite = fileWrite(fileID, gribbuffer, nbytes);
+  {
+    size_t (*myFileWrite)(int fileID, const void *restrict buffer,
+                          size_t len, int tsID)
+      = (size_t (*)(int, const void *restrict, size_t, int))
+      namespaceSwitchGet(NSSWITCH_FILE_WRITE).func;
+    nwrite = myFileWrite(fileID, gribbuffer, nbytes, tsID);
+  }
 
   if ( nwrite != nbytes ) perror(__func__);
 
@@ -35364,7 +35717,8 @@ void srvReadVarDP(stream_t *streamptr, int varID, double *data, int *nmiss)
       recID = streamptr->vars[varID].level[levID];
       recpos = streamptr->tsteps[tsid].records[recID].position;
       fileSetPos(fileID, recpos, SEEK_SET);
-      srvRead(fileID, srvp);
+      if (srvRead(fileID, srvp) < 0)
+        abort();
       srvInqHeader(srvp, header);
       srvInqDataDP(srvp, &data[levID*gridsize]);
     }
@@ -35410,7 +35764,8 @@ void srvReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data,
   recID = streamptr->vars[varID].level[levID];
   recpos = streamptr->tsteps[tsid].records[recID].position;
   fileSetPos(fileID, recpos, SEEK_SET);
-  srvRead(fileID, srvp);
+  if (srvRead(fileID, srvp) < 0)
+    abort();
   srvInqHeader(srvp, header);
   srvInqDataDP(srvp, data);
 
@@ -36430,7 +36785,7 @@ void extReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data,
   extRead(fileID, extp);
   extInqHeader(extp, header);
   extInqDataDP(extp, data);
- 
+
   fileSetPos(fileID, currentfilepos, SEEK_SET);
 
   *nmiss = 0;
@@ -38057,11 +38412,12 @@ void iegWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double
 #include <math.h>
 #include <float.h>
 
+#if  defined  (HAVE_LIBNETCDF)
+#  include <netcdf.h>
+#endif
 
 
 
-#if  defined  (HAVE_LIBNETCDF)
-#endif
 
 //#define PROJECTION_TEST
 
@@ -38078,6 +38434,9 @@ void cdfDefLocalAtts(stream_t *streamptr);
 #define  Z_AXIS  3
 #define  T_AXIS  4
 
+#define  POSITIVE_UP    1
+#define  POSITIVE_DOWN  2
+
 typedef struct {
   int     ncvarid;
   int     dimtype;
@@ -38099,6 +38458,7 @@ typedef struct {
   int      param;
   int      code;
   int      tabnum;
+  int      climatology;
   int      bounds;
   int      gridID;
   int      zaxisID;
@@ -38117,6 +38477,7 @@ typedef struct {
   int      calendar;
   int      tableID;
   int      truncation;
+  int      position;
   int      defmissval;
   int      deffillval;
   int      xtype;
@@ -38409,6 +38770,14 @@ void cdfGetAttText(int fileID, int ncvarid, char *attname, int attlen, char *att
 }
 
 static
+int xtypeIsFloat(int xtype)
+{
+  int isFloat = FALSE;
+  if ( xtype == NC_FLOAT || xtype == NC_DOUBLE ) isFloat = TRUE;
+  return isFloat;
+}
+
+static
 int cdfInqDatatype(int xtype, int lunsigned)
 {
   int datatype = -1;
@@ -38873,13 +39242,26 @@ void cdfDefTime(stream_t *streamptr)
       if ( nc_inq_dimid(fileID, "nb2", &dims[1]) != NC_NOERR )
 	cdf_def_dim(fileID, "nb2", 2, &dims[1]);
 
-      strcpy(tmpstr, taxis_name);
-      strcat(tmpstr, "_bnds");
-      cdf_def_var(fileID, tmpstr, NC_DOUBLE, 2, dims, &time_bndsid);
+      if ( taxis->climatology )
+        {
+          strcpy(tmpstr, "climatology");
+          strcat(tmpstr, "_bnds");
+          cdf_def_var(fileID, tmpstr, NC_DOUBLE, 2, dims, &time_bndsid);
+
+          streamptr->basetime.ncvarboundsid = time_bndsid;
+
+          cdf_put_att_text(fileID, time_varid, "climatology", strlen(tmpstr), tmpstr);
+        }
+      else
+        {
+          strcpy(tmpstr, taxis_name);
+          strcat(tmpstr, "_bnds");
+          cdf_def_var(fileID, tmpstr, NC_DOUBLE, 2, dims, &time_bndsid);
 
-      streamptr->basetime.ncvarboundsid = time_bndsid;
+          streamptr->basetime.ncvarboundsid = time_bndsid;
 
-      cdf_put_att_text(fileID, time_varid, "bounds", strlen(tmpstr), tmpstr);
+          cdf_put_att_text(fileID, time_varid, "bounds", strlen(tmpstr), tmpstr);
+        }
     }
 
   unitstr[0] = 0;
@@ -38921,11 +39303,12 @@ void cdfDefTime(stream_t *streamptr)
 
   len = strlen(unitstr);
   if ( len )
-    cdf_put_att_text(fileID, time_varid, "units", len, unitstr);
+    {
+      cdf_put_att_text(fileID, time_varid, "units", len, unitstr);
 
-  if ( taxis->has_bounds )
-    if ( len )
-      cdf_put_att_text(fileID, time_bndsid, "units", len, unitstr);
+      if ( taxis->has_bounds )
+        cdf_put_att_text(fileID, time_bndsid, "units", len, unitstr);
+    }
 
   if ( taxis->calendar != -1 )
     {
@@ -39924,6 +40307,47 @@ void cdfDefGdim(stream_t *streamptr, int gridID)
 
 #if  defined  (HAVE_LIBNETCDF)
 static
+void cdfDefGridReference(stream_t *streamptr, int gridID)
+{
+  int fileID  = streamptr->fileID;
+  int number = gridInqNumber(gridID);
+
+  if ( number > 0 )
+    {
+      cdf_put_att_int(fileID, NC_GLOBAL, "number_of_grid_used", NC_INT, 1, &number);
+    }
+
+  if ( gridInqReference(gridID, NULL) )
+    {
+      char gridfile[8912];
+      gridInqReference(gridID, gridfile);
+
+      if ( gridfile[0] != 0 )
+        cdf_put_att_text(fileID, NC_GLOBAL, "grid_file_uri", strlen(gridfile), gridfile);
+    }
+}
+
+static
+void cdfDefGridUUID(stream_t *streamptr, int gridID)
+{
+  char uuidOfHGrid[17];
+
+  gridInqUUID(gridID, uuidOfHGrid);
+  if ( uuidOfHGrid[0] != 0 )
+    {
+      char uuidOfHGridStr[37];
+      uuid2str(uuidOfHGrid, uuidOfHGridStr);
+      if ( uuidOfHGridStr[0] != 0 && strlen(uuidOfHGridStr) == 36 )
+        {
+          int fileID  = streamptr->fileID;
+          //if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
+          cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfHGrid", 36, uuidOfHGridStr);
+          //if ( streamptr->ncmode == 2 ) cdf_enddef(fileID);
+        }
+    }
+}
+
+static
 void cdfDefUnstructured(stream_t *streamptr, int gridID)
 {
   char xunits[CDI_MAX_NAME];
@@ -40007,6 +40431,10 @@ void cdfDefUnstructured(stream_t *streamptr, int gridID)
       nvertex = gridInqNvertex(gridID);
       if ( nvertex > 0 ) cdf_def_dim(fileID, vertname, nvertex, &nvdimID);
 
+      cdfDefGridReference(streamptr, gridID);
+
+      cdfDefGridUUID(streamptr, gridID);
+
       if ( gridInqXvalsPtr(gridID) )
         {
           cdf_def_var(fileID, xaxisname, (nc_type) xtype, 1, &dimID, &ncxvarid);
@@ -40217,14 +40645,19 @@ void cdfDefZaxis(stream_t *streamptr, int zaxisID)
   dimlen = zaxisInqSize(zaxisID);
   type   = zaxisInqType(zaxisID);
 
-  if ( dimlen == 1 && type == ZAXIS_SURFACE       ) return;
-  if ( dimlen == 1 && type == ZAXIS_CLOUD_BASE    ) return;
-  if ( dimlen == 1 && type == ZAXIS_CLOUD_TOP     ) return;
-  if ( dimlen == 1 && type == ZAXIS_ISOTHERM_ZERO ) return;
-  if ( dimlen == 1 && type == ZAXIS_TOA           ) return;
-  if ( dimlen == 1 && type == ZAXIS_SEA_BOTTOM    ) return;
-  if ( dimlen == 1 && type == ZAXIS_ATMOSPHERE    ) return;
-  if ( dimlen == 1 && type == ZAXIS_MEANSEA       ) return;
+  if ( dimlen == 1 && type == ZAXIS_SURFACE            ) return;
+  if ( dimlen == 1 && type == ZAXIS_CLOUD_BASE         ) return;
+  if ( dimlen == 1 && type == ZAXIS_CLOUD_TOP          ) return;
+  if ( dimlen == 1 && type == ZAXIS_ISOTHERM_ZERO      ) return;
+  if ( dimlen == 1 && type == ZAXIS_TOA                ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEA_BOTTOM         ) return;
+  if ( dimlen == 1 && type == ZAXIS_ATMOSPHERE         ) return;
+  if ( dimlen == 1 && type == ZAXIS_MEANSEA            ) return;
+  if ( dimlen == 1 && type == ZAXIS_LAKE_BOTTOM        ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEDIMENT_BOTTOM    ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEDIMENT_BOTTOM_TA ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEDIMENT_BOTTOM_TW ) return;
+  if ( dimlen == 1 && type == ZAXIS_MIX_LAYER          ) return;
 
   zaxisInqName(zaxisID, axisname);
   /*
@@ -40371,12 +40804,12 @@ void cdfDefZaxis(stream_t *streamptr, int zaxisID)
             cdf_put_att_text(fileID, ncvarid, "units", len, units);
 
 	  positive = zaxisInqPositive(zaxisID);
-	  if ( positive == 1 )
+	  if ( positive == POSITIVE_UP )
 	    {
 	      strcpy(tmpname, "up");
 	      cdf_put_att_text(fileID, ncvarid, "positive", strlen(tmpname), tmpname);
 	    }
-	  else if ( positive == 2 )
+	  else if ( positive == POSITIVE_DOWN )
 	    {
 	      strcpy(tmpname, "down");
 	      cdf_put_att_text(fileID, ncvarid, "positive", strlen(tmpname), tmpname);
@@ -40561,26 +40994,6 @@ void cdfDefMapping(stream_t *streamptr, int gridID)
 
 #if  defined  (HAVE_LIBNETCDF)
 static
-void cdfDefGridUUID(stream_t *streamptr, int gridID)
-{
-  char uuidOfHGrid[17];
-
-  gridInqUUID(gridID, uuidOfHGrid);
-  if ( uuidOfHGrid[0] != 0 )
-    {
-      char uuidOfHGridStr[37];
-      uuid2str(uuidOfHGrid, uuidOfHGridStr);
-      if ( uuidOfHGridStr[0] != 0 && strlen(uuidOfHGridStr) == 36 )
-        {
-          int fileID  = streamptr->fileID;
-          if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
-          cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfHGrid", 36, uuidOfHGridStr);
-          if ( streamptr->ncmode == 2 ) cdf_enddef(fileID);
-        }
-    }
-}
-
-static
 void cdfDefGrid(stream_t *streamptr, int gridID)
 {
   int gridtype, size;
@@ -40677,8 +41090,6 @@ void cdfDefGrid(stream_t *streamptr, int gridID)
     {
       Error("Unsupported grid type: %s", gridNamePtr(gridtype));
     }
-
-  cdfDefGridUUID(streamptr, gridID);
 }
 #endif
 
@@ -41054,6 +41465,13 @@ int cdfDefVar(stream_t *streamptr, int varID)
           len = strlen(cellarea);
           cdf_put_att_text(fileID, ncvarid, "cell_measures", len, cellarea);
         }
+
+      if ( gridtype == GRID_UNSTRUCTURED )
+        {
+          int position = gridInqPosition(gridID);
+          if ( position > 0 )
+            cdf_put_att_int(fileID, ncvarid, "number_of_grid_in_reference", NC_INT, 1, &position);
+        }
     }
   else if ( gridtype == GRID_SPECTRAL || gridtype == GRID_FOURIER )
     {
@@ -41105,11 +41523,16 @@ int cdfDefVar(stream_t *streamptr, int varID)
 
   if ( zid == -1 )
     {
-      if ( zaxisInqType(zaxisID) == ZAXIS_CLOUD_BASE    ||
-           zaxisInqType(zaxisID) == ZAXIS_CLOUD_TOP     ||
-           zaxisInqType(zaxisID) == ZAXIS_ISOTHERM_ZERO ||
-           zaxisInqType(zaxisID) == ZAXIS_TOA           ||
-           zaxisInqType(zaxisID) == ZAXIS_SEA_BOTTOM    ||
+      if ( zaxisInqType(zaxisID) == ZAXIS_CLOUD_BASE          ||
+           zaxisInqType(zaxisID) == ZAXIS_CLOUD_TOP           ||
+           zaxisInqType(zaxisID) == ZAXIS_ISOTHERM_ZERO       ||
+           zaxisInqType(zaxisID) == ZAXIS_TOA                 ||
+           zaxisInqType(zaxisID) == ZAXIS_SEA_BOTTOM          ||
+           zaxisInqType(zaxisID) == ZAXIS_LAKE_BOTTOM         ||
+           zaxisInqType(zaxisID) == ZAXIS_SEDIMENT_BOTTOM     ||
+           zaxisInqType(zaxisID) == ZAXIS_SEDIMENT_BOTTOM_TA  ||
+           zaxisInqType(zaxisID) == ZAXIS_SEDIMENT_BOTTOM_TW  ||
+           zaxisInqType(zaxisID) == ZAXIS_MIX_LAYER           ||
            zaxisInqType(zaxisID) == ZAXIS_ATMOSPHERE )
         {
           zaxisInqName(zaxisID, varname);
@@ -41472,9 +41895,9 @@ int cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarid, int dtyp
 }
 #endif
 
+#if  defined  (HAVE_LIBNETCDF)
 void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data, int nmiss)
 {
-#if  defined  (HAVE_LIBNETCDF)
   int fileID;
   int gridID;
   int zaxisID;
@@ -41571,8 +41994,120 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
 
   cdf_write_var_data(fileID, vlistID, varID, ncvarid, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss);
 
+}
 #endif
+
+#if  defined  (HAVE_LIBNETCDF)
+void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
+                         const int rect[][2], const void *data, int nmiss)
+{
+  int fileID;
+  int gridID;
+  int zaxisID;
+  int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID;
+  int ncvarid;
+  int ntsteps;
+  size_t xsize = 0, ysize = 0;
+  size_t start[4];
+  size_t count[4];
+  long nvals;
+  int swapxy = FALSE;
+  int ndims = 0;
+  int idim;
+  int tsteptype;
+  int gridindex, zaxisindex;
+  int dtype;
+  int vlistID;
+  int streamID = streamptr->self;
+
+  if ( CDI_Debug )
+    Message("streamID = %d  varID = %d", streamID, varID);
+
+  vlistID = streamInqVlist(streamID);
+  fileID  = streamInqFileID(streamID);
+
+  ntsteps = streamptr->ntsteps;
+  if ( CDI_Debug )
+    Message("ntsteps = %d", ntsteps);
+
+  if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
+
+  ncvarid = cdfDefVar(streamptr, varID);
+
+  gridID    = vlistInqVarGrid(vlistID, varID);
+  zaxisID   = vlistInqVarZaxis(vlistID, varID);
+  tsteptype = vlistInqVarTsteptype(vlistID, varID);
+
+  gridindex = vlistGridIndex(vlistID, gridID);
+  if ( gridInqType(gridID) == GRID_TRAJECTORY )
+    {
+      cdfWriteGridTraj(streamptr, gridID);
+    }
+  else
+    {
+      xid = streamptr->xdimID[gridindex];
+      yid = streamptr->ydimID[gridindex];
+    }
+
+  zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
+  zid = streamptr->zaxisID[zaxisindex];
+
+  if ( tsteptype != TSTEP_CONSTANT )
+    {
+      start[ndims] = ntsteps - 1;
+      count[ndims] = 1;
+      ndims++;
+    }
+  if ( zid != UNDEFID )
+    {
+      int size = zaxisInqSize(zaxisID);
+      xassert(rect[2][0] >= 0 && rect[2][0] <= rect[2][1]
+              && rect[2][1] <= size);
+      start[ndims] = rect[2][0];
+      count[ndims] = rect[2][1] - rect[2][0] + 1;
+      ndims++;
+    }
+  if ( yid != UNDEFID )
+    {
+      size_t size;
+      cdf_inq_dimlen(fileID, yid, &size);
+      xassert(rect[1][0] >= 0 && rect[1][0] <= rect[1][1]
+              && rect[1][1] <= size);
+      start[ndims] = rect[1][0];
+      count[ndims] = rect[1][1] - rect[1][0] + 1;
+      ndims++;
+    }
+  if ( xid != UNDEFID )
+    {
+      size_t size;
+      cdf_inq_dimlen(fileID, xid, &size);
+      xassert(rect[0][0] >= 0 && rect[0][0] <= rect[0][1]
+              && rect[0][1] <= size);
+      start[ndims] = rect[0][0];
+      count[ndims] = rect[0][1] - rect[0][0] + 1;
+      ndims++;
+    }
+
+  if ( CDI_Debug )
+    for (idim = 0; idim < ndims; idim++)
+      Message("dim = %d  start = %d  count = %d", idim, start[idim], count[idim]);
+
+  if ( streamptr->ncmode == 1 )
+    {
+      cdf_enddef(fileID);
+      streamptr->ncmode = 2;
+    }
+
+  dtype = vlistInqVarDatatype(vlistID, varID);
+
+  if ( nmiss > 0 ) cdfDefVarMissval(streamptr, varID, dtype, 1);
+
+  nvals = gridInqSize(gridID)*zaxisInqSize(zaxisID);
+
+  cdf_write_var_data(fileID, vlistID, varID, ncvarid, dtype, nvals,
+                     xsize, ysize, swapxy, start, count, memtype, data, nmiss);
 }
+#endif
 
 
 int cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, int *nmiss)
@@ -41893,10 +42428,10 @@ int cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype
   return (0);
 }
 
+#if  defined  (HAVE_LIBNETCDF)
 static
 void cdfCreateRecords(stream_t *streamptr, int tsID)
 {
-#if  defined  (HAVE_LIBNETCDF)
   int varID, levelID, recID, vrecID, zaxisID;
   int nvars, nlev, nrecs, nvrecs;
   record_t *records = NULL;
@@ -42013,8 +42548,8 @@ void cdfCreateRecords(stream_t *streamptr, int tsID)
              streamptr->tsteps[1].recIDs,
              nvrecs*sizeof(int));
     }
-#endif
 }
+#endif
 
 #if  defined  (HAVE_LIBNETCDF)
 static
@@ -42104,6 +42639,7 @@ void init_ncvars(long nvars, ncvar_t *ncvars)
       ncvars[ncvarid].code            = UNDEFID;
       ncvars[ncvarid].tabnum          = 0;
       ncvars[ncvarid].calendar        = FALSE;
+      ncvars[ncvarid].climatology     = FALSE;
       ncvars[ncvarid].bounds          = UNDEFID;
       ncvars[ncvarid].gridID          = UNDEFID;
       ncvars[ncvarid].zaxisID         = UNDEFID;
@@ -42129,6 +42665,7 @@ void init_ncvars(long nvars, ncvar_t *ncvars)
       ncvars[ncvarid].vlen            = 0;
       ncvars[ncvarid].vdata           = NULL;
       ncvars[ncvarid].truncation      = 0;
+      ncvars[ncvarid].position        = 0;
       ncvars[ncvarid].positive        = 0;
       ncvars[ncvarid].chunked         = 0;
       ncvars[ncvarid].chunktype       = UNDEFID;
@@ -42158,18 +42695,23 @@ static
 int isLonAxis(const char *units, const char *stdname)
 {
   int status = FALSE;
+  char degree_units[16];
 
-  if ( memcmp(units, "degrees_east", 12) == 0 ||
-       memcmp(units, "degree_east", 11)  == 0 ||
-       memcmp(units, "degree_E", 8)      == 0 ||
-       memcmp(units, "degrees_E", 9)     == 0 ||
-       memcmp(units, "degreeE", 7)       == 0 ||
-       memcmp(units, "degreesE", 8)      == 0 ||
-       memcmp(stdname, "longitude", 9)   == 0 ||
-       (memcmp(units, "degree", 6)            == 0 &&
-        memcmp(stdname, "grid_longitude", 14) == 0) ||
-       (memcmp(units, "radian", 6)            == 0 &&
-        memcmp(stdname, "grid_longitude", 14) == 0) )
+  memcpy(degree_units, units, 16);
+  degree_units[15] = 0;
+  strtolower(degree_units);
+
+  if ( memcmp(degree_units, "degree", 6) == 0 )
+    {
+      int ioff = 6;
+      if ( degree_units[ioff] == 's' ) ioff++;
+      if ( degree_units[ioff] == '_' ) ioff++;
+      if ( degree_units[ioff] == 'e' ) status = TRUE;
+    }
+
+  if ( status == TRUE ||
+       ((memcmp(units, "degree", 6) == 0 ||memcmp(units, "radian", 6) == 0) &&
+        (memcmp(stdname, "grid_longitude", 14) == 0 || memcmp(stdname, "longitude", 9) == 0)) )
     {
       status = TRUE;
     }
@@ -42181,18 +42723,23 @@ static
 int isLatAxis(const char *units, const char *stdname)
 {
   int status = FALSE;
+  char degree_units[16];
+
+  memcpy(degree_units, units, 16);
+  degree_units[15] = 0;
+  strtolower(degree_units);
+
+  if ( memcmp(degree_units, "degree", 6) == 0 )
+    {
+      int ioff = 6;
+      if ( degree_units[ioff] == 's' ) ioff++;
+      if ( degree_units[ioff] == '_' ) ioff++;
+      if ( degree_units[ioff] == 'n' ) status = TRUE;
+    }
 
-  if ( memcmp(units, "degrees_north", 13) == 0 ||
-       memcmp(units, "degree_north", 12)  == 0 ||
-       memcmp(units, "degree_N", 8)       == 0 ||
-       memcmp(units, "degrees_N", 9)      == 0 ||
-       memcmp(units, "degreeN", 7)        == 0 ||
-       memcmp(units, "degreesN", 8)       == 0 ||
-       memcmp(stdname, "latitude", 8)     == 0 ||
-       (memcmp(units, "degree", 6)           == 0 &&
-        memcmp(stdname, "grid_latitude", 13) == 0) ||
-       (memcmp(units, "radian", 6)           == 0 &&
-        memcmp(stdname, "grid_latitude", 13) == 0) )
+  if ( status == TRUE ||
+       ((memcmp(units, "degree", 6) == 0 || memcmp(units, "radian", 6) == 0) &&
+        (memcmp(stdname, "grid_latitude", 13) == 0 || memcmp(stdname, "latitude", 8) == 0)) )
     {
       status = TRUE;
     }
@@ -42609,6 +43156,16 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 ncvars[ncvarid].zaxistype = ZAXIS_ISOTHERM_ZERO;
               else if ( strcmp(attstring, "seabottom") == 0 )
                 ncvars[ncvarid].zaxistype = ZAXIS_SEA_BOTTOM;
+              else if ( strcmp(attstring, "lakebottom") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_LAKE_BOTTOM;
+              else if ( strcmp(attstring, "sedimentbottom") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_SEDIMENT_BOTTOM;
+              else if ( strcmp(attstring, "sedimentbottomta") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;
+              else if ( strcmp(attstring, "sedimentbottomtw") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;
+              else if ( strcmp(attstring, "mixlayer") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_MIX_LAYER;
               else if ( strcmp(attstring, "atmosphere") == 0 )
                 ncvars[ncvarid].zaxistype = ZAXIS_ATMOSPHERE;
               else
@@ -42631,6 +43188,10 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
             {
               cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvars[ncvarid].truncation);
             }
+          else if ( strcmp(attname, "number_of_grid_in_reference") == 0 && atttype != NC_CHAR )
+            {
+              cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvars[ncvarid].position);
+            }
           else if ( strcmp(attname, "add_offset") == 0 && atttype != NC_CHAR )
             {
 	      cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvars[ncvarid].addoffset);
@@ -42651,6 +43212,24 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
 	      */
 	      /* (also used for lon/lat) cdfSetVar(ncvars, ncvarid, TRUE); */
             }
+          else if ( strcmp(attname, "climatology") == 0 && atttype == NC_CHAR )
+            {
+              int status, ncboundsid;
+
+              cdfGetAttText(ncid, ncvarid, attname, attstringlen-1, attstring);
+
+              status = nc_inq_varid(ncid, attstring, &ncboundsid);
+
+              if ( status == NC_NOERR )
+                {
+                  ncvars[ncvarid].climatology = TRUE;
+                  ncvars[ncvarid].bounds = ncboundsid;
+                  cdfSetVar(ncvars, ncvars[ncvarid].bounds, FALSE);
+                  cdfSetVar(ncvars, ncvarid, FALSE);
+                }
+              else
+                Warning("%s - %s", nc_strerror(status), attstring);
+            }
           else if ( strcmp(attname, "bounds") == 0 && atttype == NC_CHAR )
             {
               int status, ncboundsid;
@@ -42795,8 +43374,8 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
               cdfGetAttText(ncid, ncvarid, attname, attstringlen-1, attstring);
               strtolower(attstring);
 
-              if    ( memcmp(attstring, "down", 4) == 0 ) ncvars[ncvarid].positive = -1;
-              else if ( memcmp(attstring, "up", 2) == 0 ) ncvars[ncvarid].positive = 1;
+              if    ( memcmp(attstring, "down", 4) == 0 ) ncvars[ncvarid].positive = POSITIVE_DOWN;
+              else if ( memcmp(attstring, "up", 2) == 0 ) ncvars[ncvarid].positive = POSITIVE_UP;
 
               if ( ncvars[ncvarid].ndims == 1 )
                 {
@@ -42823,7 +43402,7 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 {
                   extern int cdiIgnoreValidRange;
                   int lignore = FALSE;
-                  if ( (atttype == NC_FLOAT || atttype == NC_DOUBLE) && xtype != NC_FLOAT && xtype != NC_DOUBLE ) lignore = TRUE;
+                  if ( xtypeIsFloat(atttype) != xtypeIsFloat(xtype) ) lignore = TRUE;
                   if ( cdiIgnoreValidRange == FALSE && lignore == FALSE )
                     {
                       cdfGetAttDouble(ncid, ncvarid, attname, 2, ncvars[ncvarid].validrange);
@@ -42844,7 +43423,7 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 {
                   extern int cdiIgnoreValidRange;
                   int lignore = FALSE;
-                  if ( (atttype == NC_FLOAT || atttype == NC_DOUBLE) && xtype != NC_FLOAT && xtype != NC_DOUBLE ) lignore = TRUE;
+                  if ( xtypeIsFloat(atttype) != xtypeIsFloat(xtype) ) lignore = TRUE;
                   if ( cdiIgnoreValidRange == FALSE && lignore == FALSE )
                     {
                       cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvars[ncvarid].validrange)[0]);
@@ -42862,7 +43441,7 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 {
                   extern int cdiIgnoreValidRange;
                   int lignore = FALSE;
-                  if ( (atttype == NC_FLOAT || atttype == NC_DOUBLE) && xtype != NC_FLOAT && xtype != NC_DOUBLE ) lignore = TRUE;
+                  if ( xtypeIsFloat(atttype) != xtypeIsFloat(xtype) ) lignore = TRUE;
                   if ( cdiIgnoreValidRange == FALSE && lignore == FALSE )
                     {
                       cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvars[ncvarid].validrange)[1]);
@@ -43152,11 +43731,11 @@ void verify_coordinate_vars_1(int ndims, ncdim_t *ncdims, ncvar_t *ncvars, int t
 		{
 		  if      ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer midpoints") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
 		  else if ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer interfaces") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
 		  else if ( strcmp(ncvars[ncvarid].units, "level") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_GENERIC;
@@ -43231,11 +43810,11 @@ void verify_coordinate_vars_2(int nvars, ncvar_t *ncvars)
 		{
 		  if      ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer midpoints") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
 		  else if ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer interfaces") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
 		  else if ( strcmp(ncvars[ncvarid].units, "level") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_GENERIC;
@@ -43259,6 +43838,7 @@ void verify_coordinate_vars_2(int nvars, ncvar_t *ncvars)
     }
 }
 
+#if defined (PROJECTION_TEST)
 static
 void copy_numeric_projatts(int gridID, int ncvarID, int ncfileID)
 {
@@ -43279,10 +43859,11 @@ void copy_numeric_projatts(int gridID, int ncvarID, int ncfileID)
     }
 
 }
+#endif
 
 /* define all input grids */
 static
-void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvars, ncvar_t *ncvars, int timedimid, char *uuidOfHGrid, int number_of_grid_used)
+void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvars, ncvar_t *ncvars, int timedimid, char *uuidOfHGrid, char *gridfile, int number_of_grid_used)
 {
   int ncvarid, ncvarid2;
   int ndims;
@@ -43713,12 +44294,11 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 		}
 	    }
 
-	  if ( number_of_grid_used != UNDEFID &&
-               (grid.type == UNDEFID || grid.type == GRID_GENERIC) )
-	    {
-	      grid.type   = GRID_REFERENCE;
-	      grid.number = number_of_grid_used;
-	    }
+	  if ( number_of_grid_used != UNDEFID && (grid.type == UNDEFID || grid.type == GRID_GENERIC) )
+            grid.type   = GRID_UNSTRUCTURED;
+
+	  if ( number_of_grid_used != UNDEFID && grid.type == GRID_UNSTRUCTURED )
+            grid.number = number_of_grid_used;
 
 	  if ( ncvars[ncvarid].gmapid >= 0 && ncvars[ncvarid].gridtype != GRID_CURVILINEAR )
 	    {
@@ -43836,9 +44416,14 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 #endif
 	    ncvars[ncvarid].gridID = varDefGrid(vlistID, grid, 1);
 
-          if ( uuidOfHGrid[0] != 0 && 
-	       (grid.type == GRID_UNSTRUCTURED || grid.type == GRID_REFERENCE) )
-            gridDefUUID(ncvars[ncvarid].gridID, uuidOfHGrid);
+          if ( grid.type == GRID_UNSTRUCTURED )
+            {
+              if ( ncvars[ncvarid].position > 0 ) gridDefPosition(ncvars[ncvarid].gridID, ncvars[ncvarid].position);
+
+              if ( gridfile[0] != 0 ) gridDefReference(ncvars[ncvarid].gridID, gridfile);
+
+              if ( uuidOfHGrid[0] != 0 ) gridDefUUID(ncvars[ncvarid].gridID, uuidOfHGrid);
+            }
 
           if ( ncvars[ncvarid].chunked )
             {
@@ -43901,6 +44486,8 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 		    if ( ncvars[ncvarid].xvarid != ncvars[ncvarid2].xvarid ) same_grid = FALSE;
 		    if ( ncvars[ncvarid].yvarid != ncvars[ncvarid2].yvarid ) same_grid = FALSE;
 
+		    if ( ncvars[ncvarid].position != ncvars[ncvarid2].position ) same_grid = FALSE;
+
 		    if ( same_grid )
 		      {
 			if ( CDI_Debug )
@@ -43925,6 +44512,7 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
   int zaxisindex;
   int zprec;
   int nbdims, nvertex, nlevel;
+  int positive = 0;
   char *pname, *plongname, *punits;
 
   for ( ncvarid = 0; ncvarid < nvars; ncvarid++ )
@@ -43940,6 +44528,8 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 	  double *ubounds = NULL;
 	  int zaxisType;
 
+          positive = 0;
+
 	  ndims = ncvars[ncvarid].ndims;
 	  for ( i = 0; i < ndims; i++ )
 	    {
@@ -43967,6 +44557,7 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 
 	  if ( zvarid != UNDEFID )
 	    {
+	      positive  = ncvars[zvarid].positive;
 	      pname     = ncvars[zvarid].name;
 	      plongname = ncvars[zvarid].longname;
 	      punits    = ncvars[zvarid].units;
@@ -44033,6 +44624,9 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 
       	  ncvars[ncvarid].zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, with_bounds, lbounds, ubounds,
 						vctsize, vct, pname, plongname, punits, zprec, 1, 0);
+
+          if ( positive > 0 ) zaxisDefPositive(ncvars[ncvarid].zaxisID, positive);
+
 	  free(zvar);
 	  free(lbounds);
 	  free(ubounds);
@@ -44369,8 +44963,8 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
 }
 
 static
-void scan_global_attributtes(int fileID, int vlistID, stream_t *streamptr, int ngatts,
-                             int *instID, int *modelID, int *ucla_les, char *uuidOfHGrid, int *number_of_grid_used)
+void scan_global_attributes(int fileID, int vlistID, stream_t *streamptr, int ngatts,
+                            int *instID, int *modelID, int *ucla_les, char *uuidOfHGrid, char *gridfile, int *number_of_grid_used)
 {
   nc_type xtype;
   size_t attlen;
@@ -44422,6 +45016,10 @@ void scan_global_attributtes(int fileID, int vlistID, stream_t *streamptr, int n
 	      else if ( strcmp(attname, "CDO") == 0 )
 		{
 		}
+	      else if ( strcmp(attname, "grid_file_uri") == 0 )
+		{
+                  memcpy(gridfile, attstring, attlen+1);
+		}
 	      else if ( strcmp(attname, "uuidOfHGrid") == 0 && attlen == 36 )
 		{
                   attstring[36] = 0;
@@ -44430,6 +45028,11 @@ void scan_global_attributtes(int fileID, int vlistID, stream_t *streamptr, int n
 		}
 	      else
 		{
+                  if ( strcmp(attname, "ICON_grid_file_uri") == 0 && gridfile[0] == 0 )
+                    {
+                      memcpy(gridfile, attstring, attlen+1);
+                    }
+
 		  vlistDefAttTxt(vlistID, CDI_GLOBAL, attname, (int)attlen, attstring);
 		}
 	    }
@@ -44480,8 +45083,9 @@ int cdfInqContents(stream_t *streamptr)
   int *varids;
   int nvarids;
   const int attstringlen = 8192; char attstring[8192];
-  int timehasunits = FALSE;
+  int time_has_units = FALSE;
   int time_has_bounds = FALSE;
+  int time_climatology = FALSE;
   size_t len;
   int nvars_data;
   int nvcth_id = UNDEFID, vcta_id = UNDEFID, vctb_id = UNDEFID;
@@ -44499,9 +45103,11 @@ int cdfInqContents(stream_t *streamptr)
   int format = 0;
   int ucla_les = FALSE;
   char uuidOfHGrid[17];
+  char gridfile[8912];
   int number_of_grid_used = UNDEFID;
 
   uuidOfHGrid[0] = 0;
+  gridfile[0] = 0;
 
   vlistID = streamptr->vlistID;
   fileID  = streamptr->fileID;
@@ -44570,8 +45176,8 @@ int cdfInqContents(stream_t *streamptr)
       return (CDI_EUFSTRUCT);
     }
 
-  /* scan global attributtes */
-  scan_global_attributtes(fileID, vlistID, streamptr, ngatts, &instID, &modelID, &ucla_les, uuidOfHGrid, &number_of_grid_used);
+  /* scan global attributes */
+  scan_global_attributes(fileID, vlistID, streamptr, ngatts, &instID, &modelID, &ucla_les, uuidOfHGrid, gridfile, &number_of_grid_used);
 
   /* find time dim */
   if ( unlimdimid >= 0 )
@@ -44690,7 +45296,7 @@ int cdfInqContents(stream_t *streamptr)
       else if ( streamptr->basetime.lwrf == FALSE )
 	{
 	  if ( ncvars[ncvarid].units[0] != 0 )
-	    timehasunits = TRUE;
+	    time_has_units = TRUE;
 
 	  if ( ncvars[ncvarid].bounds != UNDEFID )
 	    {
@@ -44700,8 +45306,10 @@ int cdfInqContents(stream_t *streamptr)
 		  len = ncdims[ncvars[ncvars[ncvarid].bounds].dimids[nbdims-1]].len;
 		  if ( (int)len == 2 && timedimid == ncvars[ncvars[ncvarid].bounds].dimids[0] )
 		    {
+
 		      time_has_bounds = TRUE;
 		      streamptr->basetime.ncvarboundsid = ncvars[ncvarid].bounds;
+                      if ( ncvars[ncvarid].climatology ) time_climatology = TRUE;
 		    }
 		}
 	    }
@@ -44872,7 +45480,7 @@ int cdfInqContents(stream_t *streamptr)
 
 
   /* define all grids */
-  define_all_grids(streamptr, vlistID, ncdims, nvars, ncvars, timedimid, uuidOfHGrid, number_of_grid_used);
+  define_all_grids(streamptr, vlistID, ncdims, nvars, ncvars, timedimid, uuidOfHGrid, gridfile, number_of_grid_used);
 
 
   /* read VCT */
@@ -44922,7 +45530,7 @@ int cdfInqContents(stream_t *streamptr)
   /* time varID */
   ncvarid = streamptr->basetime.ncvarid;
 
-  if ( timehasunits )
+  if ( time_has_units )
     {
       taxis_t *taxis;
       taxis = &streamptr->tsteps[0].taxis;
@@ -44933,7 +45541,10 @@ int cdfInqContents(stream_t *streamptr)
     }
 
   if ( time_has_bounds )
-    streamptr->tsteps[0].taxis.has_bounds = TRUE;
+    {
+      streamptr->tsteps[0].taxis.has_bounds = TRUE;
+      if ( time_climatology ) streamptr->tsteps[0].taxis.climatology = TRUE;
+    }
 
   if ( ncvarid != -1 )
     {
@@ -44975,7 +45586,7 @@ int cdfInqContents(stream_t *streamptr)
   else
     {
       taxisID = taxisCreate(TAXIS_ABSOLUTE);
-      if ( !timehasunits )
+      if ( !time_has_units )
 	{
 	  taxisDefTunit(taxisID, TUNIT_DAY);
 	  streamptr->tsteps[0].taxis.unit = TUNIT_DAY;
@@ -45713,6 +46324,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
     case FILETYPE_GRB:
     case FILETYPE_GRB2:
       {
+        /* FIXME: return value not inspected */
         status = grbDefRecord(streamptr);
 	break;
       }
@@ -45720,6 +46332,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
 #if  defined  (HAVE_LIBSERVICE)
     case FILETYPE_SRV:
       {
+        /* FIXME: return value not inspected */
         status = srvDefRecord(streamptr);
 	break;
       }
@@ -45727,6 +46340,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
 #if  defined  (HAVE_LIBEXTRA)
     case FILETYPE_EXT:
       {
+        /* FIXME: return value not inspected */
         status = extDefRecord(streamptr);
 	break;
       }
@@ -45734,6 +46348,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
 #if  defined  (HAVE_LIBIEG)
     case FILETYPE_IEG:
       {
+        /* FIXME: return value not inspected */
         status = iegDefRecord(streamptr);
 	break;
       }
@@ -45781,6 +46396,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
     case FILETYPE_GRB:
     case FILETYPE_GRB2:
       {
+        /* FIXME: return value not inspected */
         status = grbReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -45788,6 +46404,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
 #if  defined  (HAVE_LIBSERVICE)
     case FILETYPE_SRV:
       {
+        /* FIXME: return value not inspected */
         status = srvReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -45795,6 +46412,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
 #if  defined  (HAVE_LIBEXTRA)
     case FILETYPE_EXT:
       {
+        /* FIXME: return value not inspected */
         status = extReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -45802,6 +46420,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
 #if  defined  (HAVE_LIBIEG)
     case FILETYPE_IEG:
       {
+        /* FIXME: return value not inspected */
         status = iegReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -45812,6 +46431,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
     case FILETYPE_NC4:
     case FILETYPE_NC4C:
       {
+        /* FIXME: return value not inspected */
 	status = cdfReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -45921,6 +46541,28 @@ void streamCopyRecord(int streamID2, int streamID1)
 
   if ( filetype1 == filetype2 ) filetype = filetype2;
   else
+    {
+      switch (filetype1)
+        {
+        case FILETYPE_NC:
+        case FILETYPE_NC2:
+        case FILETYPE_NC4:
+        case FILETYPE_NC4C:
+          switch (filetype2)
+            {
+            case FILETYPE_NC:
+            case FILETYPE_NC2:
+            case FILETYPE_NC4:
+            case FILETYPE_NC4C:
+              Warning("Streams have different file types (%s -> %s)!", strfiletype(filetype1), strfiletype(filetype2));
+              filetype = filetype2;
+              break;
+            }
+          break;
+        }
+    }
+
+  if ( filetype == CDI_UNDEFID )
     Error("Streams have different file types (%s -> %s)!", strfiletype(filetype1), strfiletype(filetype2));
 
   switch (filetype)
@@ -45929,6 +46571,7 @@ void streamCopyRecord(int streamID2, int streamID1)
     case FILETYPE_GRB:
     case FILETYPE_GRB2:
       {
+        /* FIXME: return value not inspected */
 	status = grbCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -45936,6 +46579,7 @@ void streamCopyRecord(int streamID2, int streamID1)
 #if  defined  (HAVE_LIBSERVICE)
     case FILETYPE_SRV:
       {
+        /* FIXME: return value not inspected */
 	status = srvCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -45943,6 +46587,7 @@ void streamCopyRecord(int streamID2, int streamID1)
 #if  defined  (HAVE_LIBEXTRA)
     case FILETYPE_EXT:
       {
+        /* FIXME: return value not inspected */
 	status = extCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -45950,6 +46595,7 @@ void streamCopyRecord(int streamID2, int streamID1)
 #if  defined  (HAVE_LIBIEG)
     case FILETYPE_IEG:
       {
+        /* FIXME: return value not inspected */
 	status = iegCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -45960,6 +46606,7 @@ void streamCopyRecord(int streamID2, int streamID1)
     case FILETYPE_NC4:
     case FILETYPE_NC4C:
       {
+        /* FIXME: return value not inspected */
 	status = cdfCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -46159,13 +46806,10 @@ void cdiCreateTimesteps(stream_t *streamptr)
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/time.h>  // gettimeofday()
 #include <fcntl.h>
-/*
-size_t getpagesize(void);
-*/
 
-#ifdef USE_MPI
-#endif
+
 
 #if ! defined (O_BINARY)
 #define O_BINARY 0
@@ -46256,6 +46900,7 @@ typedef struct
   off_t      bufferStart;
   off_t      bufferEnd;
   size_t     bufferCnt;
+  double     time_in_sec;
 }
 bfile_t;
 
@@ -46270,7 +46915,7 @@ enum F_I_L_E_Flags
   };
 
 
-static int FileInfo = FALSE;
+static int FileInfo  = FALSE;
 
 
 #if ! defined (MIN_BUF_SIZE)
@@ -46444,6 +47089,7 @@ void file_init_entry(bfile_t *fileptr)
   fileptr->bufferPos     = 0;
   fileptr->bufferCnt     = 0;
   fileptr->bufferPtr     = NULL;
+  fileptr->time_in_sec   = 0.0;
 }
 
 static
@@ -46493,13 +47139,22 @@ const char *fileLibraryVersion(void)
 static
 int pagesize(void)
 {
-#if defined (HAVE_MMAP)
-  return ((int) getpagesize());
+#if defined(_SC_PAGESIZE)
+  return ((int) sysconf(_SC_PAGESIZE));
 #else
   return ((int) POSIXIO_DEFAULT_PAGESIZE);
 #endif
 }
 
+static
+double file_time()
+{
+  double tseconds = 0.0;
+  struct timeval mytime;
+  gettimeofday(&mytime, NULL);
+  tseconds = (double) mytime.tv_sec + (double) mytime.tv_usec*1.0e-6;
+  return (tseconds);
+}
 
 void fileDebug(int debug)
 {
@@ -46899,7 +47554,7 @@ void file_initialize(void)
   if ( FILE_Debug )
     Message("FILE_MAX = %d", _file_max);
 
-  FileInfo = (int) file_getenv("FILE_INFO");
+  FileInfo  = (int) file_getenv("FILE_INFO");
 
   value  = file_getenv("FILE_BUFSIZE");
   if ( value >= 0 ) FileBufferSizeEnv = value;
@@ -47235,6 +47890,14 @@ void fileSetBufferSize(int fileID, long buffersize)
  */
 int fileOpen(const char *filename, const char *mode)
 {
+  int (*myFileOpen)(const char *filename, const char *mode)
+    = (int (*)(const char *, const char *))
+    namespaceSwitchGet(NSSWITCH_FILE_OPEN).func;
+  return myFileOpen(filename, mode);
+}
+
+int fileOpen_serial(const char *filename, const char *mode)
+{
   FILE *fp = NULL;    /* file pointer    (used for write) */
   int fd = -1;        /* file descriptor (used for read)  */
   int fileID = FILE_UNDEFID;
@@ -47242,11 +47905,6 @@ int fileOpen(const char *filename, const char *mode)
   struct stat filestat;
   bfile_t *fileptr = NULL;
 
-#ifdef USE_MPI
-  if ( mode[0] == 'w' && commInqIOMode () != PIO_NONE )
-      return pioFileOpenW ( filename );
-#endif
-
   FILE_INIT();
 
   fmode = tolower((int) mode[0]);
@@ -47331,19 +47989,19 @@ int fileOpen(const char *filename, const char *mode)
  */
 int fileClose(int fileID)
 {
+  int (*myFileClose)(int fileID)
+    = (int (*)(int))namespaceSwitchGet(NSSWITCH_FILE_CLOSE).func;
+  return myFileClose(fileID);
+}
+
+int fileClose_serial(int fileID)
+{
   char *name;
   int ret;
   char *fbtname[] = {"unknown", "standard", "mmap"};
   char *ftname[] = {"unknown", "open", "fopen"};
-  bfile_t *fileptr;
-
-  fileptr = file_to_pointer(fileID);
-
-#ifdef USE_MPI
-  if (((fileptr && fileptr->mode == 'w') || !fileptr)
-      && commInqIOMode () != PIO_NONE )
-    return pioFileClose ( fileID );
-#endif
+  bfile_t *fileptr = file_to_pointer(fileID);
+  double rout = 0;
 
   if ( fileptr == NULL )
     {
@@ -47392,6 +48050,15 @@ int fileClose(int fileID)
 	  fprintf(stderr, " bytes transfered : %ld\n", (long) fileptr->byteTrans);
 	}
 
+      if ( fileptr->time_in_sec > 0 )
+        {
+          rout = fileptr->byteTrans;
+          rout /= 1024.*1014.*fileptr->time_in_sec;
+        }
+
+      fprintf(stderr, " wall time [s]    : %.2f\n", fileptr->time_in_sec);
+      fprintf(stderr, " data rate [MB/s] : %.1f\n", rout);
+
       fprintf(stderr, " file access      : %ld\n", fileptr->access);
       if ( fileptr->mode == 'r' && fileptr->type == FILE_TYPE_OPEN )
 	{
@@ -47400,9 +48067,7 @@ int fileClose(int fileID)
 	}
       fprintf(stderr, " buffer size      : %lu\n", (unsigned long) fileptr->bufferSize);
       fprintf(stderr, " block size       : %lu\n", (unsigned long) fileptr->blockSize);
-#if defined (HAVE_MMAP)
       fprintf(stderr, " page size        : %d\n",  pagesize());
-#endif
       fprintf(stderr, "--------------------------------------------\n");
     }
 
@@ -47530,6 +48195,10 @@ size_t fileRead(int fileID, void *restrict ptr, size_t size)
 
   if ( fileptr )
     {
+      double t_begin = 0.0;
+
+      if ( FileInfo ) t_begin = file_time();
+
       if ( fileptr->type == FILE_TYPE_OPEN )
 	nread = file_read_from_buffer(fileptr, ptr, size);
       else
@@ -47544,6 +48213,8 @@ size_t fileRead(int fileID, void *restrict ptr, size_t size)
 	    }
 	}
 
+      if ( FileInfo ) fileptr->time_in_sec += file_time() - t_begin;
+
       fileptr->position  += nread;
       fileptr->byteTrans += nread;
       fileptr->access++;
@@ -47564,13 +48235,19 @@ size_t fileWrite(int fileID, const void *restrict ptr, size_t size)
 
   if ( fileptr )
     {
+      double t_begin = 0.0;
+
       /* if ( fileptr->buffer == NULL ) file_set_buffer(fileptr); */
 
+      if ( FileInfo ) t_begin = file_time();
+
       if ( fileptr->type == FILE_TYPE_FOPEN )
         nwrite = fwrite(ptr, 1, size, fileptr->fp);
       else
         nwrite =  write(fileptr->fd, ptr, size);
 
+      if ( FileInfo ) fileptr->time_in_sec += file_time() - t_begin;
+
       fileptr->position  += nwrite;
       fileptr->byteTrans += nwrite;
       fileptr->access++;
@@ -47588,9 +48265,9 @@ size_t fileWrite(int fileID, const void *restrict ptr, size_t size)
  * End:
  */
 
-/* Automatically generated by m214003 at 2013-06-27, do not edit */
+/* Automatically generated by m214003 at 2013-10-09, do not edit */
 
-/* CGRIBEXLIB_VERSION="1.6.1" */
+/* CGRIBEXLIB_VERSION="1.6.2" */
 
 #ifdef _ARCH_PWR6
 #pragma options nostrict
@@ -47946,7 +48623,7 @@ void  gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
 #include <math.h>
 
 
-const double const _pow2tab[158] = {
+const double _pow2tab[158] = {
  /* pow(2.0,  0.0) */  1.0,
  /* pow(2.0,  1.0) */  2.0,
  /* pow(2.0,  2.0) */  4.0,
@@ -48108,7 +48785,7 @@ const double const _pow2tab[158] = {
 };
 
 
-const double const _pow16tab[71] = {
+const double _pow16tab[71] = {
  /* pow(16.0,  0.0) */  1.0,
  /* pow(16.0,  1.0) */  16.0,
  /* pow(16.0,  2.0) */  256.0,
@@ -48213,11 +48890,52 @@ double intpow2(int x)
   else
     return (pow(2.0, (double) x));
 }
+/* 
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL minmax_val.c
+ result on bailung (gcc 4.7):
+  orig    : fmin: -500000  fmax: 499999  time:   4.84s
+  sse2    : fmin: -500000  fmax: 499999  time:   4.82s
+
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL minmax_val.c
+ result on thunder5 (gcc 4.7.2):
+  orig    : fmin: -500000  fmax: 499999  time:   3.10s
+  avx     : fmin: -500000  fmax: 499999  time:   2.84s
+
+icc -g -Wall -O3 -march=native -std=c99 -vec-report=1 -DTEST_MINMAXVAL minmax_val.c
+ result on thunder5 (icc 13.1.2):
+  orig    : fmin: -500000  fmax: 499999  time:   2.83s
+  avx     : fmin: -500000  fmax: 499999  time:   2.92s
+
+xlc_r -g -O3 -qhot -q64 -qarch=auto -qtune=auto -qreport -DTEST_MINMAXVAL minmax_val.c
+ result on blizzard (xlc 12):
+  orig    : fmin: -500000  fmax: 499999  time:   7.26s
+  pwr6u6  : fmin: -500000  fmax: 499999  time:   5.92s
+*/
+#if defined(_ARCH_PWR6)
+#pragma options nostrict
+#endif
+
+#include <stdlib.h>
+
 //#undef _GET_X86_COUNTER
 //#undef _GET_IBM_COUNTER
 //#undef _GET_MACH_COUNTER
 //#undef _ARCH_PWR6
 
+#if defined(_GET_IBM_COUNTER)
+#include <libhpc.h>
+#elif defined(_GET_X86_COUNTER)
+#include <x86intrin.h>
+#elif defined(_GET_MACH_COUNTER)
+#include <mach/mach_time.h>
+#endif
+
+#if   defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
+#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 4)
+#define GNUC_PUSH_POP
+#endif
+#endif
+
 #if   defined(__GNUC__) && (__GNUC__ >= 4)
 #elif defined(__ICC)    && (__ICC >= 1100)
 #elif defined(__clang__)
@@ -48225,38 +48943,40 @@ double intpow2(int x)
 #define DISABLE_SIMD
 #endif
 
-#if defined _GET_IBM_COUNTER
-#include <libhpc.h>
-#elif defined _GET_X86_COUNTER
-#include <x86intrin.h>
-#elif defined _GET_MACH_COUNTER
-#include <mach/mach_time.h>
+#if !defined(TEST_MINMAXVAL)
+#define DISABLE_SIMD
 #endif
 
-//#define DISABLE_SIMD
-
-#ifdef DISABLE_SIMD
-#ifndef ENABLE_AVX
-#undef __AVX__
-#endif
-#ifndef ENABLE_SSE2
-#undef __SSE2__
+#if defined(DISABLE_SIMD)
+# if defined(ENABLE_AVX)
+#  define _ENABLE_AVX
+# endif
+# if defined(ENABLE_SSE2)
+#  define _ENABLE_SSE2
+# endif
 #endif
+
+#if !defined(DISABLE_SIMD)
+# if defined(__AVX__)
+#  define _ENABLE_AVX
+# endif
+# if defined(__SSE2__)
+#  define _ENABLE_SSE2
+# endif
 #endif
 
-#if defined __AVX__
 #include <float.h>
 #include <stdint.h>
 #include <inttypes.h>
+
+#if defined(_ENABLE_AVX)
 #include <immintrin.h>
-#elif defined __SSE2__
-#include <float.h>
-#include <stdint.h>
-#include <inttypes.h>
+#elif defined(_ENABLE_SSE2)
 #include <emmintrin.h>
 #endif
 
-#if defined __AVX__
+
+#if defined(_ENABLE_AVX)
 
 static
 void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max)
@@ -48350,7 +49070,7 @@ void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, dou
   return;
 }
 
-#elif defined __SSE2__
+#elif defined(_ENABLE_SSE2)
 
 static
 void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max)
@@ -48427,43 +49147,17 @@ void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, do
   return;
 }
 
-#endif
+#endif // SIMD
 
+#if defined(_ARCH_PWR6)
 static
-void minmax_val(const double *restrict data, long idatasize, double *fmin, double *fmax)
+void pwr6_minmax_val_unrolled6(const double *restrict data, long idatasize, double *fmin, double *fmax)
 {
-#if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER 
-  uint64_t start_minmax, end_minmax;
-#endif
-  size_t datasize = idatasize;
-
-  if ( idatasize < 1 ) return;
-
-#ifdef _GET_X86_COUNTER 
-  start_minmax = _rdtsc();
-#endif
-#ifdef _GET_MACH_COUNTER 
-  start_minmax = mach_absolute_time();
-#endif
-
-#if defined __AVX__
-
-  avx_minmax_val(data, datasize, fmin, fmax);
-
-#elif defined __SSE2__
-
-  sse2_minmax_val(data, datasize, fmin, fmax);
-
-#else
-
-#ifdef _ARCH_PWR6
 #define __UNROLL_DEPTH_1 6
+  size_t datasize = idatasize;
 
   // to allow pipelining we have to unroll 
 
-#ifdef _GET_IBM_COUNTER 
-  hpmStart(1, "minmax fsel");
-#endif
   {
     size_t i, j;
     size_t residual =  datasize % __UNROLL_DEPTH_1;
@@ -48498,7 +49192,87 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
 	*fmax = __fsel(dmax[j] - *fmax, dmax[j], *fmax);
       }
   }
-#ifdef _GET_IBM_COUNTER 
+#undef __UNROLL_DEPTH_1
+}
+#endif
+
+#if defined(TEST_MINMAXVAL) && defined(__GNUC__)
+static
+void minmax_val_orig(const double *restrict data, long idatasize, double *fmin, double *fmax) __attribute__ ((noinline));
+#endif
+
+#if defined(GNUC_PUSH_POP)
+#pragma GCC push_options
+#pragma GCC optimize ("O3", "fast-math")
+#endif
+static
+void minmax_val_orig(const double *restrict data, long idatasize, double *fmin, double *fmax)
+{
+  size_t i;
+  size_t datasize = idatasize;
+  double dmin = *fmin, dmax = *fmax;
+
+#if   defined(CRAY)
+#pragma _CRI ivdep
+#elif defined(SX)
+#pragma vdir nodep
+#elif defined(__uxp__)
+#pragma loop novrec
+#endif
+  for ( i = 0; i < datasize; ++i )
+    {
+      dmin = dmin < data[i] ? dmin : data[i];
+      dmax = dmax > data[i] ? dmax : data[i];
+      //      if ( dmin > data[i] ) dmin = data[i];
+      //      if ( dmax < data[i] ) dmax = data[i];
+    }
+
+  *fmin = dmin;
+  *fmax = dmax;
+}
+#if defined(GNUC_PUSH_POP)
+#pragma GCC pop_options
+#endif
+
+static
+void minmax_val(const double *restrict data, long idatasize, double *fmin, double *fmax)
+{
+#if defined(_GET_X86_COUNTER) || defined(_GET_MACH_COUNTER) 
+  uint64_t start_minmax, end_minmax;
+#endif
+  size_t datasize = idatasize;
+
+  if ( idatasize < 1 ) return;
+
+#if defined(_GET_X86_COUNTER) 
+  start_minmax = _rdtsc();
+#endif
+#if defined(_GET_MACH_COUNTER) 
+  start_minmax = mach_absolute_time();
+#endif
+
+#if defined(_ENABLE_AVX)
+
+  avx_minmax_val(data, datasize, fmin, fmax);
+
+#elif defined(_ENABLE_SSE2)
+
+  sse2_minmax_val(data, datasize, fmin, fmax);
+
+#else
+
+#if defined(_ARCH_PWR6)
+#define __UNROLL_DEPTH_1 6
+
+  // to allow pipelining we have to unroll 
+
+#if defined(_GET_IBM_COUNTER)
+  hpmStart(1, "minmax fsel");
+#endif
+
+  pwr6_minmax_val_unrolled6(data, datasize, fmin, fmax);
+
+#if defined(_GET_IBM_COUNTER) 
   hpmStop(1);
 #endif
 
@@ -48506,65 +49280,182 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
 
 #else // original loop
 
-#ifdef _GET_IBM_COUNTER 
+#if defined(_GET_IBM_COUNTER) 
   hpmStart(1, "minmax base");
 #endif
-  {
-    size_t i;
 
-#if   defined (CRAY)
-#pragma _CRI ivdep
-#elif defined (SX)
-#pragma vdir nodep
-#elif defined (__uxp__)
-#pragma loop novrec
-#endif
-    for ( i = 0; i < datasize; ++i )
-      {
-	if ( *fmin > data[i] ) *fmin = data[i];
-	if ( *fmax < data[i] ) *fmax = data[i];
-	/*
-	 *fmin = *fmin < data[i] ? *fmin : data[i];
-	 *fmax = *fmax > data[i] ? *fmax : data[i];
-	 */
-      }
-  }
-#ifdef _GET_IBM_COUNTER 
+  minmax_val_orig(data, datasize, fmin, fmax);
+
+#if defined(_GET_IBM_COUNTER) 
   hpmStop(1);
 #endif
 
 #endif // _ARCH_PWR6 && original loop
 #endif // SIMD
 
-#if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER
-#ifdef _GET_X86_COUNTER 
+#if defined(_GET_X86_COUNTER) || defined(_GET_MACH_COUNTER)
+#if defined(_GET_X86_COUNTER) 
   end_minmax = _rdtsc();
 #endif
-#ifdef _GET_MACH_COUNTER 
+#if defined(_GET_MACH_COUNTER) 
   end_minmax = mach_absolute_time();
 #endif
-#if defined __AVX__
-  printf("AVX minmax cycles:: %" PRIu64 "\n", 
-	 end_minmax-start_minmax);
+#if defined(_ENABLE_AVX)
+  printf("AVX minmax cycles:: %" PRIu64 "\n",  end_minmax-start_minmax);
   fprintf (stderr, "AVX min: %lf max: %lf\n", *fmin, *fmax);
-#elif defined __SSE2__
-  printf("SSE2 minmax cycles:: %" PRIu64 "\n", 
-	 end_minmax-start_minmax);
+#elif defined(_ENABLE_SSE2)
+  printf("SSE2 minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
   fprintf (stderr, "SSE2 min: %lf max: %lf\n", *fmin, *fmax);
 #else
-  printf("loop minmax cycles:: %" PRIu64 "\n", 
-	 end_minmax-start_minmax);
+  printf("loop minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
   fprintf (stderr, "loop min: %lf max: %lf\n", *fmin, *fmax);
 #endif
 #endif
 
   return;
 }
+
+#if defined(TEST_MINMAXVAL)
+
+#include <stdio.h>
+#include <sys/time.h>
+
+static
+double dtime()
+{
+  double tseconds = 0.0;
+  struct timeval mytime;
+  gettimeofday(&mytime, NULL);
+  tseconds = (double) (mytime.tv_sec + (double)mytime.tv_usec*1.0e-6);
+  return (tseconds);
+}
+
+#define NRUN 10000
+
+int main(void)
+{
+  long datasize = 1000000;
+  double *data = NULL;
+  double fmin, fmax;
+  double t_begin, t_end;
+
+#if   defined(__ICC)
+  printf("icc\n");
+#elif defined(__clang__)
+  printf("clang\n");
+#elif defined(__GNUC__)
+  printf("gcc\n");
+#endif
+
+  data = (double *) malloc(datasize*sizeof(double));
+
+  for ( long i = datasize-1; i >= 0; i-- ) data[i] = (double) (-datasize/2 + i);
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      minmax_val(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("minmax_val: fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      minmax_val_orig(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("orig      : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+
+#if defined(_ENABLE_AVX)
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      avx_minmax_val(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("avx       : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+#elif defined(_ENABLE_SSE2)
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      sse2_minmax_val(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("sse2      : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+#endif
+#if defined(_ARCH_PWR6)
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      pwr6_minmax_val_unrolled6(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("pwr6u6  : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+#endif
+
+  return (0);
+}
+#endif // TEST_MINMAXVAL
+
+#undef DISABLE_SIMD
+#undef _ENABLE_AVX
+#undef _ENABLE_SSE2
+#undef GNUC_PUSH_POP
+/* 
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL encode_double_array.c
+ result on bailung (gcc 4.7):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 8.4166s
+  sse41   : val1: 1  val2: 1  val3: 2  valn: 66  time: 7.1522s
+
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL encode_double_array.c
+ result on thunder5 (gcc 4.7):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 6.21976s
+  avx     : val1: 1  val2: 1  val3: 2  valn: 66  time: 4.54485s
+
+icc -g -Wall -O3 -march=native -std=c99 -vec-report=1 -DTEST_MINMAXVAL encode_double_array.c
+ result on thunder5 (icc 13.2):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 14.6279s
+  avx     : val1: 1  val2: 1  val3: 2  valn: 66  time:  4.9776s
+
+xlc_r -g -O3 -qhot -q64 -qarch=auto -qtune=auto -qreport -DTEST_MINMAXVAL encode_double_array.c
+ result on blizzard (xlc 12):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 132.25s
+  unrolled: val1: 1  val2: 1  val3: 2  valn: 66  time:  27.202s
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 106.627s  // without -qhot
+  unrolled: val1: 1  val2: 1  val3: 2  valn: 66  time:  39.929s  // without -qhot
+*/
+#ifdef _ARCH_PWR6
+#pragma options nostrict
+#endif
+
+#ifdef TEST_MINMAXVAL
+#include <stdio.h>
+#include <stdlib.h>
+#define  GRIBPACK     unsigned char
+#define  IS_BIGENDIAN()  (u_byteorder.c[sizeof(long) - 1])
+#define  U_BYTEORDER     static union {unsigned long l; unsigned char c[sizeof(long)];} u_byteorder = {1}
+#define  Error(x,y)
+#endif
+
 //#undef _GET_X86_COUNTER
 //#undef _GET_MACH_COUNTER
 //#undef _GET_IBM_COUNTER
 //#undef _ARCH_PWR6
 
+#if defined _GET_IBM_COUNTER
+#include <libhpc.h>
+#elif defined _GET_X86_COUNTER
+#include <x86intrin.h>
+#elif defined _GET_MACH_COUNTER
+#include <mach/mach_time.h>
+#endif
+
 #include <stdint.h>
 
 #if   defined(__GNUC__) && (__GNUC__ >= 4)
@@ -48574,32 +49465,33 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
 #define DISABLE_SIMD
 #endif
 
-#if defined _GET_IBM_COUNTER
-#include <libhpc.h>
-#elif defined _GET_X86_COUNTER
-#include <x86intrin.h>
-#elif defined _GET_MACH_COUNTER
-#include <mach/mach_time.h>
-#endif
-
 //#define DISABLE_SIMD
 
 #ifdef DISABLE_SIMD
-#ifndef ENABLE_AVX
-#undef __AVX__
-#endif
-#ifndef ENABLE_SSE4_1
-#undef __SSE4_1__
+# ifdef ENABLE_AVX
+#  define _ENABLE_AVX
+# endif
+# ifdef ENABLE_SSE4_1
+#  define _ENABLE_SSE4_1
+# endif
 #endif
+
+#ifndef DISABLE_SIMD
+# ifdef __AVX__
+#  define _ENABLE_AVX
+# endif
+# ifdef __SSE4_1__
+#  define _ENABLE_SSE4_1
+# endif
 #endif
 
-#if defined __AVX__
+#if defined _ENABLE_AVX
 #include <immintrin.h>
-#elif defined __SSE4_1__
+#elif defined _ENABLE_SSE4_1
 #include <smmintrin.h>
 #endif
 
-#if defined __AVX__
+#if defined _ENABLE_AVX
 
 static
 void avx_encode_double_array_2byte(size_t datasize, 
@@ -48700,7 +49592,7 @@ void avx_encode_double_array_2byte(size_t datasize,
   return;
 }
 
-#elif defined __SSE4_1__
+#elif defined _ENABLE_SSE4_1
 
 static
 void sse41_encode_double_array_2byte(size_t datasize, 
@@ -48882,6 +49774,33 @@ void encode_double_array_common(int numBits, size_t packStart, size_t datasize,
 }
 
 static
+void encode_double_array_2byte(size_t datasize, GRIBPACK *restrict lGrib,
+			       const double *restrict data, double zref, double factor, size_t *gz)
+{
+  size_t i, z = *gz;
+  uint16_t ui16;
+  double tmp;
+
+#if   defined (CRAY)
+#pragma _CRI ivdep
+#elif defined (SX)
+#pragma vdir nodep
+#elif defined (__uxp__)
+#pragma loop novrec
+#endif
+  for ( i = 0; i < datasize; i++ )
+    {
+      tmp = ((data[i] - zref) * factor + 0.5);
+      ui16 = (uint16_t) tmp;
+      lGrib[z  ] = ui16 >>  8;
+      lGrib[z+1] = ui16;
+      z += 2;
+    }
+
+  *gz = z;
+}
+
+static
 void encode_double_array_byte(int numBits, size_t packStart, size_t datasize, 
 			      GRIBPACK *restrict lGrib,
 			      const double *restrict data, 
@@ -48932,33 +49851,18 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize,
   start_minmax = mach_absolute_time();
 #endif
 
-#if defined __AVX__
+#if defined _ENABLE_AVX
 
       avx_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
 
-#elif defined __SSE4_1__
+#elif defined _ENABLE_SSE4_1
 
       sse41_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
 
 #else
 
-      uint16_t ui16;
+      encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
 
-#if   defined (CRAY)
-#pragma _CRI ivdep
-#elif defined (SX)
-#pragma vdir nodep
-#elif defined (__uxp__)
-#pragma loop novrec
-#endif
-      for ( i = 0; i < datasize; i++ )
-      	{
-      	  tmp = ((data[i] - zref) * factor + 0.5);
-          ui16 = (uint16_t) tmp;
-          lGrib[z  ] = ui16 >>  8;
-          lGrib[z+1] = ui16;
-          z += 2;
-      	}
 #endif
 
 #if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER
@@ -48967,15 +49871,12 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize,
 #elif defined _GET_MACH_COUNTER 
       end_minmax = mach_absolute_time();
 #endif
-#if defined __AVX__
-      printf("AVX encoding cycles:: %" PRIu64 "\n", 
-	     end_minmax-start_minmax);
-#elif defined __SSE4_1__
-      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", 
-	     end_minmax-start_minmax);
+#if defined _ENABLE_AVX
+      printf("AVX encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
+#elif defined _ENABLE_SSE4_1
+      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
 #else
-      printf("loop encoding cycles:: %" PRIu64 "\n", 
-	     end_minmax-start_minmax);
+      printf("loop encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
 #endif  
 #endif
       
@@ -49282,6 +50183,87 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize
   *gz = z;
 #undef __UNROLL_DEPTH_2
 }
+
+#ifdef TEST_MINMAXVAL
+
+#include <sys/time.h>
+
+static
+double dtime()
+{
+  double tseconds = 0.0;
+  struct timeval mytime;
+  gettimeofday(&mytime, NULL);
+  tseconds = (double) (mytime.tv_sec + (double)mytime.tv_usec*1.0e-6);
+  return (tseconds);
+}
+
+#define NRUN 10000
+
+int main(void)
+{
+  long datasize = 1000000;
+  double *data = NULL;
+  double t_begin, t_end;
+  unsigned char *lgrib;
+
+  data = (double *) malloc(datasize*sizeof(double));
+  lgrib = (unsigned char *)  malloc(2*datasize*sizeof(unsigned char));
+
+  for ( long i = 0; i < datasize; ++i ) data[i] = (double) (-datasize/2 + i);
+
+  int PackStart = 0;
+  int nbpv = 16;
+  double zref = data[0];
+  size_t z;
+  double factor = 0.00390625;
+  int s = 256;
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      encode_double_array_2byte   (datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("orig    : val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      encode_double_array_unrolled (nbpv, PackStart, datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("unrolled: val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+
+#if defined _ENABLE_AVX
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      avx_encode_double_array_2byte   (datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("avx     : val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+#elif defined _ENABLE_SSE4_1
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      sse41_encode_double_array_2byte   (datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("sse41   : val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+#endif
+
+  return 0;
+}
+#endif // TEST_MINMAXVAL
+
+#undef DISABLE_SIMD
+#undef _ENABLE_AVX
+#undef _ENABLE_SSE4_1
 //#undef _GET_X86_COUNTER
 //#undef _GET_MACH_COUNTER
 //#undef _GET_IBM_COUNTER
@@ -49298,21 +50280,38 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
 
-/*
-#if ((__GNUC__ >= 4) || (__ICC >= 1100) || defined (__clang__))
-#define _ENABLE_SIMD
-#include <immintrin.h>
-#undef __AVX
-#ifdef __AVX__
-#define _ENABLE_AVX
-#elif __SSE4_1__
-#define _ENABLE_SSE4_1
+#if   defined(__GNUC__) && (__GNUC__ >= 4)
+#elif defined(__ICC)    && (__ICC >= 1100)
+#elif defined(__clang__)
+#else
+#define DISABLE_SIMD
 #endif
+
+#define DISABLE_SIMD
+
+#ifdef DISABLE_SIMD
+# ifdef ENABLE_AVX
+#  define _ENABLE_AVX
+# endif
+# ifdef ENABLE_SSE4_1
+#  define _ENABLE_SSE4_1
+# endif
 #endif
-*/
 
-#undef _ENABLE_AVX
-#undef _ENABLE_SSE4_1
+#ifndef DISABLE_SIMD
+# ifdef __AVX__
+#  define _ENABLE_AVX
+# endif
+# ifdef __SSE4_1__
+#  define _ENABLE_SSE4_1
+# endif
+#endif
+
+#if defined _ENABLE_AVX
+#include <immintrin.h>
+#elif defined _ENABLE_SSE4_1
+#include <smmintrin.h>
+#endif
 
 #if defined _ENABLE_AVX
 
@@ -49689,14 +50688,11 @@ void decode_double_array_byte(const unsigned char * restrict igrib, long jlend,
       end_decode = mach_absolute_time();
 #endif
 #if defined _ENABLE_AVX
-      printf("AVX encoding cycles:: %" PRIu64 "\n", 
-	     end_decode-start_decode);
+      printf("AVX encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
 #elif defined _ENABLE_SSE4_1
-      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", 
-	     end_decode-start_decode);
+      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
 #else
-      printf("loop encoding cycles:: %" PRIu64 "\n", 
-	     end_decode-start_decode);
+      printf("loop encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
 #endif  
 #endif
       
@@ -49740,6 +50736,10 @@ void decode_double_array_unrolled(const unsigned char * restrict igrib, long jle
   decode_double_array_byte(igrib, jlend, numBits, fmin, zscale, fpdata);
 }
 
+#undef DISABLE_SIMD
+#undef _ENABLE_AVX
+#undef _ENABLE_SSE4_1
+
 #define  NINT(x)  ((x) < 0 ? (int)((x)-.5) : (int)((x)+.5))
 
 
@@ -49816,7 +50816,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
   int iexp, isign;
   int iround;
   // extern int CGRIBEX_Debug;
-  extern const double const _pow16tab[71];
+  extern const double _pow16tab[71];
 
   /* ----------------------------------------------------------------- */
   /*   Section 1 . Initialise                                          */
@@ -50063,7 +51063,7 @@ double decfp2(int kexp, int kmant)
   double pval;
   int iexp, isign;
   //extern int CGRIBEX_Debug;
-  extern const double const _pow16tab[71];
+  extern const double _pow16tab[71];
   
   /* ----------------------------------------------------------------- */
   /*   Section 1 . Convert value of 0.0. Ignore sign bit.              */
@@ -50605,8 +51605,8 @@ void gribPrintSec1(int *isec0, int *isec1)
     Section 1 . Print local DWD information.
     -----------------------------------------------------------------
   */
-  if ( (isec1[ 1] == 78 && isec1[36] == 253) ||
-       (isec1[ 1] == 78 && isec1[36] == 254) )
+  if ( (ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250) &&
+       (isec1[36] == 253     || isec1[36] == 254) )
     {
       fprintf(grprsm, " DWD local usage identifier.          %9d\n", isec1[36]);
       if ( isec1[36] == 253 )
@@ -52025,7 +53025,6 @@ void encodeES(GRIBPACK *lGrib, long *gribLen, long bdsstart)
 #define DWD_extension_253_len 38
 #define DWD_extension_254_len 26
 #define ECMWF_extension_1_len 24
-#define MCH_extension_254_len 19
 #define MPIM_extension_1_len  18
 
 static
@@ -52035,7 +53034,7 @@ long getLocalExtLen(int *isec1)
 
   if ( ISEC1_LocalFLag )
     {
-      if ( ISEC1_CenterID == 78 ) 
+      if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 )
 	{
 	  if      ( isec1[36] == 254 ) extlen = DWD_extension_254_len;
 	  else if ( isec1[36] == 253 ) extlen = DWD_extension_253_len;
@@ -52044,10 +53043,6 @@ long getLocalExtLen(int *isec1)
         {
 	  if ( isec1[36] == 1 )   extlen = ECMWF_extension_1_len;
         }
-      else if ( ISEC1_CenterID == 215 )
-        {
-	  if ( isec1[36] == 254 ) extlen = MCH_extension_254_len;
-        }
       else if ( ISEC1_CenterID == 252 )
         {
 	  if ( isec1[36] == 1 ) extlen = MPIM_extension_1_len;
@@ -52254,30 +53249,18 @@ void encodePDS(GRIBPACK *lpds, long pdsLen, int *isec1)
 
   if ( ISEC1_LocalFLag )
     {
-      if ( ISEC1_CenterID == 78 ) 
+      if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 )
 	{
-	  if ( isec1[36] == 254 ) 
-	    {
-	      encodePDS_DWD_local_Extension_254(lGrib, &z, isec1);
-	    }
-	  else if ( isec1[36] == 253 )
-	    { 
-	      encodePDS_DWD_local_Extension_253(lGrib, &z, isec1);
-	    }
+	  if      ( isec1[36] == 254 ) encodePDS_DWD_local_Extension_254(lGrib, &z, isec1);
+	  else if ( isec1[36] == 253 ) encodePDS_DWD_local_Extension_253(lGrib, &z, isec1);
 	}
       else if ( ISEC1_CenterID == 98 )
 	{
-	  if ( isec1[36] == 1 )
-	    {
-	      encodePDS_ECMWF_local_Extension_1(lGrib, &z, isec1);
-	    }
+	  if ( isec1[36] == 1 ) encodePDS_ECMWF_local_Extension_1(lGrib, &z, isec1);
 	}
       else if ( ISEC1_CenterID == 252 )
 	{
-	  if ( isec1[36] == 1 )
-	    {
-	      encodePDS_MPIM_local_Extension_1(lGrib, &z, isec1);
-	    }
+	  if ( isec1[36] == 1 ) encodePDS_MPIM_local_Extension_1(lGrib, &z, isec1);
 	}
       else
 	{
@@ -52544,7 +53527,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
   double jpepsln = 1.0e-12;     /* -----> tolerance used to check equality     */
                                 /*        of floating point numbers - needed   */
 		                /*        on some platforms (eg vpp700, linux) */
-  extern const double const _pow2tab[158];
+  extern const double _pow2tab[158];
   extern int CGRIBEX_Const;         /* 1: Don't pack constant fields on regular grids */
 
   if ( isec2 )
@@ -52640,7 +53623,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
 
   fmin = fmax = data[PackStart];
 
-  minmax_val(data+PackStart+1, datasize-PackStart-1, &fmin, &fmax);
+  minmax_val(data+PackStart, datasize-PackStart, &fmin, &fmax);
 
   zref = fmin;
 
@@ -53147,7 +54130,7 @@ int decodePDS(unsigned char *pds, int *isec0, int *isec1)
 	{
 	  ISEC1_LocalFLag = 1;
 
-	  if ( ISEC1_CenterID == 78 )
+	  if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 )
 	    {
 	      if ( pds[40] == 254 ) 
 		{
@@ -53589,6 +54572,16 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
 	  locnd += 4*ioff;  /* RealCoef */
 	}
     }
+  else
+    {
+      if ( lcomplex )
+	{
+	  *iret = 1999;
+	  gprintf(__func__, " Second order packed grids unsupported!");
+	  gprintf(__func__, " Return code =  %d", *iret);
+	  return (0);
+	}
+    }
 
   /* Decode data values to floating point and store in fsec4.  */
   /* First calculate the number of data values.                */
@@ -54007,10 +55000,12 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
 	{
 	  *iret = -801;
 	}
+      //printf("nlat %d  nlon %d \n", nlat, nlon);
+      //printf("nvalues %d %d\n", nvalues, ISEC4_NumValues);
 
       if ( dfunc == 'R' && *iret == -801 )
-	  gprintf(__func__, "Number of values (%d) and sum of lons per row (%d) differ, abort conversion to regular grid!",
-		  ISEC4_NumValues, nvalues);
+	gprintf(__func__, "Number of values (%d) and sum of lons per row (%d) differ, abort conversion to regular Gaussian grid!",
+		ISEC4_NumValues, nvalues);
       
       if ( dfunc == 'R' && *iret != -801 )
 	{
@@ -54023,8 +55018,7 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
 	    ((ISEC1_Parameter == 27) || (ISEC1_Parameter == 28) || 
 	     (ISEC1_Parameter == 29) || (ISEC1_Parameter == 30));
 	      
-	  (void) qu2reg3(fsec4, ISEC2_RowLonPtr, nlat, nlon, FSEC3_MissVal, iret,
-			 lsect3, lperio, lveggy);
+	  (void) qu2reg3(fsec4, ISEC2_RowLonPtr, nlat, nlon, FSEC3_MissVal, iret, lsect3, lperio, lveggy);
 	      
 	  if ( bitmapSize > 0 )
 	    {
@@ -58099,7 +59093,7 @@ int  gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
 
   return (gribLen);
 }
-static const char grb_libvers[] = "1.6.1" " of ""Jun 27 2013"" ""15:38:33";
+static const char grb_libvers[] = "1.6.2" " of ""Oct  9 2013"" ""11:03:55";
 const char *
 cgribexLibraryVersion(void)
 {
@@ -58788,13 +59782,67 @@ void cdfClose(int fileID)
 #include <stdlib.h>
 #include <stdio.h>
 
-
 static int nNamespaces = 1;
 static int activeNamespace = 0;
-static int serialHLF = 1;
-static int * hasLocalFiles = &serialHLF;
-static int serialRS = STAGE_DEFINITION;
-static statusCode * resStatus = (statusCode *) &serialRS;
+
+#ifdef HAVE_LIBNETCDF
+#define CDI_NETCDF_SWITCHES                     \
+  { .func = (void (*)()) nc__create },          \
+  { .func = (void (*)()) cdf_def_var_serial },  \
+  { .func = (void (*)()) cdfDefTimestep },      \
+  { .func = (void (*)()) cdfDefVars }
+
+#else
+#define CDI_NETCDF_SWITCHES
+#endif
+
+#define defaultSwitches {                                   \
+    { .func = (void (*)()) cdiAbortC_serial },              \
+    { .func = (void (*)()) serializeGetSizeInCore },        \
+    { .func = (void (*)()) serializePackInCore },           \
+    { .func = (void (*)()) serializeUnpackInCore },         \
+    { .func = (void (*)()) fileOpen_serial },               \
+    { .func = (void (*)()) fileWrite },                     \
+    { .func = (void (*)()) fileClose_serial },              \
+    { .func = (void (*)()) cdiStreamOpenDefaultDelegate },  \
+    { .func = (void (*)()) cdiStreamDefVlist_ },            \
+    { .func = (void (*)()) cdiStreamWriteVar_ },            \
+    { .func = (void (*)()) cdiStreamwriteVarChunk_ },       \
+    { .data = NULL },                                       \
+    { .func = (void (*)()) cdiStreamCloseDefaultDelegate }, \
+    { .func = (void (*)()) cdiStreamDefTimestep_ }, \
+    { .func = (void (*)()) cdiStreamSync_ },                \
+    CDI_NETCDF_SWITCHES                        \
+    }
+
+struct namespace
+{
+  statusCode resStage;
+  union namespaceSwitchValue switches[NUM_NAMESPACE_SWITCH];
+} initialNamespace = {
+  .resStage = STAGE_DEFINITION,
+  .switches = defaultSwitches
+};
+
+struct namespace *namespaces = &initialNamespace;
+
+static int namespacesSize = 1;
+
+#if  defined  (HAVE_LIBPTHREAD)
+#  include <pthread.h>
+
+static pthread_mutex_t namespaceMutex = PTHREAD_MUTEX_INITIALIZER;
+
+#  define NAMESPACE_LOCK()         pthread_mutex_lock(&namespaceMutex)
+#  define NAMESPACE_UNLOCK()       pthread_mutex_unlock(&namespaceMutex)
+
+#else
+
+#  define NAMESPACE_LOCK()
+#  define NAMESPACE_UNLOCK()
+
+#endif
+
 
 enum {
   intbits = sizeof(int) * CHAR_BIT,
@@ -58810,6 +59858,7 @@ enum {
 };
 
 
+#if 0
 void namespaceShowbits ( int n, char *name )
 {
   int i;
@@ -58825,6 +59874,7 @@ void namespaceShowbits ( int n, char *name )
   bitvalues[intbits] = '\0';
   fprintf (stdout, "%s: %s\n", name, bitvalues );
 }
+#endif
 
 
 int namespaceIdxEncode ( namespaceTuple_t tin )
@@ -58850,34 +59900,74 @@ namespaceTuple_t namespaceResHDecode ( int resH )
   return tin;
 }
 
-
-void namespaceInit ( int nspn, int * argHasLocalFile )
+int
+namespaceNew()
 {
-  /* FIXME: this should not be PIO-only */
-#ifdef USE_MPI
-  int nspID;
-
-  xassert(nspn <= NUM_NAMESPACES && nspn >= 1 );
-
-  nNamespaces = nspn;
-  if ( nspn >= 1 )
+  int newNamespaceID = -1;
+  NAMESPACE_LOCK();
+  if (namespacesSize > nNamespaces)
     {
-      hasLocalFiles = xmalloc ( nspn * sizeof ( hasLocalFiles[0] ));
-      for ( nspID = 0; nspID < nspn; nspID++ )
-	hasLocalFiles[nspID] = argHasLocalFile[nspID];
-      resStatus = xmalloc ( nspn * sizeof ( resStatus[0] ));
+      /* namespace is already available and only needs reinitialization */
+      for (int i = 0; i < namespacesSize; ++i)
+        if (namespaces[i].resStage == STAGE_UNUSED)
+          {
+            newNamespaceID = i;
+            break;
+          }
     }
-#endif
+  else if (namespacesSize == 1)
+    {
+      /* make room for additional namespace */
+      struct namespace *newNameSpaces
+        = xmalloc((namespacesSize + 1) * sizeof (namespaces[0]));
+      memcpy(newNameSpaces, namespaces, sizeof (namespaces[0]));
+      namespaces = newNameSpaces;
+      ++namespacesSize;
+      newNamespaceID = 1;
+    }
+  else if (namespacesSize < NUM_NAMESPACES)
+    {
+      /* make room for additional namespace */
+      newNamespaceID = namespacesSize;
+      namespaces
+        = xrealloc(namespaces, (namespacesSize + 1) * sizeof (namespaces[0]));
+      ++namespacesSize;
+    }
+  else /* implicit: namespacesSize >= NUM_NAMESPACES */
+    {
+      NAMESPACE_UNLOCK();
+      return -1;
+    }
+  xassert(newNamespaceID >= 0 && newNamespaceID < NUM_NAMESPACES);
+  ++nNamespaces;
+  namespaces[newNamespaceID].resStage = STAGE_DEFINITION;
+  memcpy(namespaces[newNamespaceID].switches,
+         (union namespaceSwitchValue[NUM_NAMESPACE_SWITCH])defaultSwitches,
+         sizeof (namespaces[newNamespaceID].switches));
+  reshListCreate(newNamespaceID);
+  NAMESPACE_UNLOCK();
+  return newNamespaceID;
 }
 
+void
+namespaceDelete(int namespaceID)
+{
+  NAMESPACE_LOCK();
+  xassert(namespaceID < namespacesSize && nNamespaces);
+  reshListDestruct(namespaceID);
+  namespaces[namespaceID].resStage = STAGE_UNUSED;
+  --nNamespaces;
+  NAMESPACE_UNLOCK();
+}
 
 void namespaceCleanup ( void )
 {
   if ( nNamespaces > 1 )
     {
-      free ( hasLocalFiles );
-      hasLocalFiles = NULL;
-      free ( resStatus );
+      initialNamespace = namespaces[0];
+      free(namespaces);
+      namespaces = &initialNamespace;
+      nNamespaces = 1;
     }
 }
 
@@ -58890,12 +59980,9 @@ int namespaceGetNumber ()
 
 void pioNamespaceSetActive ( int nId )
 {
-  /* FIXME: this should not be PIO-only */
-#ifdef USE_MPI
-  xassert ( nId < nNamespaces && nId >= 0 );
-
+  xassert(nId < namespacesSize && nId >= 0
+          && namespaces[nId].resStage != STAGE_UNUSED);
   activeNamespace = nId;
-#endif
 }
 
 
@@ -58904,15 +59991,6 @@ int namespaceGetActive ()
   return activeNamespace;
 }
 
-
-int namespaceHasLocalFile ( int nId )
-{
-  xassert ( nId < nNamespaces && nId >= 0 );
-
-  return hasLocalFiles ? hasLocalFiles[nId] : 0;
-}
-
-
 int namespaceAdaptKey ( int key, int nspTarget )
 {
   namespaceTuple_t tin;
@@ -58950,14 +60028,40 @@ int namespaceAdaptKey2 ( int key )
 void namespaceDefResStatus ( statusCode argResStatus )
 {
   int nsp = namespaceGetActive ();
-  resStatus[nsp] = argResStatus;
+  namespaces[nsp].resStage = argResStatus;
 }
 
 
 statusCode namespaceInqResStatus ( void )
 {
   int nsp = namespaceGetActive ();
-  return resStatus[nsp];
+  return namespaces[nsp].resStage;
+}
+
+void namespaceSwitchSet(enum namespaceSwitch sw, union namespaceSwitchValue value)
+{
+  xassert(sw > NSSWITCH_NO_SUCH_SWITCH && sw < NUM_NAMESPACE_SWITCH);
+  int nsp = namespaceGetActive();
+  namespaces[nsp].switches[sw] = value;
+}
+
+union namespaceSwitchValue namespaceSwitchGet(enum namespaceSwitch sw)
+{
+  xassert(sw > NSSWITCH_NO_SUCH_SWITCH && sw < NUM_NAMESPACE_SWITCH);
+  int nsp = namespaceGetActive();
+  return namespaces[nsp].switches[sw];
+}
+
+void cdiReset(void)
+{
+  NAMESPACE_LOCK();
+  for (int namespaceID = 0; namespaceID < namespacesSize; ++namespaceID)
+    namespaceDelete(namespaceID);
+  namespaces = &initialNamespace;
+  namespacesSize = 1;
+  nNamespaces = 1;
+  activeNamespace = 0;
+  NAMESPACE_UNLOCK();
 }
 
 /*
@@ -58969,6 +60073,90 @@ statusCode namespaceInqResStatus ( void )
  * require-trailing-newline: t
  * End:
  */
+#include <inttypes.h>
+#include <limits.h>
+
+
+int
+serializeGetSize(int count, int datatype, void *context)
+{
+  int (*serialize_get_size_p)(int count, int datatype, void *context)
+    = (int (*)(int, int, void *))
+    namespaceSwitchGet(NSSWITCH_SERIALIZE_GET_SIZE).func;
+  return serialize_get_size_p(count, datatype, context);
+}
+
+void serializePack(void *data, int count, int datatype,
+                    void *buf, int buf_size, int *position, void *context)
+{
+  void (*serialize_pack_p)(void *data, int count, int datatype,
+                           void *buf, int buf_size, int *position, void *context)
+    = (void (*)(void *, int, int, void *, int, int *, void *))
+    namespaceSwitchGet(NSSWITCH_SERIALIZE_PACK).func;
+  serialize_pack_p(data, count, datatype, buf, buf_size, position, context);
+}
+
+void serializeUnpack(void *buf, int buf_size, int *position,
+                      void *data, int count, int datatype, void *context)
+{
+  void (*serialize_unpack_p)(void *buf, int buf_size, int *position,
+                             void *data, int count, int datatype, void *context)
+    = (void (*)(void *, int, int *, void *, int, int, void *))
+    namespaceSwitchGet(NSSWITCH_SERIALIZE_UNPACK).func;
+  serialize_unpack_p(buf, buf_size, position, data, count, datatype, context);
+}
+
+
+
+int
+serializeGetSizeInCore(int count, int datatype, void *context)
+{
+  int elemSize;
+  switch (datatype)
+  {
+  case DATATYPE_INT8:
+    elemSize = sizeof (int8_t);
+    break;
+  case DATATYPE_INT16:
+    elemSize = sizeof (int16_t);
+    break;
+  case DATATYPE_INT:
+    elemSize = sizeof (int);
+    break;
+  case DATATYPE_FLT64:
+    elemSize = sizeof (double);
+    break;
+  case DATATYPE_TXT:
+  case DATATYPE_UCHAR:
+    elemSize = 1;
+    break;
+  default:
+    xabort("Unexpected datatype");
+  }
+  return count * elemSize;
+}
+
+void serializePackInCore(void *data, int count, int datatype,
+                          void *buf, int buf_size, int *position, void *context)
+{
+  int size = serializeGetSize(count, datatype, context);
+  int pos = *position;
+  xassert(INT_MAX - pos >= size);
+  memcpy((unsigned char *)buf + pos, data, (size_t)size);
+  pos += size;
+  *position = pos;
+}
+
+void serializeUnpackInCore(void *buf, int buf_size, int *position,
+                            void *data, int count, int datatype, void *context)
+{
+  int size = serializeGetSize(count, datatype, context);
+  int pos = *position;
+  xassert(INT_MAX - pos >= size);
+  memcpy(data, (unsigned char *)buf + pos, (size_t)size);
+  pos += size;
+  *position = pos;
+}
 #if defined (HAVE_CONFIG_H)
 #endif
 
@@ -58980,14 +60168,8 @@ statusCode namespaceInqResStatus ( void )
 #include <stdio.h>
 
 
-#ifdef USE_MPI
-#endif
-
-
 enum { MIN_LIST_SIZE = 128 };
 
-static int *listSizeAllocated;
-
 static void listInitialize(void);
 
 // ATTENTION: not thread safe yet, namespaces are set in model!
@@ -59021,106 +60203,103 @@ static int listInit = 0;
 
 typedef struct listElem {
   cdiResH       resH;//idx
-  struct listElem * next;
+  int next;
   resOps      * ops;
   void        * val;//ptr
   int           status;
 } listElem_t;
 
+static struct
+{
+  int size, freeHead;
+  listElem_t *resources;
+} *resHList;
 
-static listElem_t **listResources;
-static listElem_t **freeListHead;
+static int resHListSize = 0;
 
 /**************************************************************/
 
-static
-void listNew ( void )
+static void
+listInitResources(int nsp)
 {
-  int nnsp, i;
-
-  nnsp = namespaceGetNumber ();
+  xassert(nsp < resHListSize && nsp >= 0);
+  int size = resHList[nsp].size = MIN_LIST_SIZE;
+  xassert(resHList[nsp].resources == NULL);
+  resHList[nsp].resources = xcalloc(MIN_LIST_SIZE, sizeof (listElem_t));
+  listElem_t *p = resHList[nsp].resources;
 
-  listSizeAllocated = xcalloc ( nnsp, sizeof( listSizeAllocated[0]));
-  listResources     = xcalloc ( nnsp, sizeof( listResources[0]));
-  freeListHead      = xcalloc ( nnsp, sizeof( freeListHead[0]));
-
-  for ( i = 0; i < nnsp; i++ )
+  for (int i = 0; i < size; i++ )
     {
-      listSizeAllocated[i] = MIN_LIST_SIZE;
+      p[i].resH   = namespaceIdxEncode2(nsp, i);
+      p[i].next   = i + 1;
+      p[i].ops    = NULL;
+      p[i].val    = NULL;
+      p[i].status = RESH_UNDEFID;
+    }
 
-      xassert ( listResources[i] == NULL);
+  p[resHList[nsp].size-1].next = -1;
+  resHList[nsp].freeHead = 0;
+}
+
+static inline void
+reshListClearEntry(int i)
+{
+  resHList[i].size = 0;
+  resHList[i].resources = NULL;
+  resHList[i].freeHead = -1;
+}
 
-      listResources[i] = xcalloc ( listSizeAllocated[i], sizeof ( listElem_t ));
+void
+reshListCreate(int namespaceID)
+{
+  LIST_LOCK();
+  if (resHListSize <= namespaceID)
+    {
+      resHList = xrealloc(resHList, (namespaceID + 1) * sizeof (resHList[0]));
+      for (int i = resHListSize; i <= namespaceID; ++i)
+        reshListClearEntry(i);
+      resHListSize = namespaceID + 1;
     }
+  listInitResources(namespaceID);
+  LIST_UNLOCK();
 }
 
+
 /**************************************************************/
 
-static
-void listInitPointer ( void )
+void
+reshListDestruct(int namespaceID)
 {
-  int nnsp, i, j;
-
-  nnsp = namespaceGetNumber ();
-
-  for ( i = 0; i < nnsp; i++ )
+  LIST_LOCK();
+  xassert(resHList && namespaceID >= 0 && namespaceID < resHListSize);
+  int callerNamespaceID = namespaceGetActive();
+  pioNamespaceSetActive(namespaceID);
+  if (resHList[namespaceID].resources)
     {
-      for ( j = 0; j < listSizeAllocated[i]; j++ )
+      for ( int j = 0; j < resHList[namespaceID].size; j++ )
         {
-          listResources[i][j].resH   = namespaceIdxEncode2 ( i, j );
-          listResources[i][j].next   = listResources[i] + j + 1;
-          listResources[i][j].ops    = NULL;
-          listResources[i][j].val    = NULL;
-          listResources[i][j].status = RESH_UNDEFID;
+          listElem_t *listElem = resHList[namespaceID].resources + j;
+          if (listElem->val)
+            listElem->ops->valDestroy(listElem->val);
         }
-
-      listResources[i][listSizeAllocated[i]-1].next = NULL;
-
-      freeListHead[i] = listResources[i];
+      free(resHList[namespaceID].resources);
+      reshListClearEntry(namespaceID);
     }
+  if (resHList[callerNamespaceID].resources)
+    pioNamespaceSetActive(callerNamespaceID);
+  LIST_UNLOCK();
 }
 
-/**************************************************************/
 
-static
-void listDestroy ( void )
+static void listDestroy ( void )
 {
-  listElem_t * listElem;
-  int i, j, nnsp;
-
-  if ( listResources )
-    {
-      nnsp = namespaceGetNumber ();
-      for ( i = 0; i < nnsp; i++ )
-	{
-	  pioNamespaceSetActive ( i );
-          if ( listResources[i] )
-            {
-              if ( listSizeAllocated )
-                for ( j = 0; j < listSizeAllocated[i]; j++ )
-                  {
-                    listElem = listResources[i] + j;
-                    if  ( listElem->val )
-                      listElem->ops->valDestroy ( listElem->val );
-                  }
-              free ( listResources[i] );
-              listResources[i] = NULL;
-            }
-	}
-      free ( listResources );
-      listResources = NULL;
-    }
-
-  if ( freeListHead )
-    {
-      free ( freeListHead );
-      freeListHead = NULL;
-    }
-  if ( listSizeAllocated )
-    {
-      free ( listSizeAllocated );
-      listSizeAllocated = NULL;
-    }
+  LIST_LOCK();
+  for (int i = 0; i < resHListSize; ++i)
+    if (resHList[i].resources)
+      namespaceDelete(i);
+  free(resHList);
+  resHList = NULL;
+  LIST_UNLOCK();
 }
 
 /**************************************************************/
@@ -59136,24 +60315,18 @@ void listInitialize ( void )
   pthread_mutex_init ( &listMutex, &ma);
   pthread_mutexattr_destroy(&ma);
 #endif
-
-  listNew ();
+  // create default namespace
+  reshListCreate(0);
   /* file is special and has its own table, which needs to be
    * created, before we register the listDestroy exit handler */
   {
     int null_id;
-    null_id = fileOpen("/dev/null", "r");
+    null_id = fileOpen_serial("/dev/null", "r");
     if (null_id != -1)
-      fileClose(null_id);
+      fileClose_serial(null_id);
   }
   atexit ( listDestroy );
 
-  LIST_LOCK();
-
-  listInitPointer ();
-
-  LIST_UNLOCK();
-
 }
 
 /**************************************************************/
@@ -59161,28 +60334,26 @@ void listInitialize ( void )
 static
 void listSizeExtend()
 {
-  int newListSize;
-  int i, nsp;
-
-  nsp = namespaceGetActive ();
-
-  newListSize = listSizeAllocated[nsp] + MIN_LIST_SIZE;
+  int nsp = namespaceGetActive ();
+  int oldSize = resHList[nsp].size;
+  int newListSize = oldSize + MIN_LIST_SIZE;
 
-  listResources[nsp] =
-    xrealloc(listResources[nsp], newListSize * sizeof (listResources[0][0]));
+  resHList[nsp].resources =
+    xrealloc(resHList[nsp].resources,
+             newListSize * sizeof (resHList[0].resources[0]));
 
-  for ( i = listSizeAllocated[nsp]; i < newListSize; ++i )
+  for (int i = oldSize; i < newListSize; ++i)
     {
-      listResources[nsp][i].resH   = namespaceIdxEncode2 ( nsp, i );
-      listResources[nsp][i].next   = listResources[nsp] + i + 1;
-      listResources[nsp][i].ops    = NULL;
-      listResources[nsp][i].val    = NULL;
-      listResources[nsp][i].status = RESH_UNDEFID;
+      resHList[nsp].resources[i].resH   = namespaceIdxEncode2 ( nsp, i );
+      resHList[nsp].resources[i].next   = i + 1;
+      resHList[nsp].resources[i].ops    = NULL;
+      resHList[nsp].resources[i].val    = NULL;
+      resHList[nsp].resources[i].status = RESH_UNDEFID;
     }
 
-  listResources[nsp][newListSize-1].next = freeListHead[nsp];
-  freeListHead[nsp] = listResources[nsp] + listSizeAllocated[nsp];
-  listSizeAllocated[nsp] = newListSize;
+  resHList[nsp].resources[newListSize-1].next = resHList[nsp].freeHead;
+  resHList[nsp].freeHead = oldSize;
+  resHList[nsp].size = newListSize;
 }
 
 /**************************************************************/
@@ -59200,10 +60371,10 @@ int reshPut ( void *p, resOps *ops )
 
   nsp = namespaceGetActive ();
 
-  if ( !freeListHead[nsp] ) listSizeExtend();
-  newListElem               = freeListHead[nsp];
-  freeListHead[nsp]         = freeListHead[nsp]->next;
-  newListElem->next         = NULL;
+  if ( resHList[nsp].freeHead == -1) listSizeExtend();
+  newListElem               = resHList[nsp].resources + resHList[nsp].freeHead;
+  resHList[nsp].freeHead    = newListElem->next;
+  newListElem->next         = -1;
   resH                      = newListElem->resH;
   newListElem->val          = p;
   newListElem->ops          = ops;
@@ -59231,27 +60402,27 @@ void reshRemove ( cdiResH resH, resOps * ops )
 
   xassert ( nspT.nsp == nsp &&
             nspT.idx >= 0 &&
-            nspT.idx < listSizeAllocated[nsp] &&
-            listResources[nsp][nspT.idx].ops &&
-            listResources[nsp][nspT.idx].ops == ops );
+            nspT.idx < resHList[nsp].size &&
+            resHList[nsp].resources[nspT.idx].ops &&
+            resHList[nsp].resources[nspT.idx].ops == ops );
 
-  listResources[nsp][nspT.idx].next   = freeListHead[nsp];
-  listResources[nsp][nspT.idx].ops    = NULL;
-  listResources[nsp][nspT.idx].val    = NULL;
-  listResources[nsp][nspT.idx].status = RESH_UNDEFID;
-  freeListHead[nsp]                   = listResources[nsp] + nspT.idx;
+  resHList[nsp].resources[nspT.idx].next   = resHList[nsp].freeHead;
+  resHList[nsp].resources[nspT.idx].ops    = NULL;
+  resHList[nsp].resources[nspT.idx].val    = NULL;
+  resHList[nsp].resources[nspT.idx].status = RESH_UNDEFID;
+  resHList[nsp].freeHead                   = nspT.idx;
 
   LIST_UNLOCK();
 }
 
 /**************************************************************/
 
-void *reshGetValue(const char * caller, cdiResH resH, resOps * ops)
+static listElem_t *
+reshGetElem(const char *caller, cdiResH resH, resOps *ops)
 {
+  listElem_t *listElem;
   int nsp;
   namespaceTuple_t nspT;
-  listElem_t * listElem;
-
   xassert ( ops );
 
   LIST_INIT();
@@ -59262,22 +60433,30 @@ void *reshGetValue(const char * caller, cdiResH resH, resOps * ops)
 
   nspT = namespaceResHDecode ( resH );
 
-  if ( nspT.nsp == nsp &&
-       nspT.idx >= 0 && nspT.idx < listSizeAllocated[nsp] )
+  if (nspT.nsp == nsp &&
+      nspT.idx >= 0 &&
+      nspT.idx < resHList[nsp].size)
     {
-      listElem = listResources[nsp] + nspT.idx;
+      listElem = resHList[nsp].resources + nspT.idx;
       LIST_UNLOCK();
     }
   else
     {
       LIST_UNLOCK();
-      xabortC(caller, "Invalid namespace %d or index %d for resource handle %d!", nspT.nsp, nspT.idx, (int)resH);
+      xabortC(caller, "Invalid namespace %d or index %d for resource handle %d when using namespace %d of size %d!",
+              nspT.nsp, nspT.idx, (int)resH, nsp, resHList[nsp].size);
     }
 
   if ( !(listElem && listElem->ops == ops) )
-    xabortC(caller, "Invalid resource handle %d, list element not found!", (int)resH);
+    xabortC(caller, "Invalid resource handle %d, list element not found!",
+            (int)resH);
+  return listElem;
+}
+
 
-  return listElem->val;
+void *reshGetValue(const char * caller, cdiResH resH, resOps * ops)
+{
+  return reshGetElem(caller, resH, ops)->val;
 }
 
 /**************************************************************/
@@ -59294,9 +60473,9 @@ void reshGetResHListOfType ( int c, int * resHs, resOps * ops )
 
   nsp = namespaceGetActive ();
 
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val && listResources[nsp][i].ops )
-      if ( listResources[nsp][i].ops == ops )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val && resHList[nsp].resources[i].ops )
+      if ( resHList[nsp].resources[i].ops == ops )
         {
           resHs[j++] = namespaceIdxEncode2 ( nsp, i );
           if ( j == c ) break;
@@ -59305,6 +60484,52 @@ void reshGetResHListOfType ( int c, int * resHs, resOps * ops )
   LIST_UNLOCK();
 }
 
+enum cdiApplyRet
+cdiResHApply(enum cdiApplyRet (*func)(int id, void *res, const resOps *p,
+                                      void *data), void *data)
+{
+  xassert(func);
+
+  LIST_INIT();
+
+  LIST_LOCK();
+
+  int nsp = namespaceGetActive ();
+  enum cdiApplyRet ret = CDI_APPLY_GO_ON;
+  for (int i = 0; i < resHList[nsp].size && ret > 0; ++i)
+    if (resHList[nsp].resources[i].val && resHList[nsp].resources[i].ops)
+      ret = func(namespaceIdxEncode2(nsp, i), resHList[nsp].resources[i].val,
+                 resHList[nsp].resources[i].ops, data);
+  LIST_UNLOCK();
+  return ret;
+}
+
+
+enum cdiApplyRet
+cdiResHFilterApply(const resOps *p,
+                   enum cdiApplyRet (*func)(int id, void *res, void *data),
+                   void *data)
+{
+  xassert(p && func);
+
+  LIST_INIT();
+
+  LIST_LOCK();
+
+  int nsp = namespaceGetActive ();
+  enum cdiApplyRet ret = CDI_APPLY_GO_ON;
+  for (int i = 0; i < resHList[nsp].size && ret > 0; ++i)
+    if (resHList[nsp].resources[i].val && resHList[nsp].resources[i].ops
+        && resHList[nsp].resources[i].ops == p)
+      ret = func(namespaceIdxEncode2(nsp, i), resHList[nsp].resources[i].val,
+                 data);
+  LIST_UNLOCK();
+  return ret;
+}
+
+
+
+
 /**************************************************************/
 
 int reshCountType ( resOps * ops )
@@ -59319,9 +60544,9 @@ int reshCountType ( resOps * ops )
 
   nsp = namespaceGetActive ();
 
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val )
-      if ( listResources[nsp][i].ops == ops )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val )
+      if ( resHList[nsp].resources[i].ops == ops )
         countType++;
 
   LIST_UNLOCK();
@@ -59331,32 +60556,43 @@ int reshCountType ( resOps * ops )
 
 /**************************************************************/
 
-#ifdef USE_MPI
-static
-int  getPackBufferSize ( MPI_Comm comm )
+int
+reshResourceGetPackSize(int resH, resOps *ops, void *context)
+{
+  listElem_t *curr = reshGetElem(__func__, resH, ops);
+  return curr->ops->valGetPackSize(curr->val, context);
+}
+
+void
+reshPackResource(int resH, resOps *ops,
+                 void *buf, int buf_size, int *position, void *context)
+{
+  listElem_t *curr = reshGetElem(__func__, resH, ops);
+  curr->ops->valPack(curr->val, buf, buf_size, position, context);
+}
+
+
+static int getPackBufferSize(void *context)
 {
   int nsp, i;
-  int packBufferSize = 0;
-  int intpacksize;
+  int intpacksize, packBufferSize = 0;
   listElem_t * curr;
 
   nsp = namespaceGetActive ();
 
-  xmpi ( MPI_Pack_size ( 1, MPI_INT, comm, &intpacksize ));
-
   /* pack start marker, namespace and sererator marker */
-  packBufferSize += 3 * intpacksize;
+  packBufferSize += (intpacksize = serializeGetSize(3, DATATYPE_INT, context));
 
   /* pack resources, type marker and seperator marker */
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val )
-      if ( listResources[nsp][i].status == ASSIGNED )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val )
+      if ( resHList[nsp].resources[i].status == ASSIGNED )
         {
-          curr = listResources[nsp] + i;
+          curr = resHList[nsp].resources + i;
           xassert ( curr->ops );
 
           /* message plus frame of 2 ints */
-          packBufferSize += curr->ops->valGetPackSize ( curr->val, comm )
+          packBufferSize += curr->ops->valGetPackSize(curr->val, context)
             + 2 * intpacksize;
         }
 
@@ -59375,9 +60611,9 @@ void reshPackBufferDestroy ( char ** buffer )
 
 /**************************************************************/
 
-void reshPackBufferCreate ( char ** packBuffer, int * packBufferSize, MPI_Comm comm )
+void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
 {
-  int i, nsp, packBufferPos = 0;
+  int i, packBufferPos = 0;
   int start = START, end = END, sep = SEPARATOR, type;
   listElem_t * curr;
 
@@ -59385,54 +60621,42 @@ void reshPackBufferCreate ( char ** packBuffer, int * packBufferSize, MPI_Comm c
 
   LIST_LOCK();
 
-  nsp = namespaceGetActive ();
-
-  * packBufferSize = getPackBufferSize ( comm );
-  * packBuffer = xcalloc ( 1, * packBufferSize );
-
-  xmpi ( MPI_Pack ( &start, 1,  MPI_INT,
-		    * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  int nsp = namespaceGetActive ();
 
-  xmpi ( MPI_Pack ( &nsp, 1,  MPI_INT,
-		    * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  int pBSize = *packBufferSize = getPackBufferSize(context);
+  char *pB = *packBuffer = xcalloc(1, *packBufferSize);
 
-  xmpi ( MPI_Pack ( &sep, 1,  MPI_INT,
-		    * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  {
+    int header[3] = { start, nsp, sep };
+    serializePack(header, 3,  DATATYPE_INT, pB, pBSize, &packBufferPos, context);
+  }
 
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val )
-      if ( listResources[nsp][i].status == ASSIGNED )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val )
+      if ( resHList[nsp].resources[i].status == ASSIGNED )
         {
-          curr = listResources[nsp] + i;
+          curr = resHList[nsp].resources + i;
           xassert ( curr->ops );
 
           type = curr->ops->valTxCode ();
 
           if ( ! type ) continue;
 
-          xmpi ( MPI_Pack ( &type, 1, MPI_INT, * packBuffer,
-			    * packBufferSize, &packBufferPos, comm ));
+          serializePack( &type, 1, DATATYPE_INT, * packBuffer,
+			    * packBufferSize, &packBufferPos, context);
 
-          curr->ops->valPack ( curr->val,
-                               * packBuffer ,
-                               * packBufferSize,
-                               &packBufferPos,
-                               comm );
+          curr->ops->valPack(curr->val, pB, pBSize, &packBufferPos, context);
 
-          xmpi ( MPI_Pack ( &sep, 1,  MPI_INT, * packBuffer,
-			    * packBufferSize, &packBufferPos, comm ));
+          serializePack(&sep, 1, DATATYPE_INT, pB, pBSize, &packBufferPos, context);
 
           curr->status = CLOSED;
         }
 
   LIST_UNLOCK();
 
-  xmpi ( MPI_Pack ( &end, 1,  MPI_INT,
-                  * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  serializePack(&end, 1,  DATATYPE_INT, pB, pBSize, &packBufferPos, context);
 }
 
-#endif
-
 /**************************************************************/
 
 /* for thread safety this feature would have to be integrated in reshPut */
@@ -59455,9 +60679,9 @@ void reshSetStatus ( cdiResH resH, resOps * ops, int status )
 
   xassert ( nspT.nsp == nsp &&
             nspT.idx >= 0 &&
-            nspT.idx < listSizeAllocated[nsp] );
+            nspT.idx < resHList[nsp].size );
 
-  listElem = listResources[nsp] + nspT.idx;
+  listElem = resHList[nsp].resources + nspT.idx;
 
   xassert ( listElem &&
             listElem->ops == ops );
@@ -59487,9 +60711,9 @@ int reshGetStatus ( cdiResH resH, resOps * ops )
 
   xassert ( nspT.nsp == nsp &&
             nspT.idx >= 0 &&
-            nspT.idx < listSizeAllocated[nsp] );
+            nspT.idx < resHList[nsp].size );
 
-  listElem = listResources[nsp] + nspT.idx;
+  listElem = resHList[nsp].resources + nspT.idx;
 
   LIST_UNLOCK();
 
@@ -59517,99 +60741,80 @@ void reshUnlock ()
 
 int reshListCompare ( int nsp0, int nsp1 )
 {
-  const int equal  = 0;
-#ifdef USE_MPI
-  const int differ = -1;
-  int i, valCompare;
-  listElem_t * listElem0, * listElem1;
+  int valCompare = 0;
+  int i;
 
 
   LIST_INIT();
+  LIST_LOCK();
 
-  xassert(namespaceGetNumber () > xmaxInt ( nsp0, nsp1 ) &&
+  xassert(resHListSize > xmaxInt ( nsp0, nsp1 ) &&
           xminInt ( nsp0, nsp1 ) >= 0 );
 
-  for ( i = 0; i < listSizeAllocated[nsp0]; i++ )
+  for ( i = 0; i < resHList[nsp0].size; i++ )
     {
-      listElem0 = listResources[nsp0] + i;
+      listElem_t *listElem0 = resHList[nsp0].resources + i,
+        *listElem1 = resHList[nsp1].resources + i;
       if ( listElem0->val )
 	{
-	  if ( i >= listSizeAllocated[nsp1] )
+	  if ( i >= resHList[nsp1].size )
 	    {
-	      xdebug("%s", "");
-	      return differ;
+              valCompare = 1;
+	      xdebug("%s %d", "namespace active length mismatch at resource",
+                     i);
+	      break;
 	    }
 
-	  listElem1 = listResources[nsp1] + i;
 	  if ( !listElem1->val )
 	    {
-	      xdebug("%s", "");
-	      return differ;
+              valCompare = 1;
+	      xdebug("%s %d", "namespace occupation mismatch at resource", i);
+              break;
 	    }
 
-	  xassert ( listElem0->ops && listElem1->ops );
-	  if ( listElem0->ops != listElem1->ops )
+	  if ( listElem0->ops != listElem1->ops || listElem0->ops == NULL )
 	    {
-	      xdebug("%s", "");
-	      return differ;
+              valCompare = 1;
+	      xdebug("%s %d", "resource type mismatch at resource", i);
+              break;
 	    }
 
-	  valCompare =  listElem0->ops->valCompare ( listElem0->val, listElem1->val );
-	  printf ( "type %d, values resH0=%d and resH1=%d %s\n", 
-		   listElem0->ops->valTxCode (), 
-		   listElem0->resH, 
-		   listElem1->resH,
-		   valCompare == equal ? "are equal" : "differ" );
-	  if ( valCompare != equal ) return differ;
+	  valCompare = listElem0->ops->valCompare(listElem0->val,
+                                                  listElem1->val);
+          if (valCompare)
+            break;
 	}
-      else if ( listResources[nsp1][i].val )
-	return differ;
+      else if ( listElem1->val )
+        {
+          valCompare = 1;
+          xdebug("namespace 1 has value at empty place %d of namespace 0",
+                 i);
+          break;
+        }
     }
 
-  for ( ; i < listSizeAllocated[nsp1]; i++ )
-    if ( listResources[nsp1][i].val )
-      {
-	xdebug("%s", "");
-	return differ;
-      }
+  if (!valCompare)
+    {
+      for ( ; i < resHList[nsp1].size; i++ )
+        valCompare = valCompare || resHList[nsp1].resources[i].val != NULL;
+      if (valCompare)
+        xdebug("%s", "extra elements in second namespace");
+    }
 
-#endif
+  LIST_UNLOCK();
 
-  return equal;
+  return valCompare;
 }
 
 /**************************************************************/
 
-void reshListPrint ( char * filename )
+void reshListPrint(FILE *fp)
 {
   int i, j, temp;
   listElem_t * curr;
-  FILE * fp;
 
   LIST_INIT();
 
-#ifdef USE_MPI
-  {
-    int root = 0;
-    if ( commInqIsProcIO () == 0 )
-      {
-        if (  commInqRankModel () != root )  return;
-      }
-    else if ( commInqRankPio () != root ) return;
-  }
-#endif
-
-  if ( filename )
-    {
-      fp = fopen ( filename, "w" );
-      if ( ! fp )
-	{
-	  xdebug("%s", "could not open file" );
-	  fp = stdout;
-	}
-    }
-  else
-    fp = stdout;
 
   temp = namespaceGetActive ();
 
@@ -59627,11 +60832,11 @@ void reshListPrint ( char * filename )
       fprintf ( fp, "#\n" );
       fprintf ( fp, "##################################\n\n" );
 
-      fprintf ( fp, "listSizeAllocated[%d]=%d\n", i, listSizeAllocated[i] );
+      fprintf ( fp, "resHList[%d].size=%d\n", i, resHList[i].size );
 
-      for ( j = 0; j < listSizeAllocated[i]; j++ )
+      for ( j = 0; j < resHList[i].size; j++ )
         {
-          curr = listResources[i] + j;
+          curr = resHList[i].resources + j;
           if ( curr->ops && curr->val )
             {
               curr->ops->valPrint (( void * ) curr->val, fp );
@@ -59642,23 +60847,107 @@ void reshListPrint ( char * filename )
   fprintf ( fp, "#\n#  end global resource list" \
             "\n#\n##########################################\n\n" );
 
-  fclose ( fp );;
   pioNamespaceSetActive ( temp );
 }
 
 
-void cdiReset(void)
-{
-  LIST_LOCK();
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
+#ifdef HAVE_CONFIG_H
+#endif
 
-  listDestroy();
 
-  listNew ();
+extern void   gridUnpack ( char *, int, int *, int, void *context);
+extern void  zaxisUnpack ( char *, int, int *, int, void *context);
+extern int streamNint;
 
-  listInitPointer ();
 
-  LIST_UNLOCK();
+/*****************************************************************************/
+
+
+
+void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
+                         void *context)
+{
+  int token1, token2, nspTarget;
+  int unpackBufferPos = 0;
+  int numAssociations = 0, sizeAssociations = 16;
+  struct streamAssoc *associations
+    = xmalloc(sizeof (associations[0]) * sizeAssociations);
+
+  while ( unpackBufferPos < unpackBufferSize )
+    {
+      serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      &token1, 1, DATATYPE_INT, context);
+
+      if (token1 == END)
+        break;
+      switch (token1)
+	{
+	case START:
+	  serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                          &nspTarget, 1, DATATYPE_INT, context);
+	  break;
+	case GRID:
+	  gridUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                     nspTarget, context );
+	  break;
+	case ZAXIS:
+	  zaxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context);
+	  break;
+	case TAXIS:
+	  taxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context, 1);
+	  break;
+	case INSTITUTE:
+          instituteUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                          nspTarget, context);
+	  break;
+	case MODEL:
+          modelUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context);
+	  break;
+	case STREAM:
+          if (sizeAssociations == numAssociations)
+            associations
+              = xrealloc(associations,
+                         sizeof (associations[0]) * (sizeAssociations *= 2));
+	  associations[numAssociations]
+            = streamUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                           nspTarget, context);
+          ++numAssociations;
+	  break;
+	case VLIST:
+          vlistUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context);
+	  break;
+	default:
+	  xabort ( "TOKEN MAPS NO VALID DATATYPE" );
+	}
+
+      serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                       &token2, 1, DATATYPE_INT, context);
+      xassert ( token2 == SEPARATOR );
+    }
+  for (int i = 0; i < numAssociations; ++i)
+    {
+      cdiStreamSetupVlist(stream_to_pointer(associations[i].streamID),
+                          namespaceAdaptKey(associations[i].vlistID,
+                                            nspTarget),
+                          namespaceAdaptKey(associations[i].vlistIDorig,
+                                            nspTarget));
+    }
+  free(associations);
 }
+
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -59678,89 +60967,38 @@ void cdiReset(void)
 #include <string.h>
 
 
+#ifdef USE_MPI
 static
 char commands[][13] = { "FINALIZE\0",
                         "RESOURCES\0",
                         "WINCREATE\0",
                         "WRITETS\0"};
-
-
-void pcdiAssert(bool assumption,
-                const char * filename, const char * functionname, int line )
-{
-  if ( !assumption )
-    {
-#ifdef USE_MPI
-      int rank = -1, init_flag = 0;
-      if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag)
-        MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-      fprintf ( stderr, "ERROR, FALSE ASSUMPTION: PE%d in %s, %s, line %d\n",
-                rank, functionname, filename, line );
-      fflush ( stderr );
-      if (init_flag)
-        MPI_Abort ( MPI_COMM_WORLD, 1 );
-      else
-        abort();
-#else
-      fprintf ( stderr, "ERROR, FALSE ASSUMPTION, %s, %s, line %d\n",
-                functionname, filename, line );
-      fflush ( stderr );
-      abort();
 #endif
-    }
-}
 
-/****************************************************/
 
-void pcdiAbortC(const char * caller, const char * filename, const char *functionname, int line,
-                const char * errorString, ... )
-{
-  va_list ap;
-  va_start(ap, errorString);
+/*****************************************************************************/
 #ifdef USE_MPI
-  {
-    int rank;
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-    fprintf(stderr, "ERROR, pe%d in %s, %s, line %d, called from %s\nerrorString: \"",
-            rank, functionname, filename, line, caller);
-  }
-  vfprintf(stderr, errorString, ap);
-  fputs("\"\n", stderr);
-  MPI_Abort ( MPI_COMM_WORLD, 1 );
-#else
-  fprintf(stderr, "ERROR, %s, %s, line %d, called from %s\nerrorString: \"",
-          functionname, filename, line, caller);
-  vfprintf(stderr, errorString, ap);
-  fputs("\"\n", stderr);
-#endif
-  exit ( EXIT_FAILURE );
-  va_end(ap);
-}
-
-void pcdiAbort(const char * filename, const char *functionname, int line,
-               const char * errorString, ... )
+void
+cdiAbortC_MPI(const char *caller, const char *filename,
+              const char *functionname, int line,
+              const char *errorString, va_list ap)
 {
-  va_list ap;
-  va_start(ap, errorString);
-#ifdef USE_MPI
   {
-    int rank;
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-    fprintf(stderr, "ERROR, pe%d in %s, %s, line %d, errorString: \"",
-            rank, functionname, filename, line);
+    int rank = getMPICommWorldRank();
+    fprintf(stderr, "ERROR, pe%d in %s, %s, line %d%s"
+            "%s\nerrorString: \"", rank, functionname, filename, line,
+            caller?", called from ":"", caller?caller:"");
   }
   vfprintf(stderr, errorString, ap);
   fputs("\"\n", stderr);
-  MPI_Abort ( MPI_COMM_WORLD, 1 );
-#else
-  fprintf(stderr, "ERROR, %s, %s, line %d, errorString: \"",
-          functionname, filename, line);
-  vfprintf(stderr, errorString, ap);
-  fputs("\"\n", stderr);
-#endif
-  exit ( EXIT_FAILURE );
+  if (callsToMPIAreAllowed())
+    MPI_Abort(MPI_COMM_WORLD, 1);
+  else
+    abort();
+  exit(EXIT_FAILURE);
   va_end(ap);
 }
+#endif
 
 /*****************************************************************************/
 
@@ -59768,11 +61006,9 @@ void * pcdiXmalloc ( size_t size, const char *filename, const char *functionname
 		     int line )
 {
   void * value = calloc (1, size );
-
   if ( value == NULL )
-    pcdiAbort (filename, functionname, line, "malloc failed: %s",
-               strerror(errno));
-
+    cdiAbort(filename, functionname, line, "malloc failed: %s",
+             strerror(errno));
   return value;
 }
 
@@ -59780,11 +61016,9 @@ void * pcdiXcalloc ( size_t nmemb, size_t size, const char *filename,
 		     const char *functionname, int line )
 {
   void * value = calloc ( nmemb, size );
-
   if ( value == NULL )
-    pcdiAbort (filename, functionname, line, "calloc failed: %s",
-               strerror(errno) );
-
+    cdiAbort(filename, functionname, line, "calloc failed: %s",
+             strerror(errno) );
   return value;
 }
 
@@ -59792,40 +61026,30 @@ void * pcdiXrealloc ( void *p, size_t size, const char *functionname,
 		      const char *filename, int line )
 {
   void * value = realloc ( p, size );
-
   if ( value == NULL )
-    pcdiAbort(filename, functionname, line, "realloc failed: %s",
-              strerror(errno));
-
+    cdiAbort(filename, functionname, line, "realloc failed: %s",
+             strerror(errno));
   return value;
 }
 
 /***************************************************************/
 
 #ifdef USE_MPI
-void pcdiXMPI ( int iret, const char *filename, int line )
+void pcdiXMPI(int iret, const char *filename, int line)
 {
   char errorString[2][MPI_MAX_ERROR_STRING + 1];
-  int len, errorClass, rank;
-
-  if ( iret != MPI_SUCCESS )
-    {
-      MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-
-      MPI_Error_class ( iret, &errorClass );
-      MPI_Error_string ( errorClass, errorString[0], &len );
-      errorString[0][len] = '\0';
-      MPI_Error_string ( iret, errorString[1], &len);
-      errorString[1][len] = '\0';
-
-      fprintf ( stderr, "MPI ERROR, pe%d, %s, line %d,"
-                "errorClass: \"%s\""
-                "errorString: \"%s\"\n",
-                rank, filename, line,
-                errorString[0], errorString[1]);
-
-      MPI_Abort ( MPI_COMM_WORLD, iret );
-    }
+  int len, errorClass, rank = getMPICommWorldRank();
+  MPI_Error_class(iret, &errorClass);
+  MPI_Error_string(errorClass, errorString[0], &len);
+  errorString[0][len] = '\0';
+  MPI_Error_string(iret, errorString[1], &len);
+  errorString[1][len] = '\0';
+  fprintf(stderr, "MPI ERROR, pe%d, %s, line %d,"
+          "errorClass: \"%s\""
+          "errorString: \"%s\"\n",
+          rank, filename, line,
+          errorString[0], errorString[1]);
+  MPI_Abort(MPI_COMM_WORLD, iret);
 }
 
 /*****************************************************************************/
@@ -59833,9 +61057,7 @@ void pcdiXMPI ( int iret, const char *filename, int line )
 void pcdiXMPIStat ( int iret, const char *filename, int line, MPI_Status *status )
 {
   char errorString[MPI_MAX_ERROR_STRING + 1];
-  int len, rank;
-
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
+  int len, rank = getMPICommWorldRank();
 
   if ( iret == MPI_ERR_IN_STATUS )
     {
@@ -59869,15 +61091,22 @@ void pcdiXMPIStat ( int iret, const char *filename, int line, MPI_Status *status
 #ifdef USE_MPI
 void pcdiDebugComm ( const char *filename, const char *functionname, int line, MPI_Comm *comm )
 {
-  int rank, size, len, rankGlob;
+  int rank = -1, size, len, rankGlob = -1;
   char *name;
 
   name = ( char * ) xmalloc ( MPI_MAX_OBJECT_NAME );
   memset ( name, 0, ( MPI_MAX_OBJECT_NAME ) * sizeof ( char ));
   MPI_Comm_get_name ( * comm, name, &len );
   MPI_Comm_size ( * comm, &size );
-  MPI_Comm_rank ( * comm, &rank );
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rankGlob );
+  {
+    int init_flag = 0, finished_flag = 0;
+    if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag
+        && MPI_Finalized(&finished_flag) == MPI_SUCCESS && !finished_flag)
+      {
+        MPI_Comm_rank(*comm, &rank);
+        MPI_Comm_rank(MPI_COMM_WORLD, &rankGlob);
+      }
+  }
   fprintf ( stdout,
             "pe%d in %s, %s, line %d: comm: name=%s, size=%d, rank=%d\n",
             rankGlob, functionname, filename, line,
@@ -59894,9 +61123,7 @@ void pcdiDebugMsg ( const char * cdiPioDebugString, const char *filename,
                     const char *functionname, int line, int tag, int source,
                     int nfinished )
 {
-  int rank;
-
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
+  int rank = getMPICommWorldRank();
 
   fprintf ( stdout,
             "%s pe%d in %s, %s, line %d: command %s, source %d, finalized=%d\n",
@@ -59910,9 +61137,7 @@ void pcdiDebugMsg ( const char * cdiPioDebugString, const char *filename,
 void pcdiDebugMsg2 ( const char *filename, const char *functionname, int line,
                    int tag, int source, char * text )
 {
-  int rank;
-
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
+  int rank = getMPICommWorldRank();
 
   fprintf ( stdout,
             "pe%d in %s, %s, line %d: command %s, source %d, %s\n",
@@ -59968,20 +61193,16 @@ double xchecksum ( int type, int count, void * buffer )
 void printArray ( const char * cdiPioDebugString, char * ps, const void * array, int n,
                   int datatype, const char * funname, const char * filename, int line )
 {
-  int i, rank;
+  int i;
   int * iArray;
   double * dArray;
 
 #ifdef USE_MPI
   {
-    int init_flag;
-    if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag)
-      MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-    else
-      rank = -1;
+    int rank = getMPICommWorldRank();
+    fprintf ( stdout, "%s pe%d in %s, %s, line %d: %s = ",
+              cdiPioDebugString, rank, funname, filename, line, ps );
   }
-  fprintf ( stdout, "%s pe%d in %s, %s, line %d: %s = ",
-	    cdiPioDebugString, rank, funname, filename, line, ps );
 #else
   fprintf ( stdout, "%s %s, %s, line %d: %s = ",
 	    cdiPioDebugString, funname, filename, line, ps );
@@ -60008,6 +61229,36 @@ void printArray ( const char * cdiPioDebugString, char * ps, const void * array,
   return;
 }
 
+int
+cdiPioQueryVarDims(int varShape[3], int vlistID, int varID)
+{
+  int gridID = vlistInqVarGrid(vlistID, varID);
+  int zaxisID = vlistInqVarZaxis(vlistID, varID);
+  int gridType = gridInqType(gridID);
+  switch (gridType)
+    {
+    case GRID_LONLAT:
+    case GRID_GAUSSIAN:
+      varShape[0] = gridInqXsize(gridID);
+      varShape[1] = gridInqYsize(gridID);
+      break;
+    case GRID_SPECTRAL:
+      varShape[0] = 2;
+      varShape[1] = gridInqSize(gridID) / 2;
+      break;
+    case GRID_GENERIC:
+    case GRID_LCC:
+    case GRID_GME:
+    case GRID_CURVILINEAR:
+    case GRID_UNSTRUCTURED:
+      xabort("unimplemented grid type: %d", gridType);
+      break;
+    }
+  varShape[2] = zaxisInqSize(zaxisID);
+  /* FIXME: other grids have different dimensionality */
+  return (varShape[2] == 1)?2:3;
+}
+
 /****************************************************/
 /*
  * Local Variables:
@@ -60024,6 +61275,10 @@ void printArray ( const char * cdiPioDebugString, char * ps, const void * array,
 
 #ifdef USE_MPI
 
+#include <ctype.h>
+#include <yaxt.h>
+
+
 
 char * command2charP[6] = {"IO_Open_file", "IO_Close_file",
                            "IO_Get_fp","IO_Set_fp",
@@ -60069,7 +61324,8 @@ struct fileOpTag decodeFileOpTag(int tag)
 
 /***************************************************************/
 
-size_t pioFileWrite ( int fileID, int tsID, const void *buffer, size_t len )
+size_t
+cdiPioFileWrite(int fileID, const void *restrict buffer, size_t len, int tsID)
 {
   size_t iret = CDI_UNDEFID;
 
@@ -60118,10 +61374,13 @@ int pioFileClose ( int id )
 
 /***************************************************************/
 
-int pioFileOpenW ( const char *filename )
+int pioFileOpen(const char *filename, const char *mode)
 {
   int iret = CDI_UNDEFID;
 
+  if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0)
+    xabort("Unsupported mode \"%s\" in parallel file open.", mode);
+
   switch ( commInqIOMode ())
     {
     case PIO_MPI:
@@ -60221,11 +61480,19 @@ void backendFinalize ( void )
 #ifdef HAVE_CONFIG_H
 #endif
 
+#include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
 
 #ifdef USE_MPI
+#include <mpi.h>
+#include <yaxt.h>
+#endif
+
+
+#ifdef USE_MPI
+
 extern resOps streamOps;
 
 
@@ -60236,11 +61503,18 @@ static struct rdmaWin
   MPI_Win win;
   int postSet, refuseFuncCall;
   MPI_Group ioGroup;
+  int dictSize, dictDataUsed, dictRPCUsed, dict;
 } *txWin = NULL;
 
 
-char * funcMap[nFuncs] = {"streamOpen", "streamDefVlist", "streamClose" };
+const char * const funcMap[numRPCFuncs] = {
+  "streamOpen",
+  "streamDefVlist",
+  "streamClose",
+  "streamDefTimestep",
+};
 
+float cdiPIOpartInflate_;
 
 /****************************************************/
 
@@ -60284,13 +61558,14 @@ mapProblems(int problemSizes[], int * problemMapping, int nProblems,
   for ( j = 0; j < nWriter; j++ )
     meanBucket[j] = ( double ) sum * ( * ( w + j ));
 
+  memset(buckets, 0, sizeof (buckets));
+
   for ( i = 0; i < nProblems; i++ )
     {
       currCapacity = INT_MIN;
 
       for ( j = 0; j < nWriter; j++ )
 	{
-	  if ( !i ) buckets[j] = 0.0;
 	  nextCapacity = meanBucket[j] - ( buckets[j] + ( *ip[i] ));
 
 	  if ( nextCapacity > currCapacity )
@@ -60303,12 +61578,15 @@ mapProblems(int problemSizes[], int * problemMapping, int nProblems,
       buckets[writerIdx] +=  *ip[i];
     }
 
-  xprintArray3 (  "problemSizes = ", problemSizes, nProblems, DATATYPE_INT );
-  xprintArray3 ( "vector of indices, qsort of problemSizes", dummy,
-                nProblems, DATATYPE_INT );
-  xprintArray3 ( "problemMapping", problemMapping, nProblems, DATATYPE_INT );
-  xprintArray3 ( "meanBucket", meanBucket, nWriter, DATATYPE_FLT );
-  xprintArray3 ( "actual buckets", buckets, nWriter, DATATYPE_INT );
+  if ( ddebug )
+    {
+      xprintArray3 (  "problemSizes = ", problemSizes, nProblems, DATATYPE_INT );
+      xprintArray3 ( "vector of indices, qsort of problemSizes", dummy,
+                    nProblems, DATATYPE_INT );
+      xprintArray3 ( "problemMapping", problemMapping, nProblems, DATATYPE_INT );
+      xprintArray3 ( "meanBucket", meanBucket, nWriter, DATATYPE_FLT );
+      xprintArray3 ( "actual buckets", buckets, nWriter, DATATYPE_INT );
+    }
 }
 
 /****************************************************/
@@ -60428,45 +61706,12 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping,
 /************************************************************************/
 
 static void
-defVarDeco(int vlistID, int varID)
-{
-  int varSize, cRank, lChunk, rem, lOffset;
-  int nProcsModel = commInqNProcsModel ();
-  deco_t deco[nProcsModel];
-
-  varSize = vlistInqVarSize ( vlistID, varID );
-
-  for ( cRank = 0; cRank < nProcsModel; cRank++ )
-    {
-      lChunk = varSize / nProcsModel;
-      lOffset = cRank * lChunk;
-      rem = varSize % nProcsModel;
-      if ( cRank < rem )
-        {
-          lChunk++;
-          lOffset += cRank;
-        }
-      else
-        lOffset += rem;
-
-      deco[cRank].rank   = cRank;
-      deco[cRank].offset = lOffset;
-      deco[cRank].chunk  = lChunk;
-    }
-  vlistDefVarDeco ( vlistID, varID, nProcsModel, &deco[0] );
-}
-
-/************************************************************************/
-
-
-static void
 varsMapNDeco(int nNodes, int *nodeSizes)
 {
   int nStreams, nVars, * resHs, * streamSizes, * varSizes, * varMapping,
     * collectsData;
   int i, j, k = 0;
   int nProcsColl = commInqNProcsColl ();
-  char text[1024];
 
   xdebug ( "START, nProcsColl=%d", nProcsColl );
 
@@ -60497,8 +61742,6 @@ varsMapNDeco(int nNodes, int *nodeSizes)
   for ( i = 0; i < nStreams; i++ )
     for ( j = 0; j < * ( streamSizes + i ); j++ )
       {
-        defVarDeco ( streamInqVlist ( *( resHs + i )), j );
-        defVarDeco ( streamInqVlistIDorig ( * ( resHs + i )), j );
         vlistDefVarIOrank ( streamInqVlist ( * ( resHs + i )), j,
                             * ( varMapping + k ));
         vlistDefVarIOrank ( streamInqVlistIDorig ( * ( resHs + i )), j,
@@ -60508,14 +61751,10 @@ varsMapNDeco(int nNodes, int *nodeSizes)
 
   for ( j = 0; j < nProcsColl; j++ )
     if ( collectsData[j] == 0 )
-      {
-        sprintf ( text,
-                  "\nAT LEAST ONE COLLECTOR PROCESS IDLES, "
-                  "CURRENTLY NOT COVERED: "
-                  "PE%d collects no data",
-                  commCollID2RankGlob ( j ));
-        xabort ( text );
-      }
+      xabort("AT LEAST ONE COLLECTOR PROCESS IDLES, "
+             "CURRENTLY NOT COVERED: "
+             "PE%d collects no data",
+             commCollID2RankGlob(j));
 
   if ( varMapping )   free ( varMapping );
   if ( varSizes )     free ( varSizes );
@@ -60535,71 +61774,106 @@ void modelWinCleanup ( void )
 
   xdebug("%s", "START");
   if (txWin != NULL)
-    for ( collID = 0; collID < commInqNProcsColl (); collID ++ )
-      {
-        if (txWin[collID].postSet)
-          xmpi(MPI_Win_wait(txWin[collID].win));
-        xmpi(MPI_Win_free(&txWin[collID].win));
-        xmpi ( MPI_Free_mem ( txWin[collID].buffer ));
-        xmpi(MPI_Group_free(&txWin[collID].ioGroup));
-      }
-
-  if (txWin) free(txWin);
+    {
+      for ( collID = 0; collID < commInqNProcsColl (); collID ++ )
+        {
+          if (txWin[collID].postSet)
+            xmpi(MPI_Win_wait(txWin[collID].win));
+          xmpi(MPI_Win_free(&txWin[collID].win));
+          xmpi ( MPI_Free_mem ( txWin[collID].buffer ));
+          xmpi(MPI_Group_free(&txWin[collID].ioGroup));
+        }
+      free(txWin);
+    }
 
   xdebug("%s", "RETURN. CLEANED UP MPI_WIN'S");
 }
 
 /************************************************************************/
 
+struct collDesc
+{
+  int numDataRecords, numRPCRecords;
+};
+
 static void
 modelWinDefBufferSizes(void)
 {
-  int collID, nstreams, * streamIndexList, streamNo, vlistID, nvars, varID;
-  int collIDchunk = 0, sumWinBufferSize = 0;
+  int collID, nstreams, * streamIndexList, streamNo, nvars, varID;
+  int sumWinBufferSize = 0;
   int nProcsColl  = commInqNProcsColl ();
   int rankGlob    = commInqRankGlob ();
-  int rankModel   = commInqRankModel ();
   int root = commInqRootGlob ();
+  struct collDesc *collIndex;
 
   xdebug("%s", "START");
   xassert(txWin != NULL);
 
   nstreams = reshCountType ( &streamOps );
   streamIndexList = xmalloc ( nstreams * sizeof ( streamIndexList[0] ));
+  collIndex = xcalloc(nProcsColl, sizeof (collIndex[0]));
   reshGetResHListOfType ( nstreams, streamIndexList, &streamOps );
   for ( streamNo = 0; streamNo < nstreams; streamNo++ )
     {
-      // space required for data
-      vlistID = streamInqVlist ( streamIndexList[streamNo] );
+      // memory required for data
+      int streamID = streamIndexList[streamNo];
+      int vlistID = streamInqVlist(streamID);
       nvars = vlistNvars ( vlistID );
       for ( varID = 0; varID < nvars; varID++ )
         {
-          collID = CDI_UNDEFID;
-          collID = commRankGlob2CollID ( vlistInqVarIOrank ( vlistID, varID ));
-          collIDchunk = vlistInqVarDecoChunk ( vlistID, varID, rankModel );
+          int collID = commRankGlob2CollID(vlistInqVarIOrank(vlistID, varID));
+          int collIDchunk;
+          {
+            int varSize = vlistInqVarSize(vlistID, varID);
+            int nProcsModel = commInqNProcsModel();
+            collIDchunk = (int)ceilf(cdiPIOpartInflate_
+                                     * (varSize + nProcsModel - 1)/nProcsModel);
+          }
           xassert ( collID != CDI_UNDEFID && collIDchunk > 0 );
-          txWin[collID].size += collIDchunk * sizeof (double) +
-            winBufferOverheadChunk * sizeof (int);
+          collIndex[collID].numDataRecords += 2;
+          txWin[collID].size += (size_t)collIDchunk * sizeof (double)
+            /* re-align chunks to multiple of double size */
+            + sizeof (double) - 1
+            /* one header for data record, one for corresponding part
+             * descriptor*/
+            + 2 * sizeof (union winHeaderEntry)
+            /* FIXME: heuristic for size of packed Xt_idxlist */
+            + sizeof (Xt_int) * collIDchunk * 3;
         }
 
-      // space required for the 3 function calls streamOpen, streamDefVlist, streamClose
+      // memory required for the function calls encoded
+      // for remote execution
       // once per stream and timestep for all collprocs only on the modelproc root
       if ( rankGlob == root )
         for ( collID = 0; collID < nProcsColl; collID++ )
-          txWin[collID].size += 3 * winBufferOverheadFuncCall * sizeof (int)
-            + 5 * sizeof (int) + MAXDATAFILENAME;
+          {
+            collIndex[collID].numRPCRecords += numRPCFuncs;
+            txWin[collID].size +=
+              numRPCFuncs * sizeof (union winHeaderEntry)
+              + MAXDATAFILENAME
+              /* data part of streamDefTimestep */
+              + (2 * CDI_MAX_NAME + sizeof (taxis_t));
+          }
     }
-  free ( streamIndexList );
-
-  for ( collID = 0; collID < nProcsColl; collID++ )
-    {
-      txWin[collID].size += winBufferOverhead * sizeof (int);
+  for (collID = 0; collID < nProcsColl; ++collID)
+    {
+      int numRecords = 1 + collIndex[collID].numDataRecords
+        + collIndex[collID].numRPCRecords;
+      txWin[collID].dictSize = numRecords;
+      txWin[collID].dictDataUsed = 1;
+      txWin[collID].dictRPCUsed = 0;
+      /* account for size header */
+      txWin[collID].size += sizeof (union winHeaderEntry);
+      txWin[collID].size = roundUpToMultiple(txWin[collID].size,
+                                             PIO_WIN_ALIGN);
       sumWinBufferSize += txWin[collID].size;
     }
+  free(collIndex);
+  free ( streamIndexList );
+
   xdebug("sumWinBufferSize=%zu, MAXWINBUFFERSIZE=%zu", (size_t)sumWinBufferSize,
          (size_t)MAXWINBUFFERSIZE);
   xassert ( sumWinBufferSize <= MAXWINBUFFERSIZE );
-  /* xprintArray("txWin.size", txWin, nProcsColl, DATATYPE_INT); */
   xdebug("%s", "RETURN");
 }
 
@@ -60619,8 +61893,11 @@ static
             txWin[collID].size >= 0         &&
             txWin[collID].size <= MAXWINBUFFERSIZE);
   memset(txWin[collID].buffer, 0, txWin[collID].size);
-  txWin[collID].head = txWin[collID].buffer;
+  txWin[collID].head = txWin[collID].buffer
+    + txWin[collID].dictSize * sizeof (union winHeaderEntry);
   txWin[collID].refuseFuncCall = 0;
+  txWin[collID].dictDataUsed = 1;
+  txWin[collID].dictRPCUsed = 0;
 }
 
 
@@ -60646,7 +61923,8 @@ void modelWinCreate ( void )
       xmpi(MPI_Alloc_mem((MPI_Aint)txWin[collID].size, MPI_INFO_NULL,
                          &txWin[collID].buffer));
       xassert ( txWin[collID].buffer != NULL );
-      txWin[collID].head = txWin[collID].buffer;
+      txWin[collID].head = txWin[collID].buffer
+        + txWin[collID].dictSize * sizeof (union winHeaderEntry);
       xmpi(MPI_Win_create(txWin[collID].buffer, (MPI_Aint)txWin[collID].size, 1,
                           MPI_INFO_NULL, commInqCommsIO(collID),
                           &txWin[collID].win));
@@ -60660,41 +61938,88 @@ void modelWinCreate ( void )
 /************************************************************************/
 
 static void
-modelWinBufferPutAtEnd(const char * caller,
-                       int collID, const void * argBuffer, size_t size)
-{
-  /*
-    xdebug ( "collID=%d, size=%d, newBufferHead=%d, oldBufferSize=%d",
-    collID, size, txWin[collID].head - txWin[collID].buffer + size,
-    txWin[collID].size );
-  */
-  if ( txWin == NULL ||
-       argBuffer     == NULL ||
-       size           < 0    ||
-       collID         < 0    ||
-       collID        >= commInqNProcsColl () ||
-       txWin[collID].head - txWin[collID].buffer + size > txWin[collID].size)
-    xabort("caller: %s", caller);
-
-  memcpy ( txWin[collID].head, argBuffer, size );
-  txWin[collID].head += size;
+modelWinEnqueue(int collID,
+                union winHeaderEntry header, const void *data, size_t size)
+{
+  union winHeaderEntry *winDict
+    = (union winHeaderEntry *)txWin[collID].buffer;
+  int targetEntry;
+  if (header.dataRecord.streamID > 0)
+    {
+      targetEntry = (txWin[collID].dictDataUsed)++;
+      int offset = header.dataRecord.offset
+        = (int)roundUpToMultiple(txWin[collID].head - txWin[collID].buffer,
+                                 sizeof (double));
+      memcpy(txWin[collID].buffer + offset, data, size);
+      txWin[collID].head = txWin[collID].buffer + offset + size;
+    }
+  else if (header.partDesc.partDescMarker == PARTDESCMARKER)
+    {
+      targetEntry = (txWin[collID].dictDataUsed)++;
+      Xt_uid uid = header.partDesc.uid;
+      int offset = -1;
+      /* search if same uid entry has already been enqueued */
+      for (int entry = 2; entry < targetEntry; entry += 2)
+        {
+          xassert(winDict[entry].partDesc.partDescMarker
+                  == PARTDESCMARKER);
+          if (winDict[entry].partDesc.uid == uid)
+            {
+              offset = winDict[entry].partDesc.offset;
+              break;
+            }
+        }
+      if (offset == -1)
+        {
+          /* not yet used partition descriptor, serialize at
+           * current position */
+          int position = 0;
+          MPI_Comm comm = commInqCommsIO(collID);
+          header.partDesc.offset
+            = (int)(txWin[collID].head - txWin[collID].buffer);
+          size_t size = xt_idxlist_get_pack_size((Xt_idxlist)data, comm);
+          size_t remaining_size = txWin[collID].size
+            - (txWin[collID].head - txWin[collID].buffer);
+          xassert(size <= remaining_size);
+          xt_idxlist_pack((Xt_idxlist)data, txWin[collID].head,
+                          (int)remaining_size, &position, comm);
+          txWin[collID].head += position;
+        }
+      else
+        /* duplicate entries are copied only once per timestep */
+        header.partDesc.offset = offset;
+    }
+  else
+    {
+      targetEntry = txWin[collID].dictSize - ++(txWin[collID].dictRPCUsed);
+      if (header.funcCall.funcID == STREAMOPEN)
+        {
+          header.funcCall.funcArgs.newFile.offset
+            = (int)(txWin[collID].head - txWin[collID].buffer);
+          memcpy(txWin[collID].head, data, size);
+          txWin[collID].head += size;
+        }
+      else if (header.funcCall.funcID == STREAMDEFTIMESTEP)
+        {
+          header.funcCall.funcArgs.streamNewTimestep.offset
+            = (int)(txWin[collID].head - txWin[collID].buffer);
+          memcpy(txWin[collID].head, data, size);
+          txWin[collID].head += size;
+        }
+    }
+  winDict[targetEntry] = header;
 }
 
-/************************************************************************/
-
-void pioBufferData ( const int streamID, const int varID, const double *data, int nmiss )
+void
+pioBufferPartData(int streamID, int varID, const double *data,
+                  int nmiss, Xt_idxlist partDesc)
 {
-  int chunk, vlistID, collID = CDI_UNDEFID;
-  int tokenSep = SEPARATOR, tokenData = DATATOKEN;
-  size_t size;
-  int rankModel = commInqRankModel ();
+  int vlistID, collID = CDI_UNDEFID;
 
   vlistID  = streamInqVlist ( streamID );
   collID   = commRankGlob2CollID ( vlistInqVarIOrank ( vlistID, varID ));
-  chunk    = vlistInqVarDecoChunk ( vlistID, varID, rankModel );
   xassert ( collID         >= 0                    &&
             collID         <  commInqNProcsColl () &&
-            chunk          >= 0                    &&
             txWin != NULL);
 
   if (txWin[collID].postSet)
@@ -60704,166 +62029,54 @@ void pioBufferData ( const int streamID, const int varID, const double *data, in
       modelWinFlushBuffer ( collID );
     }
 
-  size = chunk * sizeof ( double ) + winBufferOverheadChunk * sizeof ( int );
-  xassert(txWin[collID].head - txWin[collID].buffer + size < txWin[collID].size);
+  Xt_int chunk = xt_idxlist_get_num_indices(partDesc);
+  xassert(chunk <= INT_MAX);
 
-  modelWinBufferPutAtEnd ( __func__, collID, &tokenData, sizeof ( tokenData ));
-  modelWinBufferPutAtEnd ( __func__, collID, &streamID , sizeof ( streamID ));
-  modelWinBufferPutAtEnd ( __func__, collID, &varID    , sizeof ( varID ));
-  modelWinBufferPutAtEnd ( __func__, collID, data      , chunk * sizeof ( double ));
-  modelWinBufferPutAtEnd ( __func__, collID, &nmiss    , sizeof ( nmiss ));
-  modelWinBufferPutAtEnd ( __func__, collID, &tokenSep , sizeof ( tokenSep ));
+  union winHeaderEntry dataHeader
+    = { .dataRecord = { streamID, varID, -1, nmiss } };
+  modelWinEnqueue(collID, dataHeader, data, chunk * sizeof (data[0]));
+  {
+    union winHeaderEntry partHeader
+      = { .partDesc = { .partDescMarker = PARTDESCMARKER,
+                        .uid = xt_idxlist_get_uid(partDesc),
+                        .offset = 0 } };
+    modelWinEnqueue(collID, partHeader, partDesc, 0);
+  }
 
   txWin[collID].refuseFuncCall = 1;
 }
 
 /************************************************************************/
 
-void pioBufferFuncCall(int funcID, int argc, ... )
+void pioBufferFuncCall(union winHeaderEntry header,
+                       const void *data, size_t data_len)
 {
-  va_list ap;
   int rankGlob = commInqRankGlob ();
   int root = commInqRootGlob ();
   int collID, nProcsColl = commInqNProcsColl ();
-  int tokenSep = SEPARATOR, tokenFuncCall = FUNCCALL;
-  size_t size = 0;
+  int funcID = header.funcCall.funcID;
 
-  xassert(funcID >= 0 && funcID < nFuncs);
-  xdebug("%s, func: %s", "START", funcMap[funcID]);
+  xassert(funcID >= MINFUNCID && funcID <= MAXFUNCID);
+  xdebug("%s, func: %s", "START", funcMap[(-1 - funcID)]);
 
   if ( rankGlob != root ) return;
 
-  xassert (argc          >= 1                    &&
-           argc          <= 2                    &&
-           txWin != NULL);
-
-  va_start ( ap, argc );
+  xassert(txWin != NULL);
 
-  switch ( funcID )
+  for (collID = 0; collID < nProcsColl; ++collID)
     {
-    case STREAMCLOSE:
-      {
-        int streamID;
-
-        xassert ( argc == 1 );
-        streamID  = va_arg ( ap, int );
-
-        for ( collID = 0; collID < nProcsColl; collID++ )
-          {
-            size = ( winBufferOverheadFuncCall + 1 ) * sizeof ( int );
-            xassert(txWin[collID].head - txWin[collID].buffer + size <
-                    txWin[collID].size);
-
-            if (txWin[collID].postSet)
-              {
-                xmpi(MPI_Win_wait(txWin[collID].win));
-                txWin[collID].postSet = 0;
-                modelWinFlushBuffer ( collID );
-              }
-
-            xassert(txWin[collID].refuseFuncCall == 0);
-
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenFuncCall,
-                                     sizeof ( tokenFuncCall));
-            modelWinBufferPutAtEnd ( __func__, collID, &funcID,
-                                     sizeof ( funcID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &streamID,
-                                     sizeof ( streamID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenSep,
-                                     sizeof ( tokenSep ));
-          }
-      xdebug ( "WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, streamID=%d",
-               funcMap[funcID], streamID );
-      }
-      break;
-    case STREAMOPEN:
-      {
-        char * filename;
-        int    filetype;
-        size_t filenamesz;
-
-        xassert ( argc == 2 );
-        filename  = va_arg ( ap, char * );
-        filenamesz = strlen ( filename );
-        xassert ( filenamesz > 0 &&
-                  filenamesz < MAXDATAFILENAME );
-        filetype  = va_arg ( ap, int );
-
-        for ( collID = 0; collID < nProcsColl; collID++ )
-          {
-            size = ( winBufferOverheadFuncCall + 2 ) * sizeof ( int ) +
-              MAXDATAFILENAME;
-            xassert(txWin[collID].head - txWin[collID].buffer + size <
-                    txWin[collID].size);
-
-            if (txWin[collID].postSet)
-              {
-                xmpi(MPI_Win_wait(txWin[collID].win));
-                txWin[collID].postSet = 0;
-                modelWinFlushBuffer ( collID );
-              }
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenFuncCall,
-                                     sizeof ( tokenFuncCall));
-            modelWinBufferPutAtEnd ( __func__, collID, &funcID,
-                                     sizeof ( funcID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &filenamesz,
-                                     sizeof ( filenamesz ));
-            modelWinBufferPutAtEnd ( __func__, collID, filename,
-                                     filenamesz );
-            modelWinBufferPutAtEnd ( __func__, collID, &filetype,
-                                     sizeof ( filetype ));
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenSep,
-                                     sizeof ( tokenSep ));
-          }
-
-        xdebug("WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, filenamesz=%zu,"
-               " filename=%s, filetype=%d",
-               funcMap[funcID], filenamesz, filename, filetype );
-      }
-      break;
-    case STREAMDEFVLIST:
-      {
-        int streamID, vlistID;
-
-        xassert ( argc == 2 );
-        streamID  = va_arg ( ap, int );
-        vlistID   = va_arg ( ap, int );
-
-        for ( collID = 0; collID < nProcsColl; collID++ )
-          {
-            size = ( winBufferOverheadFuncCall + 2 ) * sizeof ( int );
-            xassert(txWin[collID].head - txWin[collID].buffer + size <
-                    txWin[collID].size);
-
-            if (txWin[collID].postSet)
-              {
-                xmpi(MPI_Win_wait(txWin[collID].win));
-                txWin[collID].postSet = 0;
-                modelWinFlushBuffer ( collID );
-              }
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenFuncCall,
-                                     sizeof ( tokenFuncCall));
-            modelWinBufferPutAtEnd ( __func__, collID, &funcID,
-                                     sizeof ( funcID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &streamID,
-                                     sizeof ( streamID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &vlistID,
-                                     sizeof ( streamID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenSep,
-                                     sizeof ( tokenSep ));
-          }
-
-        xdebug ( "WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, streamID=%d,"
-                 " vlistID=%d",
-                 funcMap[funcID], streamID, vlistID );
-      }
-      break;
-    default:
-      xabort ( "FUNCTION NOT MAPPED!" );
+      if (txWin[collID].postSet)
+        {
+          xmpi(MPI_Win_wait(txWin[collID].win));
+          txWin[collID].postSet = 0;
+          modelWinFlushBuffer ( collID );
+        }
+      xassert(txWin[collID].dictRPCUsed + txWin[collID].dictDataUsed
+              < txWin[collID].dictSize);
+      xassert(txWin[collID].refuseFuncCall == 0);
+      modelWinEnqueue(collID, header, data, data_len);
     }
 
-  va_end ( ap );
-
   xdebug("%s", "RETURN");
 }
 
@@ -60871,30 +62084,10 @@ void pioBufferFuncCall(int funcID, int argc, ... )
 
 /*****************************************************************************/
 
-int pioInqVarDecoChunk ( int vlistID, int varID )
-{
-#ifdef USE_MPI
-   int rankModel = commInqRankModel ();
-   xassert ( rankModel != CDI_UNDEFID );
-   return vlistInqVarDecoChunk ( vlistID, varID, rankModel );
+/* pioInit definition must currently compile even in non-MPI configurations */
+#ifndef MPI_VERSION
+#  define MPI_Comm int
 #endif
-   return vlistInqVarDecoChunk ( vlistID, varID, CDI_UNDEFID );
-}
-
-/*****************************************************************************/
-
-int pioInqVarDecoOff ( int vlistID, int varID )
-{
-#ifdef USE_MPI
-   int rankModel = commInqRankModel ();
-   xassert ( rankModel != CDI_UNDEFID );
-   return vlistInqVarDecoOff ( vlistID, varID, rankModel );
-#else
-   return vlistInqVarDecoOff ( vlistID, varID, CDI_UNDEFID );
-#endif
-}
-
-/*****************************************************************************/
 /**
    @brief initializes the MPI_Communicators needed for the
   communication between the calculator PEs and the I/O PEs and within the
@@ -60912,13 +62105,22 @@ int pioInqVarDecoOff ( int vlistID, int varID )
 
   @param comm MPI_Communicator of all calling PEs
   @param nIOP number of I/O PEs
+  @param partInflate allow for array partitions on comute
+  PE that are at most sized \f$ partInflate * \lceil arraySize /
+  numComputePEs \rceil \f$
   @return int indicating wether the calling PE is a calcutator (1) or not (0)
 */
 
 #ifdef USE_MPI
-MPI_Comm pioInit_c ( MPI_Comm commGlob, int nProcsIO, int IOMode,
-                     int nNamespaces, int * hasLocalFile )
+static int pioNamespace_ = -1;
+static int xtInitByCDI = 0;
+#endif
+
+MPI_Comm
+pioInit(MPI_Comm commGlob, int nProcsIO, int IOMode,
+        int *pioNamespace, float partInflate)
 {
+#ifdef USE_MPI
   int sizeGlob;
 
   if ( IOMode < PIO_MINIOMODE || IOMode > PIO_MAXIOMODE )
@@ -60929,73 +62131,61 @@ MPI_Comm pioInit_c ( MPI_Comm commGlob, int nProcsIO, int IOMode,
     xabort ( "PIO_ASYNCH DOES NOT WORK ON SX." );
 #endif
 
+  if ((xtInitByCDI = (!xt_initialized() || xt_finalized())))
+    {
+      xt_initialize(commGlob);
+    }
   commInit ();
   commDefCommGlob ( commGlob );
   sizeGlob = commInqSizeGlob ();
 
-  if ( nProcsIO <= 0 || nProcsIO > sizeGlob - 1 )
-    xabort ( "DISTRIBUTION OF TASKS ON PROCS IS NOT VALID." );
+  if (((IOMode != PIO_NONE && (nProcsIO <= 0 || nProcsIO > sizeGlob - 1)))
+      || (IOMode == PIO_NONE && nProcsIO != 1))
+    xabort("DISTRIBUTION OF TASKS ON PROCS IS NOT VALID.\n"
+           "nProcsIO=%d, sizeGlob=%d\n", nProcsIO, sizeGlob);
 
   commDefNProcsIO ( nProcsIO );
   commDefIOMode   ( IOMode, PIO_MAXIOMODE, PIO_MINIOMODEWITHSPECIALPROCS );
   commDefCommPio  ();
 
+  xassert(partInflate >= 1.0);
+  cdiPIOpartInflate_ = partInflate;
+
   // JUST FOR TEST CASES WITH ONLY ONE MPI TASK
   if ( commInqSizeGlob () == 1 )
     {
-      namespaceInit ( nNamespaces, hasLocalFile );
+      pioNamespace_ = *pioNamespace = namespaceNew();
       return commInqCommGlob ();
     }
 
   if ( commInqIsProcIO ())
     {
+      serializeSetMPI();
+      namespaceSwitchSet(NSSWITCH_ABORT, NSSW_FUNC(cdiAbortC_MPI));
+      namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(pioFileOpen));
+      namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(pioFileClose));
       IOServer ();
+      namespaceDelete(0);
       commDestroy ();
+      xt_finalize();
       MPI_Finalize ();
       exit ( EXIT_SUCCESS );
     }
   else
-    {
-      commEvalPhysNodes ();
-      commDefCommsIO ();
-      namespaceInit ( nNamespaces, hasLocalFile );
-    }
+    cdiPioClientSetup(&pioNamespace_, pioNamespace);
 
   xdebug ( "nProcsGlob=%d, RETURN", sizeGlob );
   return commInqCommModel ();
-}
-#endif
-
-/*****************************************************************************/
-
-int pioInit ( int commGlobArg, int nProcsIO, int IOMode, int nNamespaces,
-              int * hasLocalFile )
-{
-#ifdef USE_MPI
-  xdebug("START: %s, nProcsIO=%d, IOMode=%d, nNamespaces=%d",
-         "cdi parallel",
-         nProcsIO, IOMode, nNamespaces );
 #else
-  xdebug("START: %s, nProcsIO=%d, IOMode=%d, nNamespaces=%d",
-         "cdi serial",
-         nProcsIO, IOMode, nNamespaces );
+  abort();
 #endif
+}
 
-#ifdef USE_MPI
-  MPI_Comm commGlob;
-
-  commGlob = MPI_COMM_NULL;
-  commGlob = MPI_Comm_f2c (( MPI_Fint ) commGlobArg );
-  xassert ( commGlob != MPI_COMM_NULL );
-
-  return MPI_Comm_c2f ( pioInit_c ( commGlob, nProcsIO, IOMode, nNamespaces,
-                                    hasLocalFile ));
+#ifndef MPI_VERSION
+#  undef MPI_Comm
 #endif
-  xdebug("%s", "RETURN" );
-  return 0;
-}
 
-/************************************************************************/
+/*****************************************************************************/
 
 void  pioEndDef ( void )
 {
@@ -61008,11 +62198,10 @@ void  pioEndDef ( void )
 
   varsMapNDeco ( commInqNNodes (), commInqNodeSizes ());
 
-  reshListPrint ( "reshListModel" );
-  
   if ( rankGlob < commInqNProcsColl ())
     {
-      reshPackBufferCreate ( &buffer, &bufferSize, commInqCommsIO ( rankGlob ));
+      MPI_Comm comm = commInqCommsIO ( rankGlob );
+      reshPackBufferCreate(&buffer, &bufferSize, &comm);
 
       xmpi ( MPI_Send ( buffer, bufferSize, MPI_PACKED, commInqNProcsModel (),
                         RESOURCES, commInqCommsIO ( rankGlob )));
@@ -61057,7 +62246,7 @@ void pioFinalize ( void )
 #ifdef USE_MPI
   int collID, ibuffer = 1111;
   xdebug("%s", "START");
-  namespaceCleanup ();
+  namespaceDelete(pioNamespace_);
   for ( collID = 0; collID < commInqNProcsColl (); collID++ )
     {
       xmpi ( MPI_Send ( &ibuffer, 1, MPI_INT, commInqNProcsModel (),
@@ -61066,36 +62255,31 @@ void pioFinalize ( void )
     }
   modelWinCleanup ();
   commDestroy ();
+  if (xtInitByCDI)
+    xt_finalize();
   xdebug("%s", "RETURN");
 #endif
 }
 
  /************************************************************************/
 
-void pioWriteTimestep ( int tsID, int vdate, int vtime )
+void pioWriteTimestep()
 {
 #ifdef USE_MPI
-  int collID, buffer[timestepSize], iAssert = 0;
-  int tokenEnd = END;
+  int collID, iAssert = 0;
+  /* int tokenEnd = END; */
   int rankGlob = commInqRankGlob ();
   int nProcsColl = commInqNProcsColl ();
   int nProcsModel = commInqNProcsModel ();
 
   xdebug("%s", "START");
 
-  xassert ( tsID       >= 0     &&
-            vdate      >= 0     &&
-            vtime      >= 0     &&
-            txWin != NULL);
-
-  buffer[0] = tsID;
-  buffer[1] = vdate;
-  buffer[2] = vtime;
+  xassert(txWin != NULL);
 
   if ( rankGlob < nProcsColl )
     {
-      xmpi ( MPI_Send ( &buffer[0], timestepSize, MPI_INTEGER, nProcsModel,
-                        WRITETS, commInqCommsIO ( rankGlob )));
+      xmpi(MPI_Send(NULL, 0, MPI_INT, nProcsModel,
+                    WRITETS, commInqCommsIO(rankGlob)));
       xdebug("%s", "SENT MESSAGE WITH TAG \"WRITETS\"");
     }
 
@@ -61107,17 +62291,45 @@ void pioWriteTimestep ( int tsID, int vdate, int vtime )
           txWin[collID].postSet = 0;
           modelWinFlushBuffer ( collID );
         }
-      modelWinBufferPutAtEnd ( __func__, collID, &tokenEnd, 
-                               sizeof ( tokenEnd ));
+      union winHeaderEntry header
+        = { .headerSize = { .sizeID = HEADERSIZEMARKER,
+                            .numDataEntries = txWin[collID].dictDataUsed,
+                            .numRPCEntries = txWin[collID].dictRPCUsed } };
+      union winHeaderEntry *winDict
+        = (union winHeaderEntry *)txWin[collID].buffer;
+      winDict[0] = header;
+
       xmpi(MPI_Win_post(txWin[collID].ioGroup, iAssert, txWin[collID].win));
       txWin[collID].postSet = 1;
     }
 
-  xdebug ( "RETURN. messages sent, windows posted: tsID=%d, vdate=%d, vtime=%d", 
-           tsID, vdate, vtime );
+  xdebug("%s", "RETURN. messages sent, windows posted");
 
 #endif
 }
+
+#if defined USE_MPI
+void
+streamWriteVarPart(int streamID, int varID, const void *data,
+                   int nmiss, Xt_idxlist partDesc)
+{
+  if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
+
+  check_parg(data);
+
+  void (*myStreamWriteVarPart)(int streamID, int varID, const void *data,
+                               int nmiss, Xt_idxlist partDesc)
+    = (void (*)(int, int, const void *, int, Xt_idxlist))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_PART_).func;
+
+  if (!myStreamWriteVarPart)
+    xabort("local part writing is unsupported!");
+
+  myStreamWriteVarPart(streamID, varID, data, nmiss, partDesc);
+}
+#endif
+
+
 /*
  * Local Variables:
  * c-file-style: "Java"
@@ -61387,8 +62599,8 @@ int destroyAFiledataMPINONB ( void *v )
 
   of = (aFiledataM * ) v;
 
-  xdebug ( "IOPE%d: name=%s, close file, in", 
-           rankNode, of->name );
+  xdebug ( "IOPE%d: close file %d, name=\"%s\"",
+           rankNode, of->fileID, of->name );
   
   /* close file */
 
@@ -61598,7 +62810,7 @@ int fowMPINONB ( const char *filename )
 
   xdebug("IOPE%d: name=%s, init and added aFiledataM, return id = %d",
          rankNode, filename, id);
-  
+  of->fileID = id;
   return id;
 }
 
@@ -61940,6 +63152,7 @@ void pioWriterAIO(void)
 	      bfd = initBFiledataPA(filename, buffersize, nProcsCollNode);
               if ((id = listSetAdd(bibBFiledataPA, bfd)) < 0)
                 xabort("fileID=%d not unique", rtag.id);
+              bfd->fileID = id;
 	    }
 	  else
 	    if (strcmp(filename, bfd->name) != 0)
@@ -62101,8 +63314,8 @@ typedef struct
 {
   long offset;
   bool finished;
-  bool *nfinished;
   int fileID;
+  bool nfinished[];
 } bFiledataPF;
 
 static int
@@ -62151,25 +63364,19 @@ static aFiledataPF *initAFiledataPF ( const char *key, size_t bs)
     xabort("Failed to open %s", afd->name);
 
   afd->command = IO_Open_file;
-  
   return afd;
 }
 
 /***************************************************************/
 static bFiledataPF *
-initBFiledataPF(int key, int nc)
+initBFiledataPF(int fileID, int nc)
 {
   bFiledataPF *bfd;
-  int i;
-
-  bfd = ( bFiledataPF * ) xmalloc ( sizeof ( bFiledataPF ));
-  memset ( bfd, 0, sizeof ( bFiledataPF ));
+  size_t bfdSize = sizeof (bFiledataPF) + nc * sizeof (bool);
+  bfd = xcalloc(1, bfdSize);
   bfd->offset = 0;
   bfd->finished = false;
-  bfd->nfinished = ( bool * ) xmalloc ( nc * sizeof ( bool ));
-
-  for ( i = 0; i < nc; i++ )
-    *( bfd->nfinished + i ) = true;
+  bfd->fileID = fileID;
 
   return bfd;
 }
@@ -62205,7 +63412,6 @@ destroyBFiledataPF(void *v)
   int iret = 0;
   bFiledataPF *bfd = (bFiledataPF * ) v;
   
-  free ( bfd->nfinished );
   free ( bfd );
 
   return iret;
@@ -62254,16 +63460,15 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
       	case IO_Open_file:
 
           if (!(bfd = listSetGet(bibBFiledataPF, fileIDTestB,
-                               (void *)(intptr_t)rtag.id)))
+                                 (void *)(intptr_t)rtag.id)))
 	    {
 	      bfd = initBFiledataPF(rtag.id, nProcsCollNode);
 
 	      if ((iret = listSetAdd(bibBFiledataPF, bfd)) < 0)
 		xabort("fileID=%d not unique", rtag.id);
+              bfd->fileID = iret;
 	    }
 
-	  *( bfd->nfinished + source ) = false;
-
           xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id,
                  rtag.command, command2charP[rtag.command], bfd->offset);
 	  
@@ -62282,7 +63487,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
 	case IO_Set_fp:
 
           if (!(bfd = listSetGet(bibBFiledataPF, fileIDTestB,
-                               (void *)(intptr_t)rtag.id)))
+                                 (void *)(intptr_t)rtag.id)))
             xabort("fileId=%d not in set", rtag.id);
 
           xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id,
@@ -62343,11 +63548,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
             sentFinalize[source] = true;
             doFinalize = true;
             for ( collID = 0; collID < nProcsCollNode; collID++ )
-              if ( !sentFinalize[collID] ) 
-                {
-                  doFinalize = false;
-                  break;
-                }
+              doFinalize &= sentFinalize[collID];
             if ( doFinalize )
               {
                 if (!listSetIsEmpty(bibBFiledataPF))
@@ -62547,9 +63748,20 @@ int fowPOSIXFPGUARDSENDRECV ( const char *filename )
 
   if ((id = listSetAdd(bibAFiledataPF, afd)) < 0)
     xabort("filename %s not unique", afd->name);
-
+  afd->fileID = id;
   xdebug("name=%s, init and add aFiledataPF, return id = %d",
          filename, id);
+  {
+    long offset, amount = 0L;
+    int tag = encodeFileOpTag(afd->fileID, afd->command);
+    int specialRank = commInqSpecialRankNode ();
+    MPI_Status status;
+    MPI_Comm commNode = commInqCommNode ();
+    xmpi(MPI_Sendrecv(&amount, 1, MPI_LONG, specialRank, tag,
+                      &offset, 1, MPI_LONG, specialRank, tag,
+                      commNode, &status));
+  }
+  afd->command = IO_Set_fp;
   return id;
 }
 
@@ -62797,6 +64009,7 @@ pioWriterStdIO(void)
 	      
 	      if ((id = listSetAdd(bibBFiledataP, bfd)) < 0)
                 xabort("fileID=%d not unique", rtag.id);
+              bfd->fileID = id;
 	    }
 	  else
 	    if (strcmp(filename, bfd->name) != 0)
@@ -62993,9 +64206,8 @@ listSetAdd(listSet *q, void *v)
     q->head = newCons;
 
   q->tail = newCons;
-  q->count  ++;
 
-  return 0;
+  return q->count++;
 }
 
 int
@@ -63054,7 +64266,7 @@ listSetForeach(listSet *q, void (*func)(void *elem, void *data), void *data)
  * require-trailing-newline: t
  * End:
  */
-   static char cdi_libvers[] = "1.6.1" " of ""Jun 28 2013"" ""13:11:17";
+   static char cdi_libvers[] = "1.6.2" " of ""Nov  8 2013"" ""15:47:50";
 char *cdiLibraryVersion(void);
 char *cdiLibraryVersion(void)
 {
@@ -63132,6 +64344,7 @@ char *cdiLibraryVersion(void)
 #define __CF__APOLLO67 /* __STDCPP__ is in Apollo 6.8 (i.e. ANSI) and onwards */
 #endif
 #endif
+#include <limits.h>    /* LONG_MAX */
 
 #if !defined(__GNUC__) && !defined(__sun) && (defined(sun)||defined(VAXUltrix)||defined(lynx))
 #define __CF__KnR     /* Sun, LynxOS and VAX Ultrix cc only supports K&R.     */
@@ -63312,6 +64525,18 @@ only C calling FORTRAN subroutines will work using K&R style.*/
 #endif
 #endif
 
+/* INT64_T for 8 byte integers */
+#if ! defined (LONG_MAX)
+#  error LONG_MAX undefined
+#endif
+
+#undef  INT64_T
+#if LONG_MAX > 2147483647L
+#  define INT64_T long int
+#else
+#  define INT64_T long long int       /* c.f. typedef of int64_t in <stdint.h> */
+#endif
+
 #ifdef CRAYFortran
 #ifdef _CRAY
 #include <fortran.h>
@@ -64403,20 +65628,24 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #else
 #define INTEGER_BYTE        unsigned char
 #endif
-#define    BYTEVVVVVVV_cfTYPE INTEGER_BYTE
-#define  DOUBLEVVVVVVV_cfTYPE DOUBLE_PRECISION 
-#define   FLOATVVVVVVV_cfTYPE FORTRAN_REAL
-#define     INTVVVVVVV_cfTYPE int
-#define LOGICALVVVVVVV_cfTYPE int
-#define    LONGVVVVVVV_cfTYPE long
-#define   SHORTVVVVVVV_cfTYPE short
-#define          PBYTE_cfTYPE INTEGER_BYTE
-#define        PDOUBLE_cfTYPE DOUBLE_PRECISION 
-#define         PFLOAT_cfTYPE FORTRAN_REAL
-#define           PINT_cfTYPE int
-#define       PLOGICAL_cfTYPE int
-#define          PLONG_cfTYPE long
-#define         PSHORT_cfTYPE short
+#define     BYTEVVVVVVV_cfTYPE INTEGER_BYTE
+#define   DOUBLEVVVVVVV_cfTYPE DOUBLE_PRECISION 
+#define    FLOATVVVVVVV_cfTYPE FORTRAN_REAL
+#define      INTVVVVVVV_cfTYPE int
+#define  LOGICALVVVVVVV_cfTYPE int
+#define     LONGVVVVVVV_cfTYPE long
+#define LONGLONGVVVVVVV_cfTYPE long long
+#define    INT64VVVVVVV_cfTYPE INT64_T
+#define    SHORTVVVVVVV_cfTYPE short
+#define           PBYTE_cfTYPE INTEGER_BYTE
+#define         PDOUBLE_cfTYPE DOUBLE_PRECISION 
+#define          PFLOAT_cfTYPE FORTRAN_REAL
+#define            PINT_cfTYPE int
+#define        PLOGICAL_cfTYPE int
+#define           PLONG_cfTYPE long
+#define       PLONGLONG_cfTYPE long long
+#define          PINT64_cfTYPE INT64_T
+#define          PSHORT_cfTYPE short
 
 #define CFARGS0(A,T,V,W,X,Y,Z) _3(T,_cf,A)
 #define CFARGS1(A,T,V,W,X,Y,Z) _3(T,_cf,A)(V)
@@ -64433,6 +65662,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define            INT_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define        LOGICAL_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define           LONG_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
+#define       LONGLONG_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
+#define          INT64_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          SHORT_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          PBYTE_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define        PDOUBLE_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,PINT,B,X,Y,Z,0)
@@ -64440,6 +65671,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define           PINT_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define       PLOGICAL_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          PLONG_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
+#define      PLONGLONG_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
+#define         PINT64_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define         PSHORT_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          BYTEV_cfINT(N,A,B,X,Y,Z)       DOUBLEV_cfINT(N,A,B,X,Y,Z)
 #define         BYTEVV_cfINT(N,A,B,X,Y,Z)      DOUBLEVV_cfINT(N,A,B,X,Y,Z)
@@ -64680,6 +65913,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define            INT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define        LOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,LOGICAL,A,B,C,D,E)
 #define           LONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define       LONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define          INT64_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define          SHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define          BYTEV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define         BYTEVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
@@ -64736,6 +65971,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define           PINT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define       PLOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PLOGICAL,A,B,C,D,E)
 #define          PLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define      PLONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define         PINT64_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define         PSHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define         STRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,STRING,A,B,C,D,E)
 #define        PSTRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PSTRING,A,B,C,D,E)
@@ -64793,6 +66030,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define      INT_cfCCC(A,B) &A
 #define  LOGICAL_cfCCC(A,B) &A
 #define     LONG_cfCCC(A,B) &A
+#define LONGLONG_cfCCC(A,B) &A
+#define    INT64_cfCCC(A,B) &A
 #define    SHORT_cfCCC(A,B) &A
 #define    PBYTE_cfCCC(A,B)  A
 #define  PDOUBLE_cfCCC(A,B)  A
@@ -65048,6 +66287,8 @@ static _Icf(2,U,F,CFFUN(UN),0)() {_(F,_cfE) _Icf(3,GZ,F,UN,LN) ABSOFT_cf1(F));_(
 #define            INT_cfT(M,I,A,B,D) *A
 #define        LOGICAL_cfT(M,I,A,B,D)  F2CLOGICAL(*A)
 #define           LONG_cfT(M,I,A,B,D) *A
+#define       LONGLONG_cfT(M,I,A,B,D) *A
+#define          INT64_cfT(M,I,A,B,D) *A
 #define          SHORT_cfT(M,I,A,B,D) *A
 #define          BYTEV_cfT(M,I,A,B,D)  A
 #define        DOUBLEV_cfT(M,I,A,B,D)  A
@@ -65104,6 +66345,8 @@ static _Icf(2,U,F,CFFUN(UN),0)() {_(F,_cfE) _Icf(3,GZ,F,UN,LN) ABSOFT_cf1(F));_(
 #define           PINT_cfT(M,I,A,B,D)  A
 #define       PLOGICAL_cfT(M,I,A,B,D)  ((*A=F2CLOGICAL(*A)),A)
 #define          PLONG_cfT(M,I,A,B,D)  A
+#define      PLONGLONG_cfT(M,I,A,B,D)  A
+#define         PINT64_cfT(M,I,A,B,D)  A
 #define         PSHORT_cfT(M,I,A,B,D)  A
 #define          PVOID_cfT(M,I,A,B,D)  A
 #if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran)
@@ -65452,15 +66695,6 @@ string. */
 
 
 #endif	 /* __CFORTRAN_LOADED */
-/*
- * Local Variables:
- * c-file-style: "Java"
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * show-trailing-whitespace: t
- * require-trailing-newline: t
- * End:
- */
 #ifndef  _CDIFORTRAN_H
 #define  _CDIFORTRAN_H
 
@@ -65488,6 +66722,15 @@ string. */
 #  include "config.h"
 #endif
 
+#if USE_MPI
+#  include <mpi.h>
+#  include <yaxt.h>
+#else
+#define MPI_Comm int
+#define MPI_Comm_f2c(c) (c)
+#define MPI_Comm_c2f(c) (c)
+#endif
+
 #if ! defined (_CDI_H)
 #  include "cdi.h"
 #endif
@@ -65550,14 +66793,25 @@ string. */
 
 /*  parallel IO routines  */
 
+#ifdef MPI_VERSION /* make_fint keep */
 FCALLSCSUB0 (pioEndDef, PIOENDDEF, pioenddef)
 FCALLSCSUB0 (pioEndTimestepping, PIOENDTIMESTEPPING, pioendtimestepping)
 FCALLSCSUB0 (pioFinalize, PIOFINALIZE, piofinalize)
-FCALLSCFUN5 (INT, pioInit, PIOINIT, pioinit, INT, INT, INT, INT, PINT)
-FCALLSCFUN2 (INT, pioInqVarDecoChunk, PIOINQVARDECOCHUNK, pioinqvardecochunk, INT, INT)
-FCALLSCFUN2 (INT, pioInqVarDecoOff, PIOINQVARDECOOFF, pioinqvardecooff, INT, INT)
+static int pioInit_fwrap(int commSuper, int nProcsIO, int IOMode, int * pioNamespace, float partInflate)
+{
+  MPI_Comm v;
+  v = pioInit(MPI_Comm_f2c(commSuper),  nProcsIO,  IOMode,  pioNamespace,  partInflate);
+  return MPI_Comm_c2f(v);
+}
+FCALLSCFUN5 (INT, pioInit_fwrap, PIOINIT, pioinit, INT, INT, INT, PINT, FLOAT)
+FCALLSCSUB0 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep)
+static void streamWriteVarPart_fwrap(int streamID, int varID, const void * data, int nmiss, void * partDesc)
+{
+  streamWriteVarPart( streamID,  varID,  data,  nmiss, (*(Xt_idxlist *)partDesc));
+}
+FCALLSCSUB5 (streamWriteVarPart_fwrap, STREAMWRITEVARPART, streamwritevarpart, INT, INT, PVOID, INT, PVOID)
+#endif /* make_fint keep */
 FCALLSCSUB1 (pioNamespaceSetActive, PIONAMESPACESETACTIVE, pionamespacesetactive, INT)
-FCALLSCSUB3 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep, INT, INT, INT)
 
 /*  CDI control routines  */
 
@@ -65622,6 +66876,7 @@ FCALLSCSUB4 (streamWriteVarF, STREAMWRITEVARF, streamwritevarf, INT, INT, PFLOAT
 FCALLSCSUB5 (streamReadVarSlice, STREAMREADVARSLICE, streamreadvarslice, INT, INT, INT, PDOUBLE, PINT)
 FCALLSCSUB5 (streamWriteVarSlice, STREAMWRITEVARSLICE, streamwritevarslice, INT, INT, INT, PDOUBLE, INT)
 FCALLSCSUB5 (streamWriteVarSliceF, STREAMWRITEVARSLICEF, streamwritevarslicef, INT, INT, INT, PFLOAT, INT)
+FCALLSCSUB5 (streamWriteVarChunk, STREAMWRITEVARCHUNK, streamwritevarchunk, INT, INT, INTVV, PDOUBLE, INT)
 
 /*  STREAM record I/O routines  */
 
@@ -65724,6 +66979,8 @@ FCALLSCSUB3 (vlistDefVarTimave, VLISTDEFVARTIMAVE, vlistdefvartimave, INT, INT,
 FCALLSCFUN2 (INT, vlistInqVarTimave, VLISTINQVARTIMAVE, vlistinqvartimave, INT, INT)
 FCALLSCSUB3 (vlistDefVarTimaccu, VLISTDEFVARTIMACCU, vlistdefvartimaccu, INT, INT, INT)
 FCALLSCFUN2 (INT, vlistInqVarTimaccu, VLISTINQVARTIMACCU, vlistinqvartimaccu, INT, INT)
+FCALLSCSUB3 (vlistDefVarTypeOfGeneratingProcess, VLISTDEFVARTYPEOFGENERATINGPROCESS, vlistdefvartypeofgeneratingprocess, INT, INT, INT)
+FCALLSCFUN2 (INT, vlistInqVarTypeOfGeneratingProcess, VLISTINQVARTYPEOFGENERATINGPROCESS, vlistinqvartypeofgeneratingprocess, INT, INT)
 FCALLSCFUN2 (INT, vlistInqVarSize, VLISTINQVARSIZE, vlistinqvarsize, INT, INT)
 FCALLSCSUB4 (vlistDefIndex, VLISTDEFINDEX, vlistdefindex, INT, INT, INT, INT)
 FCALLSCFUN3 (INT, vlistInqIndex, VLISTINQINDEX, vlistinqindex, INT, INT, INT)
@@ -65738,6 +66995,7 @@ FCALLSCFUN3 (INT, vlistMergedLevel, VLISTMERGEDLEVEL, vlistmergedlevel, INT, INT
 
 FCALLSCSUB5 (vlistDefVarEnsemble, VLISTDEFVARENSEMBLE, vlistdefvarensemble, INT, INT, INT, INT, INT)
 FCALLSCFUN5 (INT, vlistInqVarEnsemble, VLISTINQVARENSEMBLE, vlistinqvarensemble, INT, INT, PINT, PINT, PINT)
+FCALLSCSUB0 (cdiClearAdditionalKeys, CDICLEARADDITIONALKEYS, cdiclearadditionalkeys)
 FCALLSCSUB1 (cdiDefAdditionalKey, CDIDEFADDITIONALKEY, cdidefadditionalkey, STRING)
 FCALLSCSUB4 (vlistDefVarIntKey, VLISTDEFVARINTKEY, vlistdefvarintkey, INT, INT, STRING, INT)
 FCALLSCSUB4 (vlistDefVarDblKey, VLISTDEFVARDBLKEY, vlistdefvardblkey, INT, INT, STRING, DOUBLE)
@@ -65824,16 +67082,16 @@ FCALLSCSUB2 (gridDefGMEni2, GRIDDEFGMENI2, griddefgmeni2, INT, INT)
 FCALLSCFUN1 (INT, gridInqGMEni3, GRIDINQGMENI3, gridinqgmeni3, INT)
 FCALLSCSUB2 (gridDefGMEni3, GRIDDEFGMENI3, griddefgmeni3, INT, INT)
 
-/*  Reference grid  */
+/*  Reference of an unstructured grid  */
 
-FCALLSCFUN1 (INT, gridInqNumber, GRIDINQNUMBER, gridinqnumber, INT)
 FCALLSCSUB2 (gridDefNumber, GRIDDEFNUMBER, griddefnumber, INT, INT)
-FCALLSCFUN1 (INT, gridInqPosition, GRIDINQPOSITION, gridinqposition, INT)
+FCALLSCFUN1 (INT, gridInqNumber, GRIDINQNUMBER, gridinqnumber, INT)
 FCALLSCSUB2 (gridDefPosition, GRIDDEFPOSITION, griddefposition, INT, INT)
-FCALLSCFUN2 (INT, gridInqReference, GRIDINQREFERENCE, gridinqreference, INT, PSTRING)
+FCALLSCFUN1 (INT, gridInqPosition, GRIDINQPOSITION, gridinqposition, INT)
 FCALLSCSUB2 (gridDefReference, GRIDDEFREFERENCE, griddefreference, INT, STRING)
-FCALLSCFUN2 (STRING, gridInqUUID, GRIDINQUUID, gridinquuid, INT, CBUF)
+FCALLSCFUN2 (INT, gridInqReference, GRIDINQREFERENCE, gridinqreference, INT, PSTRING)
 FCALLSCSUB2 (gridDefUUID, GRIDDEFUUID, griddefuuid, INT, CBUF)
+FCALLSCFUN2 (STRING, gridInqUUID, GRIDINQUUID, gridinquuid, INT, CBUF)
 
 /*  Lambert Conformal Conic grid (GRIB version)  */
 
@@ -65878,10 +67136,12 @@ FCALLSCSUB2 (zaxisDefLevels, ZAXISDEFLEVELS, zaxisdeflevels, INT, PDOUBLE)
 FCALLSCSUB2 (zaxisInqLevels, ZAXISINQLEVELS, zaxisinqlevels, INT, PDOUBLE)
 FCALLSCSUB3 (zaxisDefLevel, ZAXISDEFLEVEL, zaxisdeflevel, INT, INT, DOUBLE)
 FCALLSCFUN2 (DOUBLE, zaxisInqLevel, ZAXISINQLEVEL, zaxisinqlevel, INT, INT)
-FCALLSCSUB2 (zaxisDefReference, ZAXISDEFREFERENCE, zaxisdefreference, INT, INT)
+FCALLSCSUB2 (zaxisDefNlevRef, ZAXISDEFNLEVREF, zaxisdefnlevref, INT, INT)
+FCALLSCFUN1 (INT, zaxisInqNlevRef, ZAXISINQNLEVREF, zaxisinqnlevref, INT)
+FCALLSCSUB2 (zaxisDefNumber, ZAXISDEFNUMBER, zaxisdefnumber, INT, INT)
+FCALLSCFUN1 (INT, zaxisInqNumber, ZAXISINQNUMBER, zaxisinqnumber, INT)
 FCALLSCSUB2 (zaxisDefUUID, ZAXISDEFUUID, zaxisdefuuid, INT, CBUF)
 FCALLSCFUN2 (STRING, zaxisInqUUID, ZAXISINQUUID, zaxisinquuid, INT, CBUF)
-FCALLSCFUN1 (INT, zaxisInqReference, ZAXISINQREFERENCE, zaxisinqreference, INT)
 FCALLSCSUB2 (zaxisDefName, ZAXISDEFNAME, zaxisdefname, INT, STRING)
 FCALLSCSUB2 (zaxisDefLongname, ZAXISDEFLONGNAME, zaxisdeflongname, INT, STRING)
 FCALLSCSUB2 (zaxisDefUnits, ZAXISDEFUNITS, zaxisdefunits, INT, STRING)
@@ -65891,6 +67151,7 @@ FCALLSCSUB2 (zaxisInqStdname, ZAXISINQSTDNAME, zaxisinqstdname, INT, PSTRING)
 FCALLSCSUB2 (zaxisInqUnits, ZAXISINQUNITS, zaxisinqunits, INT, PSTRING)
 FCALLSCSUB2 (zaxisDefPrec, ZAXISDEFPREC, zaxisdefprec, INT, INT)
 FCALLSCFUN1 (INT, zaxisInqPrec, ZAXISINQPREC, zaxisinqprec, INT)
+FCALLSCSUB2 (zaxisDefPositive, ZAXISDEFPOSITIVE, zaxisdefpositive, INT, INT)
 FCALLSCFUN1 (INT, zaxisInqPositive, ZAXISINQPOSITIVE, zaxisinqpositive, INT)
 FCALLSCSUB2 (zaxisDefLtype, ZAXISDEFLTYPE, zaxisdefltype, INT, INT)
 FCALLSCFUN1 (INT, zaxisInqLtype, ZAXISINQLTYPE, zaxisinqltype, INT)
diff --git a/libcdi/src/cfortran.h b/libcdi/src/cfortran.h
index 867dfc2..03f3299 100644
--- a/libcdi/src/cfortran.h
+++ b/libcdi/src/cfortran.h
@@ -64,6 +64,7 @@
 #define __CF__APOLLO67 /* __STDCPP__ is in Apollo 6.8 (i.e. ANSI) and onwards */
 #endif
 #endif
+#include <limits.h>    /* LONG_MAX */
 
 #if !defined(__GNUC__) && !defined(__sun) && (defined(sun)||defined(VAXUltrix)||defined(lynx))
 #define __CF__KnR     /* Sun, LynxOS and VAX Ultrix cc only supports K&R.     */
@@ -244,6 +245,18 @@ only C calling FORTRAN subroutines will work using K&R style.*/
 #endif
 #endif
 
+/* INT64_T for 8 byte integers */
+#if ! defined (LONG_MAX)
+#  error LONG_MAX undefined
+#endif
+
+#undef  INT64_T
+#if LONG_MAX > 2147483647L
+#  define INT64_T long int
+#else
+#  define INT64_T long long int       /* c.f. typedef of int64_t in <stdint.h> */
+#endif
+
 #ifdef CRAYFortran
 #ifdef _CRAY
 #include <fortran.h>
@@ -1335,20 +1348,24 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #else
 #define INTEGER_BYTE        unsigned char
 #endif
-#define    BYTEVVVVVVV_cfTYPE INTEGER_BYTE
-#define  DOUBLEVVVVVVV_cfTYPE DOUBLE_PRECISION 
-#define   FLOATVVVVVVV_cfTYPE FORTRAN_REAL
-#define     INTVVVVVVV_cfTYPE int
-#define LOGICALVVVVVVV_cfTYPE int
-#define    LONGVVVVVVV_cfTYPE long
-#define   SHORTVVVVVVV_cfTYPE short
-#define          PBYTE_cfTYPE INTEGER_BYTE
-#define        PDOUBLE_cfTYPE DOUBLE_PRECISION 
-#define         PFLOAT_cfTYPE FORTRAN_REAL
-#define           PINT_cfTYPE int
-#define       PLOGICAL_cfTYPE int
-#define          PLONG_cfTYPE long
-#define         PSHORT_cfTYPE short
+#define     BYTEVVVVVVV_cfTYPE INTEGER_BYTE
+#define   DOUBLEVVVVVVV_cfTYPE DOUBLE_PRECISION 
+#define    FLOATVVVVVVV_cfTYPE FORTRAN_REAL
+#define      INTVVVVVVV_cfTYPE int
+#define  LOGICALVVVVVVV_cfTYPE int
+#define     LONGVVVVVVV_cfTYPE long
+#define LONGLONGVVVVVVV_cfTYPE long long
+#define    INT64VVVVVVV_cfTYPE INT64_T
+#define    SHORTVVVVVVV_cfTYPE short
+#define           PBYTE_cfTYPE INTEGER_BYTE
+#define         PDOUBLE_cfTYPE DOUBLE_PRECISION 
+#define          PFLOAT_cfTYPE FORTRAN_REAL
+#define            PINT_cfTYPE int
+#define        PLOGICAL_cfTYPE int
+#define           PLONG_cfTYPE long
+#define       PLONGLONG_cfTYPE long long
+#define          PINT64_cfTYPE INT64_T
+#define          PSHORT_cfTYPE short
 
 #define CFARGS0(A,T,V,W,X,Y,Z) _3(T,_cf,A)
 #define CFARGS1(A,T,V,W,X,Y,Z) _3(T,_cf,A)(V)
@@ -1365,6 +1382,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define            INT_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define        LOGICAL_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define           LONG_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
+#define       LONGLONG_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
+#define          INT64_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          SHORT_cfINT(N,A,B,X,Y,Z)        DOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          PBYTE_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define        PDOUBLE_cfINT(N,A,B,X,Y,Z) _(CFARGS,N)(A,PINT,B,X,Y,Z,0)
@@ -1372,6 +1391,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define           PINT_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define       PLOGICAL_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          PLONG_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
+#define      PLONGLONG_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
+#define         PINT64_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define         PSHORT_cfINT(N,A,B,X,Y,Z)       PDOUBLE_cfINT(N,A,B,X,Y,Z)
 #define          BYTEV_cfINT(N,A,B,X,Y,Z)       DOUBLEV_cfINT(N,A,B,X,Y,Z)
 #define         BYTEVV_cfINT(N,A,B,X,Y,Z)      DOUBLEVV_cfINT(N,A,B,X,Y,Z)
@@ -1612,6 +1633,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define            INT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define        LOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,LOGICAL,A,B,C,D,E)
 #define           LONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define       LONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define          INT64_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define          SHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define          BYTEV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define         BYTEVV_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
@@ -1668,6 +1691,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define           PINT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define       PLOGICAL_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PLOGICAL,A,B,C,D,E)
 #define          PLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define      PLONGLONG_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
+#define         PINT64_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define         PSHORT_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,DEFAULT,A,B,C,D,E)
 #define         STRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,STRING,A,B,C,D,E)
 #define        PSTRING_cfSTR(N,T,A,B,C,D,E) _(CFARGS,N)(T,PSTRING,A,B,C,D,E)
@@ -1725,6 +1750,8 @@ do{VVCF(T1,A1,B1)  VVCF(T2,A2,B2)  VVCF(T3,A3,B3)  VVCF(T4,A4,B4)  VVCF(T5,A5,B5
 #define      INT_cfCCC(A,B) &A
 #define  LOGICAL_cfCCC(A,B) &A
 #define     LONG_cfCCC(A,B) &A
+#define LONGLONG_cfCCC(A,B) &A
+#define    INT64_cfCCC(A,B) &A
 #define    SHORT_cfCCC(A,B) &A
 #define    PBYTE_cfCCC(A,B)  A
 #define  PDOUBLE_cfCCC(A,B)  A
@@ -1980,6 +2007,8 @@ static _Icf(2,U,F,CFFUN(UN),0)() {_(F,_cfE) _Icf(3,GZ,F,UN,LN) ABSOFT_cf1(F));_(
 #define            INT_cfT(M,I,A,B,D) *A
 #define        LOGICAL_cfT(M,I,A,B,D)  F2CLOGICAL(*A)
 #define           LONG_cfT(M,I,A,B,D) *A
+#define       LONGLONG_cfT(M,I,A,B,D) *A
+#define          INT64_cfT(M,I,A,B,D) *A
 #define          SHORT_cfT(M,I,A,B,D) *A
 #define          BYTEV_cfT(M,I,A,B,D)  A
 #define        DOUBLEV_cfT(M,I,A,B,D)  A
@@ -2036,6 +2065,8 @@ static _Icf(2,U,F,CFFUN(UN),0)() {_(F,_cfE) _Icf(3,GZ,F,UN,LN) ABSOFT_cf1(F));_(
 #define           PINT_cfT(M,I,A,B,D)  A
 #define       PLOGICAL_cfT(M,I,A,B,D)  ((*A=F2CLOGICAL(*A)),A)
 #define          PLONG_cfT(M,I,A,B,D)  A
+#define      PLONGLONG_cfT(M,I,A,B,D)  A
+#define         PINT64_cfT(M,I,A,B,D)  A
 #define         PSHORT_cfT(M,I,A,B,D)  A
 #define          PVOID_cfT(M,I,A,B,D)  A
 #if defined(apolloFortran) || defined(hpuxFortran800) || defined(AbsoftUNIXFortran)
@@ -2384,12 +2415,3 @@ string. */
 
 
 #endif	 /* __CFORTRAN_LOADED */
-/*
- * Local Variables:
- * c-file-style: "Java"
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * show-trailing-whitespace: t
- * require-trailing-newline: t
- * End:
- */
diff --git a/libcdi/src/cgribex.h b/libcdi/src/cgribex.h
index 8169e60..58db51b 100644
--- a/libcdi/src/cgribex.h
+++ b/libcdi/src/cgribex.h
@@ -8,8 +8,8 @@
 
 /* GRIB1 Level Types */
 #define  GRIB1_LTYPE_SURFACE               1
-#define  GRIB1_LTYPE_CLOUDBASE             2
-#define  GRIB1_LTYPE_CLOUDTOP              3
+#define  GRIB1_LTYPE_CLOUD_BASE            2
+#define  GRIB1_LTYPE_CLOUD_TOP             3
 #define  GRIB1_LTYPE_ISOTHERM0             4
 #define  GRIB1_LTYPE_TOA                   8
 #define  GRIB1_LTYPE_SEA_BOTTOM            9
@@ -26,27 +26,32 @@
 #define  GRIB1_LTYPE_LANDDEPTH           111
 #define  GRIB1_LTYPE_LANDDEPTH_LAYER     112
 #define  GRIB1_LTYPE_ISENTROPIC          113
-#define  GRIB1_LTYPE_SEADEPTH            160
+#define  GRIB1_LTYPE_SEADEPTH            160  /* Depth Below Sea Level                                 */
+#define  GRIB1_LTYPE_LAKE_BOTTOM         162  /* Lake or River Bottom                                  */
+#define  GRIB1_LTYPE_SEDIMENT_BOTTOM     163  /* Bottom Of Sediment Layer                              */
+#define  GRIB1_LTYPE_SEDIMENT_BOTTOM_TA  164  /* Bottom Of Thermally Active Sediment Layer             */
+#define  GRIB1_LTYPE_SEDIMENT_BOTTOM_TW  165  /* Bottom Of Sediment Layer Penetrated By Thermal Wave   */
+#define  GRIB1_LTYPE_MIX_LAYER           166  /* Mixing Layer                                          */
 #define  GRIB1_LTYPE_99_MARGIN          1000
 
 /* GRIB1 Data representation type (Grid Type) [Table 6] */
-#define  GRIB1_GTYPE_LATLON                0  /*  latitude/longitude                       */
-#define  GRIB1_GTYPE_LATLON_ROT           10  /*  rotated latitude/longitude               */
-#define  GRIB1_GTYPE_LATLON_STR           20  /*  stretched latitude/longitude             */
-#define  GRIB1_GTYPE_LATLON_ROTSTR        30  /*  rotated and stretched latitude/longitude */
-#define  GRIB1_GTYPE_GAUSSIAN              4  /*  gaussian grid                            */
-#define  GRIB1_GTYPE_GAUSSIAN_ROT         14  /*  rotated gaussian grid                    */
-#define  GRIB1_GTYPE_GAUSSIAN_STR         24  /*  stretched gaussian grid                  */
-#define  GRIB1_GTYPE_GAUSSIAN_ROTSTR      34  /*  rotated and stretched gaussian grid      */
-#define  GRIB1_GTYPE_LCC                   3  /*  Lambert conformal                        */
-#define  GRIB1_GTYPE_SPECTRAL             50  /*  spherical harmonics                      */
-#define  GRIB1_GTYPE_GME                 192  /*  hexagonal GME grid                       */
+#define  GRIB1_GTYPE_LATLON                0  /*  latitude/longitude                                   */
+#define  GRIB1_GTYPE_LATLON_ROT           10  /*  rotated latitude/longitude                           */
+#define  GRIB1_GTYPE_LATLON_STR           20  /*  stretched latitude/longitude                         */
+#define  GRIB1_GTYPE_LATLON_ROTSTR        30  /*  rotated and stretched latitude/longitude             */
+#define  GRIB1_GTYPE_GAUSSIAN              4  /*  gaussian grid                                        */
+#define  GRIB1_GTYPE_GAUSSIAN_ROT         14  /*  rotated gaussian grid                                */
+#define  GRIB1_GTYPE_GAUSSIAN_STR         24  /*  stretched gaussian grid                              */
+#define  GRIB1_GTYPE_GAUSSIAN_ROTSTR      34  /*  rotated and stretched gaussian grid                  */
+#define  GRIB1_GTYPE_LCC                   3  /*  Lambert conformal                                    */
+#define  GRIB1_GTYPE_SPECTRAL             50  /*  spherical harmonics                                  */
+#define  GRIB1_GTYPE_GME                 192  /*  hexagonal GME grid                                   */
 
 /*
  *  Macros for the indicator section ( Section 0 )
  */
-#define  ISEC0_GRIB_Len             (isec0[ 0])  /*  Number of octets in the GRIB message         */
-#define  ISEC0_GRIB_Version         (isec0[ 1])  /*  GRIB edition number                          */
+#define  ISEC0_GRIB_Len             (isec0[ 0])  /*  Number of octets in the GRIB message              */
+#define  ISEC0_GRIB_Version         (isec0[ 1])  /*  GRIB edition number                               */
 
 
 /*
diff --git a/libcdi/src/cgribexlib.c b/libcdi/src/cgribexlib.c
index d0df1a6..304cd17 100644
--- a/libcdi/src/cgribexlib.c
+++ b/libcdi/src/cgribexlib.c
@@ -1,7 +1,7 @@
 
-/* Automatically generated by m214003 at 2013-06-27, do not edit */
+/* Automatically generated by m214003 at 2013-10-09, do not edit */
 
-/* CGRIBEXLIB_VERSION="1.6.1" */
+/* CGRIBEXLIB_VERSION="1.6.2" */
 
 #ifdef _ARCH_PWR6
 #pragma options nostrict
@@ -367,7 +367,7 @@ void  gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
 #include <math.h>
 
 
-const double const _pow2tab[158] = {
+const double _pow2tab[158] = {
  /* pow(2.0,  0.0) */  1.0,
  /* pow(2.0,  1.0) */  2.0,
  /* pow(2.0,  2.0) */  4.0,
@@ -529,7 +529,7 @@ const double const _pow2tab[158] = {
 };
 
 
-const double const _pow16tab[71] = {
+const double _pow16tab[71] = {
  /* pow(16.0,  0.0) */  1.0,
  /* pow(16.0,  1.0) */  16.0,
  /* pow(16.0,  2.0) */  256.0,
@@ -634,11 +634,52 @@ double intpow2(int x)
   else
     return (pow(2.0, (double) x));
 }
+/* 
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL minmax_val.c
+ result on bailung (gcc 4.7):
+  orig    : fmin: -500000  fmax: 499999  time:   4.84s
+  sse2    : fmin: -500000  fmax: 499999  time:   4.82s
+
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL minmax_val.c
+ result on thunder5 (gcc 4.7.2):
+  orig    : fmin: -500000  fmax: 499999  time:   3.10s
+  avx     : fmin: -500000  fmax: 499999  time:   2.84s
+
+icc -g -Wall -O3 -march=native -std=c99 -vec-report=1 -DTEST_MINMAXVAL minmax_val.c
+ result on thunder5 (icc 13.1.2):
+  orig    : fmin: -500000  fmax: 499999  time:   2.83s
+  avx     : fmin: -500000  fmax: 499999  time:   2.92s
+
+xlc_r -g -O3 -qhot -q64 -qarch=auto -qtune=auto -qreport -DTEST_MINMAXVAL minmax_val.c
+ result on blizzard (xlc 12):
+  orig    : fmin: -500000  fmax: 499999  time:   7.26s
+  pwr6u6  : fmin: -500000  fmax: 499999  time:   5.92s
+*/
+#if defined(_ARCH_PWR6)
+#pragma options nostrict
+#endif
+
+#include <stdlib.h>
+
 //#undef _GET_X86_COUNTER
 //#undef _GET_IBM_COUNTER
 //#undef _GET_MACH_COUNTER
 //#undef _ARCH_PWR6
 
+#if defined(_GET_IBM_COUNTER)
+#include <libhpc.h>
+#elif defined(_GET_X86_COUNTER)
+#include <x86intrin.h>
+#elif defined(_GET_MACH_COUNTER)
+#include <mach/mach_time.h>
+#endif
+
+#if   defined(__GNUC__) && !defined(__ICC) && !defined(__clang__)
+#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 4)
+#define GNUC_PUSH_POP
+#endif
+#endif
+
 #if   defined(__GNUC__) && (__GNUC__ >= 4)
 #elif defined(__ICC)    && (__ICC >= 1100)
 #elif defined(__clang__)
@@ -646,38 +687,40 @@ double intpow2(int x)
 #define DISABLE_SIMD
 #endif
 
-#if defined _GET_IBM_COUNTER
-#include <libhpc.h>
-#elif defined _GET_X86_COUNTER
-#include <x86intrin.h>
-#elif defined _GET_MACH_COUNTER
-#include <mach/mach_time.h>
+#if !defined(TEST_MINMAXVAL)
+#define DISABLE_SIMD
 #endif
 
-//#define DISABLE_SIMD
-
-#ifdef DISABLE_SIMD
-#ifndef ENABLE_AVX
-#undef __AVX__
-#endif
-#ifndef ENABLE_SSE2
-#undef __SSE2__
+#if defined(DISABLE_SIMD)
+# if defined(ENABLE_AVX)
+#  define _ENABLE_AVX
+# endif
+# if defined(ENABLE_SSE2)
+#  define _ENABLE_SSE2
+# endif
 #endif
+
+#if !defined(DISABLE_SIMD)
+# if defined(__AVX__)
+#  define _ENABLE_AVX
+# endif
+# if defined(__SSE2__)
+#  define _ENABLE_SSE2
+# endif
 #endif
 
-#if defined __AVX__
 #include <float.h>
 #include <stdint.h>
 #include <inttypes.h>
+
+#if defined(_ENABLE_AVX)
 #include <immintrin.h>
-#elif defined __SSE2__
-#include <float.h>
-#include <stdint.h>
-#include <inttypes.h>
+#elif defined(_ENABLE_SSE2)
 #include <emmintrin.h>
 #endif
 
-#if defined __AVX__
+
+#if defined(_ENABLE_AVX)
 
 static
 void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max)
@@ -771,7 +814,7 @@ void avx_minmax_val(const double *restrict buf, size_t nframes, double *min, dou
   return;
 }
 
-#elif defined __SSE2__
+#elif defined(_ENABLE_SSE2)
 
 static
 void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, double *max)
@@ -848,43 +891,17 @@ void sse2_minmax_val(const double *restrict buf, size_t nframes, double *min, do
   return;
 }
 
-#endif
+#endif // SIMD
 
+#if defined(_ARCH_PWR6)
 static
-void minmax_val(const double *restrict data, long idatasize, double *fmin, double *fmax)
+void pwr6_minmax_val_unrolled6(const double *restrict data, long idatasize, double *fmin, double *fmax)
 {
-#if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER 
-  uint64_t start_minmax, end_minmax;
-#endif
-  size_t datasize = idatasize;
-
-  if ( idatasize < 1 ) return;
-
-#ifdef _GET_X86_COUNTER 
-  start_minmax = _rdtsc();
-#endif
-#ifdef _GET_MACH_COUNTER 
-  start_minmax = mach_absolute_time();
-#endif
-
-#if defined __AVX__
-
-  avx_minmax_val(data, datasize, fmin, fmax);
-
-#elif defined __SSE2__
-
-  sse2_minmax_val(data, datasize, fmin, fmax);
-
-#else
-
-#ifdef _ARCH_PWR6
 #define __UNROLL_DEPTH_1 6
+  size_t datasize = idatasize;
 
   // to allow pipelining we have to unroll 
 
-#ifdef _GET_IBM_COUNTER 
-  hpmStart(1, "minmax fsel");
-#endif
   {
     size_t i, j;
     size_t residual =  datasize % __UNROLL_DEPTH_1;
@@ -919,7 +936,87 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
 	*fmax = __fsel(dmax[j] - *fmax, dmax[j], *fmax);
       }
   }
-#ifdef _GET_IBM_COUNTER 
+#undef __UNROLL_DEPTH_1
+}
+#endif
+
+#if defined(TEST_MINMAXVAL) && defined(__GNUC__)
+static
+void minmax_val_orig(const double *restrict data, long idatasize, double *fmin, double *fmax) __attribute__ ((noinline));
+#endif
+
+#if defined(GNUC_PUSH_POP)
+#pragma GCC push_options
+#pragma GCC optimize ("O3", "fast-math")
+#endif
+static
+void minmax_val_orig(const double *restrict data, long idatasize, double *fmin, double *fmax)
+{
+  size_t i;
+  size_t datasize = idatasize;
+  double dmin = *fmin, dmax = *fmax;
+
+#if   defined(CRAY)
+#pragma _CRI ivdep
+#elif defined(SX)
+#pragma vdir nodep
+#elif defined(__uxp__)
+#pragma loop novrec
+#endif
+  for ( i = 0; i < datasize; ++i )
+    {
+      dmin = dmin < data[i] ? dmin : data[i];
+      dmax = dmax > data[i] ? dmax : data[i];
+      //      if ( dmin > data[i] ) dmin = data[i];
+      //      if ( dmax < data[i] ) dmax = data[i];
+    }
+
+  *fmin = dmin;
+  *fmax = dmax;
+}
+#if defined(GNUC_PUSH_POP)
+#pragma GCC pop_options
+#endif
+
+static
+void minmax_val(const double *restrict data, long idatasize, double *fmin, double *fmax)
+{
+#if defined(_GET_X86_COUNTER) || defined(_GET_MACH_COUNTER) 
+  uint64_t start_minmax, end_minmax;
+#endif
+  size_t datasize = idatasize;
+
+  if ( idatasize < 1 ) return;
+
+#if defined(_GET_X86_COUNTER) 
+  start_minmax = _rdtsc();
+#endif
+#if defined(_GET_MACH_COUNTER) 
+  start_minmax = mach_absolute_time();
+#endif
+
+#if defined(_ENABLE_AVX)
+
+  avx_minmax_val(data, datasize, fmin, fmax);
+
+#elif defined(_ENABLE_SSE2)
+
+  sse2_minmax_val(data, datasize, fmin, fmax);
+
+#else
+
+#if defined(_ARCH_PWR6)
+#define __UNROLL_DEPTH_1 6
+
+  // to allow pipelining we have to unroll 
+
+#if defined(_GET_IBM_COUNTER)
+  hpmStart(1, "minmax fsel");
+#endif
+
+  pwr6_minmax_val_unrolled6(data, datasize, fmin, fmax);
+
+#if defined(_GET_IBM_COUNTER) 
   hpmStop(1);
 #endif
 
@@ -927,65 +1024,182 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
 
 #else // original loop
 
-#ifdef _GET_IBM_COUNTER 
+#if defined(_GET_IBM_COUNTER) 
   hpmStart(1, "minmax base");
 #endif
-  {
-    size_t i;
 
-#if   defined (CRAY)
-#pragma _CRI ivdep
-#elif defined (SX)
-#pragma vdir nodep
-#elif defined (__uxp__)
-#pragma loop novrec
-#endif
-    for ( i = 0; i < datasize; ++i )
-      {
-	if ( *fmin > data[i] ) *fmin = data[i];
-	if ( *fmax < data[i] ) *fmax = data[i];
-	/*
-	 *fmin = *fmin < data[i] ? *fmin : data[i];
-	 *fmax = *fmax > data[i] ? *fmax : data[i];
-	 */
-      }
-  }
-#ifdef _GET_IBM_COUNTER 
+  minmax_val_orig(data, datasize, fmin, fmax);
+
+#if defined(_GET_IBM_COUNTER) 
   hpmStop(1);
 #endif
 
 #endif // _ARCH_PWR6 && original loop
 #endif // SIMD
 
-#if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER
-#ifdef _GET_X86_COUNTER 
+#if defined(_GET_X86_COUNTER) || defined(_GET_MACH_COUNTER)
+#if defined(_GET_X86_COUNTER) 
   end_minmax = _rdtsc();
 #endif
-#ifdef _GET_MACH_COUNTER 
+#if defined(_GET_MACH_COUNTER) 
   end_minmax = mach_absolute_time();
 #endif
-#if defined __AVX__
-  printf("AVX minmax cycles:: %" PRIu64 "\n", 
-	 end_minmax-start_minmax);
+#if defined(_ENABLE_AVX)
+  printf("AVX minmax cycles:: %" PRIu64 "\n",  end_minmax-start_minmax);
   fprintf (stderr, "AVX min: %lf max: %lf\n", *fmin, *fmax);
-#elif defined __SSE2__
-  printf("SSE2 minmax cycles:: %" PRIu64 "\n", 
-	 end_minmax-start_minmax);
+#elif defined(_ENABLE_SSE2)
+  printf("SSE2 minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
   fprintf (stderr, "SSE2 min: %lf max: %lf\n", *fmin, *fmax);
 #else
-  printf("loop minmax cycles:: %" PRIu64 "\n", 
-	 end_minmax-start_minmax);
+  printf("loop minmax cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
   fprintf (stderr, "loop min: %lf max: %lf\n", *fmin, *fmax);
 #endif
 #endif
 
   return;
 }
+
+#if defined(TEST_MINMAXVAL)
+
+#include <stdio.h>
+#include <sys/time.h>
+
+static
+double dtime()
+{
+  double tseconds = 0.0;
+  struct timeval mytime;
+  gettimeofday(&mytime, NULL);
+  tseconds = (double) (mytime.tv_sec + (double)mytime.tv_usec*1.0e-6);
+  return (tseconds);
+}
+
+#define NRUN 10000
+
+int main(void)
+{
+  long datasize = 1000000;
+  double *data = NULL;
+  double fmin, fmax;
+  double t_begin, t_end;
+
+#if   defined(__ICC)
+  printf("icc\n");
+#elif defined(__clang__)
+  printf("clang\n");
+#elif defined(__GNUC__)
+  printf("gcc\n");
+#endif
+
+  data = (double *) malloc(datasize*sizeof(double));
+
+  for ( long i = datasize-1; i >= 0; i-- ) data[i] = (double) (-datasize/2 + i);
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      minmax_val(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("minmax_val: fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      minmax_val_orig(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("orig      : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+
+#if defined(_ENABLE_AVX)
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      avx_minmax_val(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("avx       : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+#elif defined(_ENABLE_SSE2)
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      sse2_minmax_val(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("sse2      : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+#endif
+#if defined(_ARCH_PWR6)
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      fmin = fmax = data[0];
+      pwr6_minmax_val_unrolled6(data, datasize, &fmin, &fmax);
+    }
+  t_end = dtime();
+  printf("pwr6u6  : fmin: %ld  fmax: %ld  time: %6.2fs\n", (long)fmin, (long) fmax, t_end-t_begin);
+#endif
+
+  return (0);
+}
+#endif // TEST_MINMAXVAL
+
+#undef DISABLE_SIMD
+#undef _ENABLE_AVX
+#undef _ENABLE_SSE2
+#undef GNUC_PUSH_POP
+/* 
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL encode_double_array.c
+ result on bailung (gcc 4.7):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 8.4166s
+  sse41   : val1: 1  val2: 1  val3: 2  valn: 66  time: 7.1522s
+
+gcc -g -Wall -O3 -march=native -std=c99 -DTEST_MINMAXVAL encode_double_array.c
+ result on thunder5 (gcc 4.7):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 6.21976s
+  avx     : val1: 1  val2: 1  val3: 2  valn: 66  time: 4.54485s
+
+icc -g -Wall -O3 -march=native -std=c99 -vec-report=1 -DTEST_MINMAXVAL encode_double_array.c
+ result on thunder5 (icc 13.2):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 14.6279s
+  avx     : val1: 1  val2: 1  val3: 2  valn: 66  time:  4.9776s
+
+xlc_r -g -O3 -qhot -q64 -qarch=auto -qtune=auto -qreport -DTEST_MINMAXVAL encode_double_array.c
+ result on blizzard (xlc 12):
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 132.25s
+  unrolled: val1: 1  val2: 1  val3: 2  valn: 66  time:  27.202s
+  orig    : val1: 1  val2: 1  val3: 2  valn: 66  time: 106.627s  // without -qhot
+  unrolled: val1: 1  val2: 1  val3: 2  valn: 66  time:  39.929s  // without -qhot
+*/
+#ifdef _ARCH_PWR6
+#pragma options nostrict
+#endif
+
+#ifdef TEST_MINMAXVAL
+#include <stdio.h>
+#include <stdlib.h>
+#define  GRIBPACK     unsigned char
+#define  IS_BIGENDIAN()  (u_byteorder.c[sizeof(long) - 1])
+#define  U_BYTEORDER     static union {unsigned long l; unsigned char c[sizeof(long)];} u_byteorder = {1}
+#define  Error(x,y)
+#endif
+
 //#undef _GET_X86_COUNTER
 //#undef _GET_MACH_COUNTER
 //#undef _GET_IBM_COUNTER
 //#undef _ARCH_PWR6
 
+#if defined _GET_IBM_COUNTER
+#include <libhpc.h>
+#elif defined _GET_X86_COUNTER
+#include <x86intrin.h>
+#elif defined _GET_MACH_COUNTER
+#include <mach/mach_time.h>
+#endif
+
 #include <stdint.h>
 
 #if   defined(__GNUC__) && (__GNUC__ >= 4)
@@ -995,32 +1209,33 @@ void minmax_val(const double *restrict data, long idatasize, double *fmin, doubl
 #define DISABLE_SIMD
 #endif
 
-#if defined _GET_IBM_COUNTER
-#include <libhpc.h>
-#elif defined _GET_X86_COUNTER
-#include <x86intrin.h>
-#elif defined _GET_MACH_COUNTER
-#include <mach/mach_time.h>
-#endif
-
 //#define DISABLE_SIMD
 
 #ifdef DISABLE_SIMD
-#ifndef ENABLE_AVX
-#undef __AVX__
-#endif
-#ifndef ENABLE_SSE4_1
-#undef __SSE4_1__
+# ifdef ENABLE_AVX
+#  define _ENABLE_AVX
+# endif
+# ifdef ENABLE_SSE4_1
+#  define _ENABLE_SSE4_1
+# endif
 #endif
+
+#ifndef DISABLE_SIMD
+# ifdef __AVX__
+#  define _ENABLE_AVX
+# endif
+# ifdef __SSE4_1__
+#  define _ENABLE_SSE4_1
+# endif
 #endif
 
-#if defined __AVX__
+#if defined _ENABLE_AVX
 #include <immintrin.h>
-#elif defined __SSE4_1__
+#elif defined _ENABLE_SSE4_1
 #include <smmintrin.h>
 #endif
 
-#if defined __AVX__
+#if defined _ENABLE_AVX
 
 static
 void avx_encode_double_array_2byte(size_t datasize, 
@@ -1121,7 +1336,7 @@ void avx_encode_double_array_2byte(size_t datasize,
   return;
 }
 
-#elif defined __SSE4_1__
+#elif defined _ENABLE_SSE4_1
 
 static
 void sse41_encode_double_array_2byte(size_t datasize, 
@@ -1303,6 +1518,33 @@ void encode_double_array_common(int numBits, size_t packStart, size_t datasize,
 }
 
 static
+void encode_double_array_2byte(size_t datasize, GRIBPACK *restrict lGrib,
+			       const double *restrict data, double zref, double factor, size_t *gz)
+{
+  size_t i, z = *gz;
+  uint16_t ui16;
+  double tmp;
+
+#if   defined (CRAY)
+#pragma _CRI ivdep
+#elif defined (SX)
+#pragma vdir nodep
+#elif defined (__uxp__)
+#pragma loop novrec
+#endif
+  for ( i = 0; i < datasize; i++ )
+    {
+      tmp = ((data[i] - zref) * factor + 0.5);
+      ui16 = (uint16_t) tmp;
+      lGrib[z  ] = ui16 >>  8;
+      lGrib[z+1] = ui16;
+      z += 2;
+    }
+
+  *gz = z;
+}
+
+static
 void encode_double_array_byte(int numBits, size_t packStart, size_t datasize, 
 			      GRIBPACK *restrict lGrib,
 			      const double *restrict data, 
@@ -1353,33 +1595,18 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize,
   start_minmax = mach_absolute_time();
 #endif
 
-#if defined __AVX__
+#if defined _ENABLE_AVX
 
       avx_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
 
-#elif defined __SSE4_1__
+#elif defined _ENABLE_SSE4_1
 
       sse41_encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
 
 #else
 
-      uint16_t ui16;
+      encode_double_array_2byte(datasize, lGrib, data, zref, factor, &z);
 
-#if   defined (CRAY)
-#pragma _CRI ivdep
-#elif defined (SX)
-#pragma vdir nodep
-#elif defined (__uxp__)
-#pragma loop novrec
-#endif
-      for ( i = 0; i < datasize; i++ )
-      	{
-      	  tmp = ((data[i] - zref) * factor + 0.5);
-          ui16 = (uint16_t) tmp;
-          lGrib[z  ] = ui16 >>  8;
-          lGrib[z+1] = ui16;
-          z += 2;
-      	}
 #endif
 
 #if defined _GET_X86_COUNTER || defined _GET_MACH_COUNTER
@@ -1388,15 +1615,12 @@ void encode_double_array_byte(int numBits, size_t packStart, size_t datasize,
 #elif defined _GET_MACH_COUNTER 
       end_minmax = mach_absolute_time();
 #endif
-#if defined __AVX__
-      printf("AVX encoding cycles:: %" PRIu64 "\n", 
-	     end_minmax-start_minmax);
-#elif defined __SSE4_1__
-      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", 
-	     end_minmax-start_minmax);
+#if defined _ENABLE_AVX
+      printf("AVX encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
+#elif defined _ENABLE_SSE4_1
+      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
 #else
-      printf("loop encoding cycles:: %" PRIu64 "\n", 
-	     end_minmax-start_minmax);
+      printf("loop encoding cycles:: %" PRIu64 "\n", end_minmax-start_minmax);
 #endif  
 #endif
       
@@ -1703,6 +1927,87 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize
   *gz = z;
 #undef __UNROLL_DEPTH_2
 }
+
+#ifdef TEST_MINMAXVAL
+
+#include <sys/time.h>
+
+static
+double dtime()
+{
+  double tseconds = 0.0;
+  struct timeval mytime;
+  gettimeofday(&mytime, NULL);
+  tseconds = (double) (mytime.tv_sec + (double)mytime.tv_usec*1.0e-6);
+  return (tseconds);
+}
+
+#define NRUN 10000
+
+int main(void)
+{
+  long datasize = 1000000;
+  double *data = NULL;
+  double t_begin, t_end;
+  unsigned char *lgrib;
+
+  data = (double *) malloc(datasize*sizeof(double));
+  lgrib = (unsigned char *)  malloc(2*datasize*sizeof(unsigned char));
+
+  for ( long i = 0; i < datasize; ++i ) data[i] = (double) (-datasize/2 + i);
+
+  int PackStart = 0;
+  int nbpv = 16;
+  double zref = data[0];
+  size_t z;
+  double factor = 0.00390625;
+  int s = 256;
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      encode_double_array_2byte   (datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("orig    : val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      encode_double_array_unrolled (nbpv, PackStart, datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("unrolled: val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+
+#if defined _ENABLE_AVX
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      avx_encode_double_array_2byte   (datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("avx     : val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+#elif defined _ENABLE_SSE4_1
+  t_begin = dtime();
+  for ( int i = 0; i < NRUN; ++i )
+    {
+      z = 0;
+      sse41_encode_double_array_2byte   (datasize, lgrib, data, zref, factor, &z);
+    }
+  t_end = dtime();
+  printf("sse41   : val1: %d  val2: %d  val3: %d  valn: %d  time: %gs\n", (int) lgrib[s*1+1], (int) lgrib[s*2+1], (int) lgrib[s*3+1], (int) lgrib[2*datasize-1], t_end-t_begin);
+#endif
+
+  return 0;
+}
+#endif // TEST_MINMAXVAL
+
+#undef DISABLE_SIMD
+#undef _ENABLE_AVX
+#undef _ENABLE_SSE4_1
 //#undef _GET_X86_COUNTER
 //#undef _GET_MACH_COUNTER
 //#undef _GET_IBM_COUNTER
@@ -1719,21 +2024,38 @@ void encode_double_array_unrolled(int numBits, size_t packStart, size_t datasize
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
 
-/*
-#if ((__GNUC__ >= 4) || (__ICC >= 1100) || defined (__clang__))
-#define _ENABLE_SIMD
-#include <immintrin.h>
-#undef __AVX
-#ifdef __AVX__
-#define _ENABLE_AVX
-#elif __SSE4_1__
-#define _ENABLE_SSE4_1
+#if   defined(__GNUC__) && (__GNUC__ >= 4)
+#elif defined(__ICC)    && (__ICC >= 1100)
+#elif defined(__clang__)
+#else
+#define DISABLE_SIMD
 #endif
+
+#define DISABLE_SIMD
+
+#ifdef DISABLE_SIMD
+# ifdef ENABLE_AVX
+#  define _ENABLE_AVX
+# endif
+# ifdef ENABLE_SSE4_1
+#  define _ENABLE_SSE4_1
+# endif
 #endif
-*/
 
-#undef _ENABLE_AVX
-#undef _ENABLE_SSE4_1
+#ifndef DISABLE_SIMD
+# ifdef __AVX__
+#  define _ENABLE_AVX
+# endif
+# ifdef __SSE4_1__
+#  define _ENABLE_SSE4_1
+# endif
+#endif
+
+#if defined _ENABLE_AVX
+#include <immintrin.h>
+#elif defined _ENABLE_SSE4_1
+#include <smmintrin.h>
+#endif
 
 #if defined _ENABLE_AVX
 
@@ -2110,14 +2432,11 @@ void decode_double_array_byte(const unsigned char * restrict igrib, long jlend,
       end_decode = mach_absolute_time();
 #endif
 #if defined _ENABLE_AVX
-      printf("AVX encoding cycles:: %" PRIu64 "\n", 
-	     end_decode-start_decode);
+      printf("AVX encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
 #elif defined _ENABLE_SSE4_1
-      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", 
-	     end_decode-start_decode);
+      printf("SSE 4.1 encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
 #else
-      printf("loop encoding cycles:: %" PRIu64 "\n", 
-	     end_decode-start_decode);
+      printf("loop encoding cycles:: %" PRIu64 "\n", end_decode-start_decode);
 #endif  
 #endif
       
@@ -2161,6 +2480,10 @@ void decode_double_array_unrolled(const unsigned char * restrict igrib, long jle
   decode_double_array_byte(igrib, jlend, numBits, fmin, zscale, fpdata);
 }
 
+#undef DISABLE_SIMD
+#undef _ENABLE_AVX
+#undef _ENABLE_SSE4_1
+
 #define  NINT(x)  ((x) < 0 ? (int)((x)-.5) : (int)((x)+.5))
 
 
@@ -2237,7 +2560,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
   int iexp, isign;
   int iround;
   // extern int CGRIBEX_Debug;
-  extern const double const _pow16tab[71];
+  extern const double _pow16tab[71];
 
   /* ----------------------------------------------------------------- */
   /*   Section 1 . Initialise                                          */
@@ -2484,7 +2807,7 @@ double decfp2(int kexp, int kmant)
   double pval;
   int iexp, isign;
   //extern int CGRIBEX_Debug;
-  extern const double const _pow16tab[71];
+  extern const double _pow16tab[71];
   
   /* ----------------------------------------------------------------- */
   /*   Section 1 . Convert value of 0.0. Ignore sign bit.              */
@@ -3026,8 +3349,8 @@ void gribPrintSec1(int *isec0, int *isec1)
     Section 1 . Print local DWD information.
     -----------------------------------------------------------------
   */
-  if ( (isec1[ 1] == 78 && isec1[36] == 253) ||
-       (isec1[ 1] == 78 && isec1[36] == 254) )
+  if ( (ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250) &&
+       (isec1[36] == 253     || isec1[36] == 254) )
     {
       fprintf(grprsm, " DWD local usage identifier.          %9d\n", isec1[36]);
       if ( isec1[36] == 253 )
@@ -4446,7 +4769,6 @@ void encodeES(GRIBPACK *lGrib, long *gribLen, long bdsstart)
 #define DWD_extension_253_len 38
 #define DWD_extension_254_len 26
 #define ECMWF_extension_1_len 24
-#define MCH_extension_254_len 19
 #define MPIM_extension_1_len  18
 
 static
@@ -4456,7 +4778,7 @@ long getLocalExtLen(int *isec1)
 
   if ( ISEC1_LocalFLag )
     {
-      if ( ISEC1_CenterID == 78 ) 
+      if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 )
 	{
 	  if      ( isec1[36] == 254 ) extlen = DWD_extension_254_len;
 	  else if ( isec1[36] == 253 ) extlen = DWD_extension_253_len;
@@ -4465,10 +4787,6 @@ long getLocalExtLen(int *isec1)
         {
 	  if ( isec1[36] == 1 )   extlen = ECMWF_extension_1_len;
         }
-      else if ( ISEC1_CenterID == 215 )
-        {
-	  if ( isec1[36] == 254 ) extlen = MCH_extension_254_len;
-        }
       else if ( ISEC1_CenterID == 252 )
         {
 	  if ( isec1[36] == 1 ) extlen = MPIM_extension_1_len;
@@ -4675,30 +4993,18 @@ void encodePDS(GRIBPACK *lpds, long pdsLen, int *isec1)
 
   if ( ISEC1_LocalFLag )
     {
-      if ( ISEC1_CenterID == 78 ) 
+      if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 )
 	{
-	  if ( isec1[36] == 254 ) 
-	    {
-	      encodePDS_DWD_local_Extension_254(lGrib, &z, isec1);
-	    }
-	  else if ( isec1[36] == 253 )
-	    { 
-	      encodePDS_DWD_local_Extension_253(lGrib, &z, isec1);
-	    }
+	  if      ( isec1[36] == 254 ) encodePDS_DWD_local_Extension_254(lGrib, &z, isec1);
+	  else if ( isec1[36] == 253 ) encodePDS_DWD_local_Extension_253(lGrib, &z, isec1);
 	}
       else if ( ISEC1_CenterID == 98 )
 	{
-	  if ( isec1[36] == 1 )
-	    {
-	      encodePDS_ECMWF_local_Extension_1(lGrib, &z, isec1);
-	    }
+	  if ( isec1[36] == 1 ) encodePDS_ECMWF_local_Extension_1(lGrib, &z, isec1);
 	}
       else if ( ISEC1_CenterID == 252 )
 	{
-	  if ( isec1[36] == 1 )
-	    {
-	      encodePDS_MPIM_local_Extension_1(lGrib, &z, isec1);
-	    }
+	  if ( isec1[36] == 1 ) encodePDS_MPIM_local_Extension_1(lGrib, &z, isec1);
 	}
       else
 	{
@@ -4965,7 +5271,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
   double jpepsln = 1.0e-12;     /* -----> tolerance used to check equality     */
                                 /*        of floating point numbers - needed   */
 		                /*        on some platforms (eg vpp700, linux) */
-  extern const double const _pow2tab[158];
+  extern const double _pow2tab[158];
   extern int CGRIBEX_Const;         /* 1: Don't pack constant fields on regular grids */
 
   if ( isec2 )
@@ -5061,7 +5367,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
 
   fmin = fmax = data[PackStart];
 
-  minmax_val(data+PackStart+1, datasize-PackStart-1, &fmin, &fmax);
+  minmax_val(data+PackStart, datasize-PackStart, &fmin, &fmax);
 
   zref = fmin;
 
@@ -5568,7 +5874,7 @@ int decodePDS(unsigned char *pds, int *isec0, int *isec1)
 	{
 	  ISEC1_LocalFLag = 1;
 
-	  if ( ISEC1_CenterID == 78 )
+	  if ( ISEC1_CenterID == 78 || ISEC1_CenterID == 215 || ISEC1_CenterID == 250 )
 	    {
 	      if ( pds[40] == 254 ) 
 		{
@@ -6010,6 +6316,16 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
 	  locnd += 4*ioff;  /* RealCoef */
 	}
     }
+  else
+    {
+      if ( lcomplex )
+	{
+	  *iret = 1999;
+	  gprintf(__func__, " Second order packed grids unsupported!");
+	  gprintf(__func__, " Return code =  %d", *iret);
+	  return (0);
+	}
+    }
 
   /* Decode data values to floating point and store in fsec4.  */
   /* First calculate the number of data values.                */
@@ -6428,10 +6744,12 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
 	{
 	  *iret = -801;
 	}
+      //printf("nlat %d  nlon %d \n", nlat, nlon);
+      //printf("nvalues %d %d\n", nvalues, ISEC4_NumValues);
 
       if ( dfunc == 'R' && *iret == -801 )
-	  gprintf(__func__, "Number of values (%d) and sum of lons per row (%d) differ, abort conversion to regular grid!",
-		  ISEC4_NumValues, nvalues);
+	gprintf(__func__, "Number of values (%d) and sum of lons per row (%d) differ, abort conversion to regular Gaussian grid!",
+		ISEC4_NumValues, nvalues);
       
       if ( dfunc == 'R' && *iret != -801 )
 	{
@@ -6444,8 +6762,7 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
 	    ((ISEC1_Parameter == 27) || (ISEC1_Parameter == 28) || 
 	     (ISEC1_Parameter == 29) || (ISEC1_Parameter == 30));
 	      
-	  (void) qu2reg3(fsec4, ISEC2_RowLonPtr, nlat, nlon, FSEC3_MissVal, iret,
-			 lsect3, lperio, lveggy);
+	  (void) qu2reg3(fsec4, ISEC2_RowLonPtr, nlat, nlon, FSEC3_MissVal, iret, lsect3, lperio, lveggy);
 	      
 	  if ( bitmapSize > 0 )
 	    {
@@ -10522,7 +10839,7 @@ int  gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
 
   return (gribLen);
 }
-static const char grb_libvers[] = "1.6.1" " of ""Jun 27 2013"" ""15:38:33";
+static const char grb_libvers[] = "1.6.2" " of ""Oct  9 2013"" ""11:03:55";
 const char *
 cgribexLibraryVersion(void)
 {
diff --git a/libcdi/src/config.h.in b/libcdi/src/config.h.in
index f8cb3f2..c161d19 100644
--- a/libcdi/src/config.h.in
+++ b/libcdi/src/config.h.in
@@ -106,12 +106,21 @@
 /* Define to 1 if you have the <netcdf.h> header file. */
 #undef HAVE_NETCDF_H
 
+/* Define to 1 if you have the <netcdf_par.h> header file. */
+#undef HAVE_NETCDF_PAR_H
+
 /* Define to 1 if you have the <openjpeg.h> header file. */
 #undef HAVE_OPENJPEG_H
 
+/* netCDF library does support MPI parallel invocations */
+#undef HAVE_PARALLEL_NC4
+
 /* Define to 1 if you have the <png.h> header file. */
 #undef HAVE_PNG_H
 
+/* ScalES PPM C core library is available */
+#undef HAVE_PPM_CORE
+
 /* Define if you have POSIX threads libraries and header files. */
 #undef HAVE_PTHREAD
 
@@ -148,6 +157,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* yaxt library is available */
+#undef HAVE_YAXT
+
 /* Define to 1 if you have the <zlib.h> header file. */
 #undef HAVE_ZLIB_H
 
diff --git a/libcdi/src/error.c b/libcdi/src/error.c
index b04009d..6be3324 100644
--- a/libcdi/src/error.c
+++ b/libcdi/src/error.c
@@ -7,6 +7,9 @@
 #include <stdarg.h>
 #include <errno.h>
 
+#if !defined (NAMESPACE_H)
+#include "namespace.h"
+#endif
 
 int _ExitOnError   = 1;	/* If set to 1, exit on error       */
 int _Verbose = 1;	/* If set to 1, errors are reported */
@@ -16,7 +19,7 @@ int _Debug   = 0;       /* If set to 1, debugging           */
 void SysError_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
   printf("\n");
@@ -28,7 +31,7 @@ void SysError_(const char *caller, const char *fmt, ...)
 
   if ( errno )
     perror("System error message ");
-	
+
   exit(EXIT_FAILURE);
 }
 
@@ -36,7 +39,7 @@ void SysError_(const char *caller, const char *fmt, ...)
 void Error_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
   printf("\n");
@@ -49,11 +52,43 @@ void Error_(const char *caller, const char *fmt, ...)
   if ( _ExitOnError ) exit(EXIT_FAILURE);
 }
 
+typedef void (*cdiAbortCFunc)(const char * caller, const char * filename,
+                              const char *functionname, int line,
+                              const char * errorString, va_list ap)
+#ifdef __GNUC__
+  __attribute__((noreturn))
+#endif
+;
+
+void cdiAbortC(const char * caller, const char * filename,
+               const char *functionname, int line,
+               const char * errorString, ... )
+{
+  va_list ap;
+  va_start(ap, errorString);
+  cdiAbortCFunc cdiAbortC_p
+    = (cdiAbortCFunc)namespaceSwitchGet(NSSWITCH_ABORT).func;
+  cdiAbortC_p(caller, filename, functionname, line, errorString, ap);
+  va_end(ap);
+}
+
+void
+cdiAbortC_serial(const char *caller, const char *filename,
+                 const char *functionname, int line,
+                 const char *errorString, va_list ap)
+{
+  fprintf(stderr, "ERROR, %s, %s, line %d%s%s\nerrorString: \"",
+          functionname, filename, line, caller?", called from ":"",
+          caller?caller:"");
+  vfprintf(stderr, errorString, ap);
+  fputs("\"\n", stderr);
+  exit(EXIT_FAILURE);
+}
 
 void Warning_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
   if ( _Verbose )
@@ -70,7 +105,7 @@ void Warning_(const char *caller, const char *fmt, ...)
 void Message_(const char *caller, const char *fmt, ...)
 {
   va_list args;
-	
+
   va_start(args, fmt);
 
    fprintf(stdout, "%-18s : ", caller);
diff --git a/libcdi/src/error.h b/libcdi/src/error.h
index 1759e5e..7a7ee8f 100644
--- a/libcdi/src/error.h
+++ b/libcdi/src/error.h
@@ -1,6 +1,9 @@
 #ifndef _ERROR_H
 #define _ERROR_H
 
+#include <stdarg.h>
+#include <stdlib.h>
+
 #ifndef  WITH_CALLER_NAME
 #define  WITH_CALLER_NAME
 #endif
@@ -34,6 +37,33 @@ void  Message_(const char *caller, const char *fmt, ...);
 #  define   Message(...)   Message_((void *), __VA_ARGS__)
 #endif
 
+/* If we're not using GNU C, elide __attribute__ */
+#ifndef __GNUC__
+#  define  __attribute__(x)  /*NOTHING*/
+#endif
+
+void cdiAbortC(const char *caller, const char *filename,
+               const char *functionname, int line,
+               const char *errorString, ... )
+  __attribute__((noreturn));
+#define xabortC(caller, ...)                                    \
+  cdiAbortC(caller, __FILE__, __func__, __LINE__, __VA_ARGS__ )
+#define xabort(...)                                             \
+  cdiAbortC(NULL, __FILE__, __func__, __LINE__, __VA_ARGS__ )
+#define cdiAbort(file, func, line, ...)                 \
+  cdiAbortC(NULL, (file), (func), (line), __VA_ARGS__)
+
+#define xassert(arg) do {                       \
+    if ((arg)) { } else {                       \
+      xabort("assertion failed");}              \
+  } while(0)
+
+void
+cdiAbortC_serial(const char *caller, const char *filename,
+                 const char *functionname, int line,
+                 const char *errorString, va_list ap)
+  __attribute__((noreturn));
+
 #endif  /* _ERROR_H */
 /*
  * Local Variables:
diff --git a/libcdi/src/file.c b/libcdi/src/file.c
index c164f97..56a879d 100644
--- a/libcdi/src/file.c
+++ b/libcdi/src/file.c
@@ -11,21 +11,14 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/time.h>  // gettimeofday()
 #include <fcntl.h>
-/*
-size_t getpagesize(void);
-*/
+
 #include "dmemory.h"
 #include "error.h"
 #include "file.h"
 
-#ifdef USE_MPI
-#include "cdi.h"
 #include "namespace.h"
-#include "pio.h"
-#include "pio_comm.h"
-#include "pio_util.h"
-#endif
 
 #if ! defined (O_BINARY)
 #define O_BINARY 0
@@ -116,6 +109,7 @@ typedef struct
   off_t      bufferStart;
   off_t      bufferEnd;
   size_t     bufferCnt;
+  double     time_in_sec;
 }
 bfile_t;
 
@@ -130,7 +124,7 @@ enum F_I_L_E_Flags
   };
 
 
-static int FileInfo = FALSE;
+static int FileInfo  = FALSE;
 
 
 #if ! defined (MIN_BUF_SIZE)
@@ -304,6 +298,7 @@ void file_init_entry(bfile_t *fileptr)
   fileptr->bufferPos     = 0;
   fileptr->bufferCnt     = 0;
   fileptr->bufferPtr     = NULL;
+  fileptr->time_in_sec   = 0.0;
 }
 
 static
@@ -353,13 +348,22 @@ const char *fileLibraryVersion(void)
 static
 int pagesize(void)
 {
-#if defined (HAVE_MMAP)
-  return ((int) getpagesize());
+#if defined(_SC_PAGESIZE)
+  return ((int) sysconf(_SC_PAGESIZE));
 #else
   return ((int) POSIXIO_DEFAULT_PAGESIZE);
 #endif
 }
 
+static
+double file_time()
+{
+  double tseconds = 0.0;
+  struct timeval mytime;
+  gettimeofday(&mytime, NULL);
+  tseconds = (double) mytime.tv_sec + (double) mytime.tv_usec*1.0e-6;
+  return (tseconds);
+}
 
 void fileDebug(int debug)
 {
@@ -759,7 +763,7 @@ void file_initialize(void)
   if ( FILE_Debug )
     Message("FILE_MAX = %d", _file_max);
 
-  FileInfo = (int) file_getenv("FILE_INFO");
+  FileInfo  = (int) file_getenv("FILE_INFO");
 
   value  = file_getenv("FILE_BUFSIZE");
   if ( value >= 0 ) FileBufferSizeEnv = value;
@@ -1095,6 +1099,14 @@ void fileSetBufferSize(int fileID, long buffersize)
  */
 int fileOpen(const char *filename, const char *mode)
 {
+  int (*myFileOpen)(const char *filename, const char *mode)
+    = (int (*)(const char *, const char *))
+    namespaceSwitchGet(NSSWITCH_FILE_OPEN).func;
+  return myFileOpen(filename, mode);
+}
+
+int fileOpen_serial(const char *filename, const char *mode)
+{
   FILE *fp = NULL;    /* file pointer    (used for write) */
   int fd = -1;        /* file descriptor (used for read)  */
   int fileID = FILE_UNDEFID;
@@ -1102,11 +1114,6 @@ int fileOpen(const char *filename, const char *mode)
   struct stat filestat;
   bfile_t *fileptr = NULL;
 
-#ifdef USE_MPI
-  if ( mode[0] == 'w' && commInqIOMode () != PIO_NONE )
-      return pioFileOpenW ( filename );
-#endif
-
   FILE_INIT();
 
   fmode = tolower((int) mode[0]);
@@ -1191,19 +1198,19 @@ int fileOpen(const char *filename, const char *mode)
  */
 int fileClose(int fileID)
 {
+  int (*myFileClose)(int fileID)
+    = (int (*)(int))namespaceSwitchGet(NSSWITCH_FILE_CLOSE).func;
+  return myFileClose(fileID);
+}
+
+int fileClose_serial(int fileID)
+{
   char *name;
   int ret;
   char *fbtname[] = {"unknown", "standard", "mmap"};
   char *ftname[] = {"unknown", "open", "fopen"};
-  bfile_t *fileptr;
-
-  fileptr = file_to_pointer(fileID);
-
-#ifdef USE_MPI
-  if (((fileptr && fileptr->mode == 'w') || !fileptr)
-      && commInqIOMode () != PIO_NONE )
-    return pioFileClose ( fileID );
-#endif
+  bfile_t *fileptr = file_to_pointer(fileID);
+  double rout = 0;
 
   if ( fileptr == NULL )
     {
@@ -1252,6 +1259,15 @@ int fileClose(int fileID)
 	  fprintf(stderr, " bytes transfered : %ld\n", (long) fileptr->byteTrans);
 	}
 
+      if ( fileptr->time_in_sec > 0 )
+        {
+          rout = fileptr->byteTrans;
+          rout /= 1024.*1014.*fileptr->time_in_sec;
+        }
+
+      fprintf(stderr, " wall time [s]    : %.2f\n", fileptr->time_in_sec);
+      fprintf(stderr, " data rate [MB/s] : %.1f\n", rout);
+
       fprintf(stderr, " file access      : %ld\n", fileptr->access);
       if ( fileptr->mode == 'r' && fileptr->type == FILE_TYPE_OPEN )
 	{
@@ -1260,9 +1276,7 @@ int fileClose(int fileID)
 	}
       fprintf(stderr, " buffer size      : %lu\n", (unsigned long) fileptr->bufferSize);
       fprintf(stderr, " block size       : %lu\n", (unsigned long) fileptr->blockSize);
-#if defined (HAVE_MMAP)
       fprintf(stderr, " page size        : %d\n",  pagesize());
-#endif
       fprintf(stderr, "--------------------------------------------\n");
     }
 
@@ -1390,6 +1404,10 @@ size_t fileRead(int fileID, void *restrict ptr, size_t size)
 
   if ( fileptr )
     {
+      double t_begin = 0.0;
+
+      if ( FileInfo ) t_begin = file_time();
+
       if ( fileptr->type == FILE_TYPE_OPEN )
 	nread = file_read_from_buffer(fileptr, ptr, size);
       else
@@ -1404,6 +1422,8 @@ size_t fileRead(int fileID, void *restrict ptr, size_t size)
 	    }
 	}
 
+      if ( FileInfo ) fileptr->time_in_sec += file_time() - t_begin;
+
       fileptr->position  += nread;
       fileptr->byteTrans += nread;
       fileptr->access++;
@@ -1424,13 +1444,19 @@ size_t fileWrite(int fileID, const void *restrict ptr, size_t size)
 
   if ( fileptr )
     {
+      double t_begin = 0.0;
+
       /* if ( fileptr->buffer == NULL ) file_set_buffer(fileptr); */
 
+      if ( FileInfo ) t_begin = file_time();
+
       if ( fileptr->type == FILE_TYPE_FOPEN )
         nwrite = fwrite(ptr, 1, size, fileptr->fp);
       else
         nwrite =  write(fileptr->fd, ptr, size);
 
+      if ( FileInfo ) fileptr->time_in_sec += file_time() - t_begin;
+
       fileptr->position  += nwrite;
       fileptr->byteTrans += nwrite;
       fileptr->access++;
diff --git a/libcdi/src/file.h b/libcdi/src/file.h
index 086b588..fa166e1 100644
--- a/libcdi/src/file.h
+++ b/libcdi/src/file.h
@@ -25,7 +25,9 @@ int    fileSetBufferType(int fileID, int type);
 void   fileSetBufferSize(int fileID, long buffersize);
 
 int    fileOpen(const char *filename, const char *mode);
+int    fileOpen_serial(const char *filename, const char *mode);
 int    fileClose(int fileID);
+int    fileClose_serial(int fileID);
 
 char  *fileInqName(int fileID);
 int    fileInqMode(int fileID);
diff --git a/libcdi/src/gribapi.h b/libcdi/src/gribapi.h
index 741ebaf..7d3bf13 100644
--- a/libcdi/src/gribapi.h
+++ b/libcdi/src/gribapi.h
@@ -5,8 +5,8 @@
 
 /* GRIB2 Level Types */
 #define  GRIB2_LTYPE_SURFACE               1
-#define  GRIB2_LTYPE_CLOUDBASE             2
-#define  GRIB2_LTYPE_CLOUDTOP              3
+#define  GRIB2_LTYPE_CLOUD_BASE            2
+#define  GRIB2_LTYPE_CLOUD_TOP             3
 #define  GRIB2_LTYPE_ISOTHERM0             4
 #define  GRIB2_LTYPE_TOA                   8
 #define  GRIB2_LTYPE_SEA_BOTTOM            9
@@ -21,21 +21,26 @@
 #define  GRIB2_LTYPE_ISENTROPIC          107
 #define  GRIB2_LTYPE_SNOW                114
 #define  GRIB2_LTYPE_REFERENCE           150
-#define  GRIB2_LTYPE_SEADEPTH            160
+#define  GRIB2_LTYPE_SEADEPTH            160  /* Depth Below Sea Level                                 */
+#define  GRIB2_LTYPE_LAKE_BOTTOM         162  /* Lake or River Bottom                                  */
+#define  GRIB2_LTYPE_SEDIMENT_BOTTOM     163  /* Bottom Of Sediment Layer                              */
+#define  GRIB2_LTYPE_SEDIMENT_BOTTOM_TA  164  /* Bottom Of Thermally Active Sediment Layer             */
+#define  GRIB2_LTYPE_SEDIMENT_BOTTOM_TW  165  /* Bottom Of Sediment Layer Penetrated By Thermal Wave   */
+#define  GRIB2_LTYPE_MIX_LAYER           166  /* Mixing Layer                                          */
 
 /* GRIB2 Data representation type (Grid Type) */
-#define  GRIB2_GTYPE_LATLON                0  /*  latitude/longitude                       */
-#define  GRIB2_GTYPE_LATLON_ROT            1  /*  rotated latitude/longitude               */
-#define  GRIB2_GTYPE_LATLON_STR            2  /*  stretched latitude/longitude             */
-#define  GRIB2_GTYPE_LATLON_ROTSTR         3  /*  rotated and stretched latitude/longitude */
-#define  GRIB2_GTYPE_GAUSSIAN             40  /*  gaussian grid                            */
-#define  GRIB2_GTYPE_GAUSSIAN_ROT         41  /*  rotated gaussian grid                    */
-#define  GRIB2_GTYPE_GAUSSIAN_STR         42  /*  stretched gaussian grid                  */
-#define  GRIB2_GTYPE_GAUSSIAN_ROTSTR      43  /*  rotated and stretched gaussian grid      */
-#define  GRIB2_GTYPE_LCC                  30  /*  Lambert conformal                        */
-#define  GRIB2_GTYPE_SPECTRAL             50  /*  spherical harmonics                      */
-#define  GRIB2_GTYPE_GME                 100  /*  hexagonal GME grid                       */
-#define  GRIB2_GTYPE_NUMBER              101  /*  General Unstructured Grid                */
+#define  GRIB2_GTYPE_LATLON                0  /*  latitude/longitude                                   */
+#define  GRIB2_GTYPE_LATLON_ROT            1  /*  rotated latitude/longitude                           */
+#define  GRIB2_GTYPE_LATLON_STR            2  /*  stretched latitude/longitude                         */
+#define  GRIB2_GTYPE_LATLON_ROTSTR         3  /*  rotated and stretched latitude/longitude             */
+#define  GRIB2_GTYPE_GAUSSIAN             40  /*  gaussian grid                                        */
+#define  GRIB2_GTYPE_GAUSSIAN_ROT         41  /*  rotated gaussian grid                                */
+#define  GRIB2_GTYPE_GAUSSIAN_STR         42  /*  stretched gaussian grid                              */
+#define  GRIB2_GTYPE_GAUSSIAN_ROTSTR      43  /*  rotated and stretched gaussian grid                  */
+#define  GRIB2_GTYPE_LCC                  30  /*  Lambert conformal                                    */
+#define  GRIB2_GTYPE_SPECTRAL             50  /*  spherical harmonics                                  */
+#define  GRIB2_GTYPE_GME                 100  /*  hexagonal GME grid                                   */
+#define  GRIB2_GTYPE_UNSTRUCTURED        101  /*  General Unstructured Grid                            */
 
 const char *gribapiLibraryVersion(void);
 void gribContainersNew(stream_t * streamptr);
diff --git a/libcdi/src/grid.c b/libcdi/src/grid.c
index b521f46..a909da0 100644
--- a/libcdi/src/grid.c
+++ b/libcdi/src/grid.c
@@ -4,10 +4,7 @@
 
 #include <string.h>
 #include <float.h>  /* FLT_EPSILON */
-
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
+#include <limits.h> /* INT_MAX     */
 
 #include "dmemory.h"
 #include "cdi.h"
@@ -16,8 +13,9 @@
 #include "gaussgrid.h"
 #include "pio_util.h"
 #include "resource_handle.h"
-#include "pio_rpc.h"
+#include "resource_unpack.h"
 #include "namespace.h"
+#include "serialize.h"
 
 #ifndef  RAD2DEG
 #define  RAD2DEG  (180./M_PI)   /* conversion for rad to deg */
@@ -44,25 +42,20 @@ char *Grids[] = {
   /* 12 */  "lcc2",
   /* 13 */  "laea",
   /* 14 */  "sinusoidal",
-  /* 15 */  "reference",
-  /* 16 */  "projection",
+  /* 15 */  "projection",
 };
 
 
 static int    gridCompareP    ( void * gridptr1, void * gridptr2 );
 static void   gridDestroyP    ( void * gridptr );
 static void   gridPrintP      ( void * gridptr, FILE * fp );
-#ifdef USE_MPI
-static int    gridGetPackSize ( void * gridptr, MPI_Comm comm );
+static int    gridGetPackSize ( void * gridptr, void *context);
 static void   gridPack        ( void * gridptr, void * buff, int size,
-				int *position, MPI_Comm comm );
+				int *position, void *context);
 static int    gridTxCode      ( void );
-#endif
 
 resOps gridOps = { gridCompareP, gridDestroyP, gridPrintP
-#ifdef USE_MPI
                    , gridGetPackSize, gridPack, gridTxCode
-#endif
 };
 
 
@@ -355,8 +348,7 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
     @Item  gridtype  The type of the grid, one of the set of predefined CDI grid types.
                      The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_GAUSSIAN},
                      @func{GRID_LONLAT}, @func{GRID_LCC}, @func{GRID_SPECTRAL},
-                     @func{GRID_GME}, @func{GRID_CURVILINEAR}, @func{GRID_UNSTRUCTURED} and
-                     @func{GRID_REFERENCE}.
+                     @func{GRID_GME}, @func{GRID_CURVILINEAR} and @func{GRID_UNSTRUCTURED} and.
     @Item  size      Number of gridpoints.
 
 @Description
@@ -395,6 +387,8 @@ int gridCreate(int gridtype, int size)
   if ( CDI_Debug )
     Message("gridtype: %d size: %d", gridtype, size);
 
+  if ( size < 0 || size > INT_MAX ) Error("grid size (%d) out of bounds (0 - %d)!", size, INT_MAX);
+
   gridInit ();
 
   gridptr = gridNewEntry();
@@ -966,7 +960,7 @@ The function @func{gridInqType} returns the type of a Grid.
 one of the set of predefined CDI grid types.
 The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_GAUSSIAN},
 @func{GRID_LONLAT}, @func{GRID_LCC}, @func{GRID_SPECTRAL}, @func{GRID_GME},
- at func{GRID_CURVILINEAR}, @func{GRID_UNSTRUCTURED} and @func{GRID_REFERENCE}.
+ at func{GRID_CURVILINEAR} and @func{GRID_UNSTRUCTURED}.
 
 @EndFunction
 */
@@ -1536,6 +1530,8 @@ int gridInqXvals(int gridID, double *xvals)
 
   if ( gridptr->type == GRID_CURVILINEAR || gridptr->type == GRID_UNSTRUCTURED )
     size = gridptr->size;
+  else if ( gridptr->type == GRID_GAUSSIAN_REDUCED )
+    size = 2;
   else
     size = gridptr->xsize;
 
@@ -1584,6 +1580,8 @@ void gridDefXvals(int gridID, const double *xvals)
 
   if ( gridtype == GRID_UNSTRUCTURED || gridtype == GRID_CURVILINEAR )
     size = gridptr->size;
+  else if ( gridtype == GRID_GAUSSIAN_REDUCED )
+    size = 2;
   else
     size = gridptr->xsize;
 
@@ -2356,6 +2354,9 @@ int compareXYvals2(int gridID, long gridsize, double *xvals, double *yvals)
 {
   int differ = 0;
 
+  if ( !differ && ((xvals == NULL && gridInqXvalsPtr(gridID) != NULL) || (xvals != NULL && gridInqXvalsPtr(gridID) == NULL)) ) differ = 1;
+  if ( !differ && ((yvals == NULL && gridInqYvalsPtr(gridID) != NULL) || (yvals != NULL && gridInqYvalsPtr(gridID) == NULL)) ) differ = 1;
+
   if ( !differ && xvals && gridInqXvalsPtr(gridID) )
     {
       if ( fabs(xvals[0] - gridInqXval(gridID, 0)) > 1.e-9 ||
@@ -2497,7 +2498,17 @@ int gridCompare(int gridID, grid_t grid)
 	    }
 	  else if ( grid.type == GRID_UNSTRUCTURED )
 	    {
-	      if ( grid.nvertex == gridInqNvertex(gridID) )
+              char uuidOfHGrid[17];
+              gridInqUUID(gridID, uuidOfHGrid);
+
+              if ( !differ && memcmp(uuidOfHGrid, grid.uuid, 16) != 0 ) differ = 1;
+
+              if ( !differ && grid.nvertex != gridInqNvertex(gridID) ) differ = 1;
+
+              if ( !differ && grid.number != gridInqNumber(gridID) ) differ = 1;
+              if ( !differ && grid.position != gridInqPosition(gridID) ) differ = 1;
+
+	      if ( !differ )
 		differ = compareXYvals2(gridID, grid.size, grid.xvals, grid.yvals);
 	    }
 	}
@@ -2795,6 +2806,20 @@ int gridGenerate(grid_t grid)
 		     grid.lcc_lat1, grid.lcc_lat2, grid.lcc_xinc, grid.lcc_yinc,
 		     grid.lcc_projflag, grid.lcc_scanflag);
 
+	if ( grid.type == GRID_UNSTRUCTURED )
+          {
+            int number = grid.number;
+            int position = grid.position;
+            if ( position < 0 ) position = 0;
+            if ( number > 0 )
+              {
+                gridDefNumber(gridID, number);
+                gridDefPosition(gridID, position);
+              }
+            if ( grid.uuid[0] != 0 ) gridDefUUID(gridID, grid.uuid);
+            if ( grid.reference ) gridDefReference(gridID, grid.reference);
+          }
+
 	if ( grid.type == GRID_PROJECTION )
 	  {
 	    gridptr->name = strdup(grid.name);
@@ -2808,6 +2833,14 @@ int gridGenerate(grid_t grid)
 	gridDefYsize(gridID, grid.ysize);
 	gridDefRowlon(gridID, grid.ysize, grid.rowlon);
 
+        if ( grid.xdef == 2 )
+          {
+            double xvals[2];
+            xvals[0] = grid.xfirst;
+            xvals[1] = grid.xlast;
+            gridDefXvals(gridID, xvals);
+          }
+
 	if ( grid.ydef == 1 )
 	  {
 	    gridDefYvals(gridID, grid.yvals);
@@ -2845,14 +2878,6 @@ int gridGenerate(grid_t grid)
         gridDefGMEni3(gridID, grid.ni3);
         break;
       }
-    case GRID_REFERENCE:
-      {
-        gridDefNumber(gridID, grid.number);
-        gridDefPosition(gridID, grid.position);
-        gridDefUUID(gridID, grid.uuid);
-        if ( grid.reference ) gridDefReference(gridID, grid.reference);
-        break;
-      }
       /*
     case GRID_GENERIC:
       {
@@ -2935,6 +2960,8 @@ int gridDuplicate(int gridID)
   strcpy(gridptrnew->xstdname, gridptr->xstdname);
   strcpy(gridptrnew->ystdname, gridptr->ystdname);
 
+  if ( gridptr->reference )  gridptrnew->reference = strdupx(gridptr->reference);
+
   nrowlon = gridptr->nrowlon;
   if ( nrowlon )
     {
@@ -3453,19 +3480,26 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
 
   if ( type != GRID_GME )
     {
-      if ( gridptr->xname[0]     )     fprintf(fp, "xname     = %s\n", gridptr->xname);
-      if ( gridptr->xlongname[0] )     fprintf(fp, "xlongname = %s\n", gridptr->xlongname);
-      if ( gridptr->xunits[0]    )     fprintf(fp, "xunits    = %s\n", gridptr->xunits);
-      if ( gridptr->yname[0]     )     fprintf(fp, "yname     = %s\n", gridptr->yname);
-      if ( gridptr->ylongname[0] )     fprintf(fp, "ylongname = %s\n", gridptr->ylongname);
-      if ( gridptr->yunits[0]    )     fprintf(fp, "yunits    = %s\n", gridptr->yunits);
-      if ( type == GRID_UNSTRUCTURED ) fprintf(fp, "nvertex   = %d\n", nvertex);
+      if ( xvals )
+        {
+          if ( gridptr->xname[0]     )     fprintf(fp, "xname     = %s\n", gridptr->xname);
+          if ( gridptr->xlongname[0] )     fprintf(fp, "xlongname = %s\n", gridptr->xlongname);
+          if ( gridptr->xunits[0]    )     fprintf(fp, "xunits    = %s\n", gridptr->xunits);
+        }
+      if ( yvals )
+        {
+          if ( gridptr->yname[0]     )     fprintf(fp, "yname     = %s\n", gridptr->yname);
+          if ( gridptr->ylongname[0] )     fprintf(fp, "ylongname = %s\n", gridptr->ylongname);
+          if ( gridptr->yunits[0]    )     fprintf(fp, "yunits    = %s\n", gridptr->yunits);
+        }
+      if ( type == GRID_UNSTRUCTURED && nvertex > 0 ) fprintf(fp, "nvertex   = %d\n", nvertex);
     }
 
   switch (type)
     {
     case GRID_LONLAT:
     case GRID_GAUSSIAN:
+    case GRID_GAUSSIAN_REDUCED:
     case GRID_GENERIC:
     case GRID_LCC2:
     case GRID_SINUSOIDAL:
@@ -3473,13 +3507,18 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
     case GRID_CURVILINEAR:
     case GRID_UNSTRUCTURED:
       {
-        if ( type == GRID_GAUSSIAN ) fprintf(fp, "np        = %d\n", gridptr->np);
+        if ( type == GRID_GAUSSIAN || type == GRID_GAUSSIAN_REDUCED ) fprintf(fp, "np        = %d\n", gridptr->np);
 
 	if ( type == GRID_CURVILINEAR || type == GRID_UNSTRUCTURED )
 	  {
 	    xdim = gridsize;
 	    ydim = gridsize;
 	  }
+        else if ( type == GRID_GAUSSIAN_REDUCED )
+          {
+	    xdim = 2;
+	    ydim = ysize;
+          }
 	else
 	  {
 	    xdim = xsize;
@@ -3492,6 +3531,31 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
 	    if ( ysize > 0 ) fprintf(fp, "ysize     = %d\n", ysize);
 	  }
 
+	if ( type == GRID_UNSTRUCTURED )
+          {
+            int number = gridInqNumber(gridID);
+            int position = gridInqPosition(gridID);
+            // const unsigned char *d;
+            if ( number > 0 )
+              {
+                fprintf(fp, "number    = %d\n", number);
+                if ( position >= 0 ) fprintf(fp, "position  = %d\n", position);
+              }
+            /*
+              gridInqUUID(gridID, uuidOfHGrid);
+              d = (unsigned char *) &uuidOfHGrid;
+              fprintf(fp, "uuid      = %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
+              d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
+              d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
+            */
+            if ( gridInqReference(gridID, NULL) )
+              {
+                char reference_link[8192];
+                gridInqReference(gridID, reference_link);
+                fprintf(fp, "uri       = %s\n", reference_link);
+              }
+          }
+
 	if ( type == GRID_LAEA )
 	  {
 	    double a = 0, lon_0 = 0, lat_0 = 0;
@@ -3630,28 +3694,28 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
 	      }
 	    fprintf(fp, "\n");
 	  }
-	break;
-      }
-   case GRID_GAUSSIAN_REDUCED:
-      {
-	int *rowlon;
-	fprintf(fp, "ysize = %d\n", ysize);
-	nbyte0 = fprintf(fp, "rowlon = %d  ", ysize);
-	nbyte  = nbyte0;
-	rowlon = (int *) malloc(ysize*sizeof(int));
-	gridInqRowlon(gridID, rowlon);
-	for ( i = 0; i < ysize; i++ )
-	  {
-	    if ( nbyte > 80 )
-	      {
-		fprintf(fp, "\n");
-		fprintf(fp, "%*s", nbyte0, "");
-		nbyte = nbyte0;
-	      }
-	    nbyte += fprintf(fp, "%d ", rowlon[i]);
-	  }
-	fprintf(fp, "\n");
-	free(rowlon);
+
+        if ( type == GRID_GAUSSIAN_REDUCED )
+          {
+            int *rowlon;
+            nbyte0 = fprintf(fp, "rowlon    = ");
+            nbyte  = nbyte0;
+            rowlon = (int *) malloc(ysize*sizeof(int));
+            gridInqRowlon(gridID, rowlon);
+            for ( i = 0; i < ysize; i++ )
+              {
+                if ( nbyte > 80 )
+                  {
+                    fprintf(fp, "\n");
+                    fprintf(fp, "%*s", nbyte0, "");
+                    nbyte = nbyte0;
+                  }
+                nbyte += fprintf(fp, "%d ", rowlon[i]);
+              }
+            fprintf(fp, "\n");
+            free(rowlon);
+          }
+
 	break;
       }
     case GRID_LCC:
@@ -3694,26 +3758,6 @@ void gridPrintKernel(grid_t * gridptr, int opt, FILE *fp)
         fprintf(fp, "ni        = %d\n", gridptr->ni );
         break;
       }
-    case GRID_REFERENCE:
-      {
-        // const unsigned char *d;
-	fprintf(fp, "number    = %d\n", gridInqNumber(gridID));
-	fprintf(fp, "position  = %d\n", gridInqPosition(gridID));
-        /*
-        gridInqUUID(gridID, uuidOfHGrid);
-        d = (unsigned char *) &uuidOfHGrid;
-	fprintf(fp, "uuid      = %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", 
-                d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
-                d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
-        */
-	if ( gridInqReference(gridID, NULL) )
-	  {
-	    char reference_link[8192];
-	    gridInqReference(gridID, reference_link);
-	    fprintf(fp, "path      = %s\n", reference_link);
-	  }
-	break;
-      }
    default:
       {
 	fprintf(stderr, "Unsupported grid type: %s\n", gridNamePtr(type));
@@ -3856,7 +3900,7 @@ const double *gridInqYvalsPtr(int gridID)
     @Item  yinc      Y-direction grid lenght in meter.
     @Item  projflag  Projection centre flag.
     @Item  scanflag  Scanning mode flag.
- 
+
 @Description
 The function @func{gridDefLCC} defines the parameter of a Lambert Conformal Conic grid.
 
@@ -4089,20 +4133,21 @@ int gridInqComplexPacking(int gridID)
   return (lcomplex);
 }
 
+/*
+ at Function  gridDefNumber
+ at Title     Define the reference number for an unstructured grid
 
-int gridInqNumber(int gridID)
-{
-  grid_t *gridptr;
-
-  gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
-
-  grid_check_ptr(gridID, gridptr);
-
-  return (gridptr->number);
-}
+ at Prototype void gridDefNumber(int gridID, const int number)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  number   Reference number for an unstructured grid.
 
+ at Description
+The function @func{gridDefNumber} defines the reference number for an unstructured grid.
 
-void gridDefNumber(int gridID, int number)
+ at EndFunction
+*/
+void gridDefNumber(int gridID, const int number)
 {
   grid_t *gridptr;
 
@@ -4119,8 +4164,22 @@ void gridDefNumber(int gridID, int number)
   gridptr->number = number;
 }
 
+/*
+ at Function  gridInqNumber
+ at Title     Get the reference number to an unstructured grid
 
-int gridInqPosition(int gridID)
+ at Prototype int gridInqNumber(int gridID)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+
+ at Description
+The function @func{gridInqNumber} returns the reference number to an unstructured grid.
+
+ at Result
+ at func{gridInqNumber} returns the reference number to an unstructured grid.
+ at EndFunction
+*/
+int gridInqNumber(int gridID)
 {
   grid_t *gridptr;
 
@@ -4128,10 +4187,23 @@ int gridInqPosition(int gridID)
 
   grid_check_ptr(gridID, gridptr);
 
-  return (gridptr->position);
+  return (gridptr->number);
 }
 
+/*
+ at Function  gridDefPosition
+ at Title     Define the position of grid in the reference file
+
+ at Prototype void gridDefPosition(int gridID, const int position)
+ at Parameter
+    @Item  gridID     Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  position   Position of grid in the reference file.
 
+ at Description
+The function @func{gridDefPosition} defines the position of grid in the reference file.
+
+ at EndFunction
+*/
 void gridDefPosition(int gridID, int position)
 {
   grid_t *gridptr;
@@ -4149,28 +4221,46 @@ void gridDefPosition(int gridID, int position)
   gridptr->position = position;
 }
 
+/*
+ at Function  gridInqPosition
+ at Title     Get the position of grid in the reference file
 
-int gridInqReference(int gridID, char *reference)
+ at Prototype int gridInqPosition(int gridID)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+
+ at Description
+The function @func{gridInqPosition} returns the position of grid in the reference file.
+
+ at Result
+ at func{gridInqPosition} returns the position of grid in the reference file.
+ at EndFunction
+*/
+int gridInqPosition(int gridID)
 {
   grid_t *gridptr;
-  int len = 0;
 
   gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
 
   grid_check_ptr(gridID, gridptr);
 
-  if ( gridptr->reference )
-    {
-      len = (int) strlen(gridptr->reference);
+  return (gridptr->position);
+}
 
-      if ( reference )
-        strcpy(reference, gridptr->reference);
-    }
+/*
+ at Function  gridDefReference
+ at Title     Define the reference URI for an unstructured grid
 
-  return (len);
-}
+ at Prototype void gridDefReference(int gridID, const char *reference)
+ at Parameter
+    @Item  gridID      Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  reference   Reference URI for an unstructured grid.
 
+ at Description
+The function @func{gridDefReference} defines the reference URI for an unstructured grid.
 
+ at EndFunction
+*/
 void gridDefReference(int gridID, const char *reference)
 {
   grid_t *gridptr;
@@ -4197,26 +4287,55 @@ void gridDefReference(int gridID, const char *reference)
     }
 }
 
+/*
+ at Function  gridInqReference
+ at Title     Get the reference URI to an unstructured grid
 
-void gridGetIndexList ( int ngrids, int * gridIndexList )
-{
-  reshGetResHListOfType ( ngrids, gridIndexList, &gridOps );
-}
+ at Prototype char *gridInqReference(int gridID, char *reference)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
 
-char *gridInqUUID(int gridID, char *uuid)
+ at Description
+The function @func{gridInqReference} returns the reference URI to an unstructured grid.
+
+ at Result
+ at func{gridInqReference} returns the reference URI to an unstructured grid.
+ at EndFunction
+*/
+int gridInqReference(int gridID, char *reference)
 {
   grid_t *gridptr;
+  int len = 0;
 
   gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
 
   grid_check_ptr(gridID, gridptr);
 
-  memcpy(uuid, gridptr->uuid, 16);
+  if ( gridptr->reference )
+    {
+      len = (int) strlen(gridptr->reference);
 
-  return (uuid);
+      if ( reference )
+        strcpy(reference, gridptr->reference);
+    }
+
+  return (len);
 }
 
+/*
+ at Function  gridDefUUID
+ at Title     Define the UUID for an unstructured grid
+
+ at Prototype void gridDefUUID(int gridID, const char *uuid)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+    @Item  uuid     UUID for an unstructured grid.
+
+ at Description
+The function @func{gridDefUUID} defines the UUID for an unstructured grid.
 
+ at EndFunction
+*/
 void gridDefUUID(int gridID, const char *uuid)
 {
   grid_t *gridptr;
@@ -4236,8 +4355,40 @@ void gridDefUUID(int gridID, const char *uuid)
   return;
 }
 
+/*
+ at Function  gridInqUUID
+ at Title     Get the UUID to an unstructured grid
+
+ at Prototype char *gridInqUUID(int gridID, char *uuid)
+ at Parameter
+    @Item  gridID   Grid ID, from a previous call to @fref{gridCreate}.
+
+ at Description
+The function @func{gridInqUUID} returns the UUID to an unstructured grid.
+
+ at Result
+ at func{gridInqUUID} returns the UUID to an unstructured grid.
+ at EndFunction
+*/
+char *gridInqUUID(int gridID, char *uuid)
+{
+  grid_t *gridptr;
+
+  gridptr = ( grid_t *) reshGetVal ( gridID, &gridOps );
+
+  grid_check_ptr(gridID, gridptr);
+
+  memcpy(uuid, gridptr->uuid, 16);
+
+  return (uuid);
+}
+
+
+void gridGetIndexList ( int ngrids, int * gridIndexList )
+{
+  reshGetResHListOfType ( ngrids, gridIndexList, &gridOps );
+}
 
-#ifdef USE_MPI
 
 static int
 gridTxCode ()
@@ -4245,343 +4396,310 @@ gridTxCode ()
   return GRID;
 }
 
-enum { gridNint    = 26, 
-       gridNdouble = 24,
+enum { gridNint    = 27,
+       gridNdouble = 25,
        gridNstrings= 8,
-       mask        = 1 << 0,
-       mask_gme    = 1 << 1,
-       xvals       = 1 << 2,
-       yvals       = 1 << 3,
-       area        = 1 << 4,
-       xbounds     = 1 << 5,
-       ybounds     = 1 << 6,
-       reference   = 1 << 7,
-       rowlon      = 1 << 8
+       gridHasMaskFlag = 1 << 0,
+       gridHasGMEMaskFlag = 1 << 1,
+       gridHasXValsFlag = 1 << 2,
+       gridHasYValsFlag = 1 << 3,
+       gridHasAreaFlag = 1 << 4,
+       gridHasXBoundsFlag = 1 << 5,
+       gridHasYBoundsFlag = 1 << 6,
+       gridHasReferenceFlag = 1 << 7,
+       gridHasRowLonFlag = 1 << 8
 };
 
 
-static int getMemberMask ( grid_t * gridP )
+static int gridGetComponentFlags ( grid_t * gridP )
 {
-  int memberMask = 0;
-
-  if ( gridP->mask )       memberMask |= mask;
-  if ( gridP->mask_gme )   memberMask |= mask_gme;
-  if ( gridP->xvals )      memberMask |= xvals;
-  if ( gridP->yvals )      memberMask |= yvals; 
-  if ( gridP->area )       memberMask |= area;
-  if ( gridP->xbounds )    memberMask |= xbounds;
-  if ( gridP->ybounds )    memberMask |= ybounds;
-  if ( gridP->reference )  memberMask |= reference;
-  if ( gridP->rowlon )     memberMask |= rowlon;
-
-  return memberMask;
+  int flags = (gridHasMaskFlag & (int)((unsigned)(gridP->mask == NULL) - 1U))
+    | (gridHasGMEMaskFlag & (int)((unsigned)(gridP->mask_gme == NULL) - 1U))
+    | (gridHasXValsFlag & (int)((unsigned)(gridP->xvals == NULL) - 1U))
+    | (gridHasYValsFlag & (int)((unsigned)(gridP->yvals == NULL) - 1U))
+    | (gridHasAreaFlag & (int)((unsigned)(gridP->area == NULL) - 1U))
+    | (gridHasXBoundsFlag & (int)((unsigned)(gridP->xbounds == NULL) - 1U))
+    | (gridHasYBoundsFlag & (int)((unsigned)(gridP->ybounds == NULL) - 1U))
+    | (gridHasReferenceFlag & (int)((unsigned)(gridP->reference == NULL) - 1U))
+    | (gridHasRowLonFlag & (int)((unsigned)(gridP->rowlon == NULL) - 1U));
+
+  return flags;
 }
 
 
-static
-int gridGetPackSize ( void * voidP, MPI_Comm comm )
+static int
+gridGetPackSize(void * voidP, void *context)
 {
   grid_t * gridP = ( grid_t * ) voidP;
-  int packBuffSize = 0, size, count;
+  int packBuffSize = 0, count;
 
-  xmpi ( MPI_Pack_size ( gridNint + 1, MPI_INT, comm, &size ));
-  packBuffSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBuffSize += size;
+  packBuffSize += serializeGetSize(gridNint, DATATYPE_INT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
 
-  if ( gridP->rowlon )
+  if (gridP->rowlon)
     {
-      xassert ( gridP->nrowlon );
-
-      xmpi ( MPI_Pack_size ( gridP->nrowlon, MPI_INT, comm, &size ));
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
-    }  
+      xassert(gridP->nrowlon);
+      packBuffSize += serializeGetSize(gridP->nrowlon, DATATYPE_INT, context)
+        + serializeGetSize( 1, DATATYPE_FLT64, context);
+    }
 
-  xmpi ( MPI_Pack_size ( gridNdouble + 1, MPI_DOUBLE, comm, &size ));
-  packBuffSize += size;  
+  packBuffSize += serializeGetSize(gridNdouble, DATATYPE_FLT64, context);
 
-  if ( gridP->xvals )
+  if (gridP->xvals)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
-	count =  gridP->size;
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
+	count = gridP->size;
       else
-	count =  gridP->xsize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->xsize;
+      xassert(count);
+      packBuffSize += serializeGetSize(count + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->yvals )
+  if (gridP->yvals)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
-	count =  gridP->size;
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
+	count = gridP->size;
       else
-	count =  gridP->ysize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->ysize;
+      xassert(count);
+      packBuffSize += serializeGetSize(count + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->area )
+  if (gridP->area)
     {
-      xassert ( gridP->size );
-      
-      xmpi ( MPI_Pack_size ( gridP->size, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      xassert(gridP->size);
+      packBuffSize +=
+        serializeGetSize(gridP->size + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->xbounds )
+  if (gridP->xbounds)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
-	count = gridP->nvertex * gridP->size;
+      xassert(gridP->nvertex);
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
+	count = gridP->size;
       else
-	count = gridP->nvertex * gridP->xsize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->xsize;
+      xassert(count);
+      packBuffSize
+        += serializeGetSize(gridP->nvertex * count + 1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->ybounds )
+  if (gridP->ybounds)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
-	count = gridP->nvertex * gridP->size;
+      xassert(gridP->nvertex);
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
+	count = gridP->size;
       else
-	count = gridP->nvertex * gridP->ysize;
-      xassert ( count );
-      
-      xmpi ( MPI_Pack_size ( count, MPI_DOUBLE, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+	count = gridP->ysize;
+      xassert(count);
+      packBuffSize
+        += serializeGetSize(gridP->nvertex * count + 1, DATATYPE_FLT64, context);
     }
 
-  xmpi ( MPI_Pack_size ( gridNstrings * CDI_MAX_NAME , MPI_CHAR, comm, &size ));
-  packBuffSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBuffSize += size;
+  packBuffSize +=
+    serializeGetSize(gridNstrings * CDI_MAX_NAME , DATATYPE_TXT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
 
-  if ( gridP->reference )
+  if (gridP->reference)
     {
-      count = strlen ( gridP->reference ) + 1;
-      xmpi ( MPI_Pack_size ( 1, MPI_INT, comm, &size ));
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( count, MPI_CHAR, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      packBuffSize += serializeGetSize(1, DATATYPE_INT, context)
+        + serializeGetSize(strlen(gridP->reference) + 1, DATATYPE_TXT, context)
+        + serializeGetSize(1, DATATYPE_FLT64, context);
     }
- 
-  if ( gridP->mask )
+
+  if (gridP->mask)
     {
-      xassert ( gridP->size );
-      xmpi ( MPI_Pack_size ( gridP->size, MPI_UNSIGNED_CHAR, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      xassert(gridP->size);
+      packBuffSize
+        += serializeGetSize(gridP->size, DATATYPE_UCHAR, context)
+        + serializeGetSize(1, DATATYPE_FLT64, context);
     }
 
-  if ( gridP->mask_gme )
+  if (gridP->mask_gme)
     {
-      xassert ( gridP->size );
-      xmpi ( MPI_Pack_size ( gridP->size, MPI_UNSIGNED_CHAR, comm, &size ));     
-      packBuffSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBuffSize += size;
+      xassert(gridP->size);
+      packBuffSize += serializeGetSize(gridP->size, DATATYPE_UCHAR, context)
+        + serializeGetSize( 1, DATATYPE_FLT64, context);
     }
-  
-  return packBuffSize; 
+
+  return packBuffSize;
 }
 
 
-void gridUnpack ( char * unpackBuffer, int unpackBufferSize, 
-		  int * unpackBufferPos, int nspTarget, MPI_Comm comm )
+void
+gridUnpack(char * unpackBuffer, int unpackBufferSize,
+           int * unpackBufferPos, int nspTarget, void *context)
 {
   grid_t * gridP;
-  int intBuffer[gridNint + 1], memberMask, size, referenceSize;
-  double doubleBuffer[gridNdouble + 1], d;
+  int memberMask, size;
+  double d;
   char charBuffer[gridNstrings * CDI_MAX_NAME];
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      intBuffer, gridNint + 1, MPI_INT, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &d, 1, MPI_DOUBLE, comm ));
-
-  xassert ( xchecksum ( DATATYPE_INT , gridNint + 1, intBuffer ) == d );
-
-  gridInit ();
+  gridInit();
 
   gridP = gridNewEntry();
-  xassert ( gridP );
-
-  xassert ( namespaceAdaptKey ( intBuffer[0], nspTarget ) == gridP->self );
-
-  gridP->type          =   intBuffer[1] ;
-  gridP->prec          =   intBuffer[2] ;
-  gridP->lcc_projflag  =   intBuffer[3] ;
-  gridP->lcc_scanflag  =   intBuffer[4] ;
-  gridP->lcc_defined   =   intBuffer[5] ;
-  gridP->lcc2_defined  =   intBuffer[6] ;
-  gridP->laea_defined  =   intBuffer[7] ;
-  gridP->isCyclic      =   intBuffer[8] ;
-  gridP->isRotated     =   intBuffer[9] ;
-  gridP->xdef          =   intBuffer[10] ;
-  gridP->ydef          =   intBuffer[11];
-  gridP->nd            =   intBuffer[12];
-  gridP->ni            =   intBuffer[13];
-  gridP->ni2           =   intBuffer[14];
-  gridP->ni3           =   intBuffer[15];
-  gridP->number        =   intBuffer[16];
-  gridP->position      =   intBuffer[17];
-  gridP->trunc         =   intBuffer[18];
-  gridP->nvertex       =   intBuffer[19];
-  gridP->nrowlon       =   intBuffer[20];
-  gridP->size          =   intBuffer[21];
-  gridP->xsize         =   intBuffer[22];
-  gridP->ysize         =   intBuffer[23];
-  gridP->locked        =   intBuffer[24];
-  gridP->lcomplex      =   intBuffer[25];
-  memberMask           =   intBuffer[26];
-
-  if ( memberMask & rowlon )
+  xassert(gridP);
+  {
+    int intBuffer[gridNint];
+    serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                    intBuffer, gridNint, DATATYPE_INT, context);
+    serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                    &d, 1, DATATYPE_FLT64, context);
+
+    xassert(xchecksum(DATATYPE_INT, gridNint, intBuffer) == d);
+    xassert(namespaceAdaptKey(intBuffer[0], nspTarget) == gridP->self);
+
+    gridP->type          =   intBuffer[1];
+    gridP->prec          =   intBuffer[2];
+    gridP->lcc_projflag  =   intBuffer[3];
+    gridP->lcc_scanflag  =   intBuffer[4];
+    gridP->lcc_defined   =   intBuffer[5];
+    gridP->lcc2_defined  =   intBuffer[6];
+    gridP->laea_defined  =   intBuffer[7];
+    gridP->isCyclic      =   intBuffer[8];
+    gridP->isRotated     =   intBuffer[9];
+    gridP->xdef          =   intBuffer[10];
+    gridP->ydef          =   intBuffer[11];
+    gridP->nd            =   intBuffer[12];
+    gridP->ni            =   intBuffer[13];
+    gridP->ni2           =   intBuffer[14];
+    gridP->ni3           =   intBuffer[15];
+    gridP->number        =   intBuffer[16];
+    gridP->position      =   intBuffer[17];
+    gridP->trunc         =   intBuffer[18];
+    gridP->nvertex       =   intBuffer[19];
+    gridP->nrowlon       =   intBuffer[20];
+    gridP->size          =   intBuffer[21];
+    gridP->xsize         =   intBuffer[22];
+    gridP->ysize         =   intBuffer[23];
+    gridP->locked        =   intBuffer[24];
+    gridP->lcomplex      =   intBuffer[25];
+    memberMask           =   intBuffer[26];
+  }
+
+  if (memberMask & gridHasRowLonFlag)
     {
-      xassert ( gridP->nrowlon );
-      gridP->rowlon = xmalloc ( gridP->nrowlon * sizeof ( int ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			gridP->rowlon, gridP->nrowlon , MPI_INT, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_INT , gridP->nrowlon, gridP->rowlon ) == d );
-    } 
-
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      doubleBuffer, gridNdouble + 1, MPI_DOUBLE, comm ));
-
-  xassert ( doubleBuffer[24] == xchecksum ( DATATYPE_FLT, gridNdouble, 
-                                            doubleBuffer ));
-
-  gridP->xfirst        =   doubleBuffer[0] ;       
-  gridP->yfirst	       =   doubleBuffer[1] ;
-  gridP->xlast	       =   doubleBuffer[2] ;
-  gridP->ylast	       =   doubleBuffer[3] ;
-  gridP->xinc	       =   doubleBuffer[4] ;
-  gridP->yinc	       =   doubleBuffer[5] ;
-  gridP->lcc_originLon =   doubleBuffer[6] ;         
-  gridP->lcc_originLat =   doubleBuffer[7] ;
-  gridP->lcc_lonParY   =   doubleBuffer[8] ;
-  gridP->lcc_lat1      =   doubleBuffer[9] ;
-  gridP->lcc_lat2      =   doubleBuffer[10];
-  gridP->lcc_xinc      =   doubleBuffer[11];
-  gridP->lcc_yinc      =   doubleBuffer[12];
-  gridP->lcc2_lon_0    =   doubleBuffer[13];         
-  gridP->lcc2_lat_0    =   doubleBuffer[14];
-  gridP->lcc2_lat_1    =   doubleBuffer[15];
-  gridP->lcc2_lat_2    =   doubleBuffer[16];
-  gridP->lcc2_a	       =   doubleBuffer[17];
-  gridP->laea_lon_0    =   doubleBuffer[18];         
-  gridP->laea_lat_0    =   doubleBuffer[19];
-  gridP->laea_a	       =   doubleBuffer[20];
-  gridP->xpole 	       =   doubleBuffer[21];
-  gridP->ypole	       =   doubleBuffer[22];
-  gridP->angle         =   doubleBuffer[23]; 
-
-  if ( memberMask & xvals )
+      xassert(gridP->nrowlon);
+      gridP->rowlon = xmalloc(gridP->nrowlon * sizeof (int));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->rowlon, gridP->nrowlon , DATATYPE_INT, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_INT, gridP->nrowlon, gridP->rowlon) == d);
+    }
+
+  {
+    double doubleBuffer[gridNdouble];
+    serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                    doubleBuffer, gridNdouble, DATATYPE_FLT64, context);
+    xassert(doubleBuffer[24]
+            == xchecksum(DATATYPE_FLT, gridNdouble, doubleBuffer));
+
+    gridP->xfirst = doubleBuffer[0];
+    gridP->yfirst = doubleBuffer[1];
+    gridP->xlast = doubleBuffer[2];
+    gridP->ylast = doubleBuffer[3];
+    gridP->xinc = doubleBuffer[4];
+    gridP->yinc = doubleBuffer[5];
+    gridP->lcc_originLon = doubleBuffer[6];
+    gridP->lcc_originLat = doubleBuffer[7];
+    gridP->lcc_lonParY = doubleBuffer[8];
+    gridP->lcc_lat1 = doubleBuffer[9];
+    gridP->lcc_lat2 = doubleBuffer[10];
+    gridP->lcc_xinc = doubleBuffer[11];
+    gridP->lcc_yinc = doubleBuffer[12];
+    gridP->lcc2_lon_0 = doubleBuffer[13];
+    gridP->lcc2_lat_0 = doubleBuffer[14];
+    gridP->lcc2_lat_1 = doubleBuffer[15];
+    gridP->lcc2_lat_2 = doubleBuffer[16];
+    gridP->lcc2_a = doubleBuffer[17];
+    gridP->laea_lon_0 = doubleBuffer[18];
+    gridP->laea_lat_0 = doubleBuffer[19];
+    gridP->laea_a = doubleBuffer[20];
+    gridP->xpole = doubleBuffer[21];
+    gridP->ypole = doubleBuffer[22];
+    gridP->angle = doubleBuffer[23];
+  }
+
+  if (memberMask & gridHasXValsFlag)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
 	size = gridP->size;
       else
 	size = gridP->xsize;
-      
-      gridP->xvals =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->xvals, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->xvals ) == d );
+
+      gridP->xvals = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->xvals, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->xvals) == d );
     }
 
-  if ( memberMask & yvals )
+  if (memberMask & gridHasYValsFlag)
     {
       if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
 	size = gridP->size;
       else
 	size = gridP->ysize;
-      
-      gridP->yvals =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->yvals, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->yvals ) == d );
+
+      gridP->yvals =  xmalloc( size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->yvals, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->yvals ) == d);
     }
 
-  if ( memberMask & area )
+  if (memberMask & gridHasAreaFlag)
     {
-      xassert ( gridP->size );
-      
-      gridP->area =  xmalloc( gridP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->area, gridP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, gridP->size, gridP->area ) == d );
+      xassert((size = gridP->size));
+      gridP->area = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->area, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->area) == d);
     }
 
-  if ( memberMask & xbounds )
+  if (memberMask & gridHasXBoundsFlag)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->xsize;
-      xassert ( size );
-      
-      gridP->xbounds =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->xbounds, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->xbounds ) == d );
+      xassert(size);
+
+      gridP->xbounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->xbounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->xbounds ) == d);
     }
 
-  if ( memberMask & ybounds )
+  if (memberMask & gridHasYBoundsFlag)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->ysize;
-      xassert ( size );
-      
-      gridP->ybounds =  xmalloc( size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->ybounds, size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, size, gridP->ybounds ) == d );
+      xassert(size);
+
+      gridP->ybounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+			  gridP->ybounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, gridP->ybounds ) == d);
     }
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      charBuffer, gridNstrings * CDI_MAX_NAME, MPI_CHAR, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( d == xchecksum ( DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, 
-                             charBuffer ));
+  xassert(d == xchecksum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer));
 
   memcpy ( gridP->xname    , &charBuffer[CDI_MAX_NAME * 0], CDI_MAX_NAME );
   memcpy ( gridP->yname    , &charBuffer[CDI_MAX_NAME * 1], CDI_MAX_NAME );
@@ -4592,197 +4710,203 @@ void gridUnpack ( char * unpackBuffer, int unpackBufferSize,
   memcpy ( gridP->xunits   , &charBuffer[CDI_MAX_NAME * 6], CDI_MAX_NAME );
   memcpy ( gridP->yunits   , &charBuffer[CDI_MAX_NAME * 7], CDI_MAX_NAME );
 
-  if ( memberMask & reference )
+  if (memberMask & gridHasReferenceFlag)
     {
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &referenceSize, 1, MPI_INT, comm ));
-      gridP->reference = xmalloc ( referenceSize );
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->reference, referenceSize, MPI_CHAR, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_TXT, referenceSize, 
-                            gridP->reference ) == d );
+      int referenceSize;
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &referenceSize, 1, DATATYPE_INT, context);
+      gridP->reference = xmalloc(referenceSize);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->reference, referenceSize, DATATYPE_TXT, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_TXT, referenceSize, gridP->reference ) == d );
     }
 
-  if ( memberMask & mask )
+  if (memberMask & gridHasMaskFlag)
     {
-      xassert ( gridP->size );
-      gridP->mask = xmalloc ( gridP->size * sizeof ( mask_t ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->mask, gridP->size, MPI_UNSIGNED_CHAR, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask ) == d );
+      xassert((size = gridP->size));
+      gridP->mask = xmalloc(size * sizeof (mask_t));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->mask, gridP->size, DATATYPE_UCHAR, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_TXT, gridP->size, gridP->mask ) == d);
     }
 
-  if ( memberMask & mask_gme )
+  if (memberMask & gridHasGMEMaskFlag)
     {
-      xassert ( gridP->size );
-      gridP->mask_gme = xmalloc ( gridP->size * sizeof ( mask_t ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  gridP->mask_gme, gridP->size, MPI_UNSIGNED_CHAR, 
-                          comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-			  &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask_gme ) == d );
+      xassert((size = gridP->size));
+      gridP->mask_gme = xmalloc(size * sizeof (mask_t));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      gridP->mask_gme, gridP->size, DATATYPE_UCHAR, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_TXT, gridP->size, gridP->mask_gme ) == d);
     }
-} 							       
+}
 
 
-static
-void gridPack ( void * voidP, void * packBuffer, int packBufferSize, 
-		int * packBufferPos, MPI_Comm comm )
+static void
+gridPack(void * voidP, void * packBuffer, int packBufferSize,
+         int * packBufferPos, void *context)
 {
   grid_t   * gridP = ( grid_t * )   voidP;
-  int intBuffer[gridNint + 1], size;
-  double doubleBuffer[gridNdouble + 1], d;
+  int size;
+  double d;
   char charBuffer[gridNstrings * CDI_MAX_NAME];
 
-  intBuffer[0]  = gridP->self;
-  intBuffer[1]  = gridP->type;
-  intBuffer[2]  = gridP->prec;
-  intBuffer[3]  = gridP->lcc_projflag;
-  intBuffer[4]  = gridP->lcc_scanflag;
-  intBuffer[5]  = gridP->lcc_defined;
-  intBuffer[6]  = gridP->lcc2_defined;
-  intBuffer[7]  = gridP->laea_defined;
-  intBuffer[8]  = gridP->isCyclic;
-  intBuffer[9]  = gridP->isRotated; 
-  intBuffer[10] = gridP->xdef; 
-  intBuffer[11] = gridP->ydef;
-  intBuffer[12] = gridP->nd;
-  intBuffer[13] = gridP->ni;
-  intBuffer[14] = gridP->ni2;
-  intBuffer[15] = gridP->ni3; 
-  intBuffer[16] = gridP->number;
-  intBuffer[17] = gridP->position;
-  intBuffer[18] = gridP->trunc;
-  intBuffer[19] = gridP->nvertex;
-  intBuffer[20] = gridP->nrowlon;
-  intBuffer[21] = gridP->size;
-  intBuffer[22] = gridP->xsize;
-  intBuffer[23] = gridP->ysize;
-  intBuffer[24] = gridP->locked;
-  intBuffer[25] = gridP->lcomplex;
-  intBuffer[26] = getMemberMask ( gridP );
-  
-  xmpi ( MPI_Pack ( intBuffer, gridNint + 1, MPI_INT, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT , gridNint + 1, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-
-  if ( gridP->rowlon )
+  {
+    int intBuffer[gridNint];
+
+    intBuffer[0]  = gridP->self;
+    intBuffer[1]  = gridP->type;
+    intBuffer[2]  = gridP->prec;
+    intBuffer[3]  = gridP->lcc_projflag;
+    intBuffer[4]  = gridP->lcc_scanflag;
+    intBuffer[5]  = gridP->lcc_defined;
+    intBuffer[6]  = gridP->lcc2_defined;
+    intBuffer[7]  = gridP->laea_defined;
+    intBuffer[8]  = gridP->isCyclic;
+    intBuffer[9]  = gridP->isRotated;
+    intBuffer[10] = gridP->xdef;
+    intBuffer[11] = gridP->ydef;
+    intBuffer[12] = gridP->nd;
+    intBuffer[13] = gridP->ni;
+    intBuffer[14] = gridP->ni2;
+    intBuffer[15] = gridP->ni3;
+    intBuffer[16] = gridP->number;
+    intBuffer[17] = gridP->position;
+    intBuffer[18] = gridP->trunc;
+    intBuffer[19] = gridP->nvertex;
+    intBuffer[20] = gridP->nrowlon;
+    intBuffer[21] = gridP->size;
+    intBuffer[22] = gridP->xsize;
+    intBuffer[23] = gridP->ysize;
+    intBuffer[24] = gridP->locked;
+    intBuffer[25] = gridP->lcomplex;
+    intBuffer[26] = gridGetComponentFlags(gridP);
+
+    serializePack(intBuffer, gridNint, DATATYPE_INT,
+                  packBuffer, packBufferSize, packBufferPos, context);
+    d = xchecksum(DATATYPE_INT, gridNint, intBuffer);
+    serializePack(&d, 1, DATATYPE_FLT64,
+                  packBuffer, packBufferSize, packBufferPos, context);
+  }
+
+  if (gridP->rowlon)
     {
-      xassert ( gridP->nrowlon );
-      xmpi ( MPI_Pack ( gridP->rowlon, gridP->nrowlon, MPI_INT,
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_INT , gridP->nrowlon, gridP->rowlon );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
-    }  
-
-  doubleBuffer[0]  = gridP->xfirst;         
-  doubleBuffer[1]  = gridP->yfirst;
-  doubleBuffer[2]  = gridP->xlast;
-  doubleBuffer[3]  = gridP->ylast;
-  doubleBuffer[4]  = gridP->xinc;
-  doubleBuffer[5]  = gridP->yinc;
-  doubleBuffer[6]  = gridP->lcc_originLon;          
-  doubleBuffer[7]  = gridP->lcc_originLat;
-  doubleBuffer[8]  = gridP->lcc_lonParY;
-  doubleBuffer[9]  = gridP->lcc_lat1;
-  doubleBuffer[10] = gridP->lcc_lat2;
-  doubleBuffer[11] = gridP->lcc_xinc;
-  doubleBuffer[12] = gridP->lcc_yinc;
-  doubleBuffer[13] = gridP->lcc2_lon_0;             
-  doubleBuffer[14] = gridP->lcc2_lat_0;
-  doubleBuffer[15] = gridP->lcc2_lat_1;
-  doubleBuffer[16] = gridP->lcc2_lat_2;
-  doubleBuffer[17] = gridP->lcc2_a;
-  doubleBuffer[18] = gridP->laea_lon_0;             
-  doubleBuffer[19] = gridP->laea_lat_0;
-  doubleBuffer[20] = gridP->laea_a;
-  doubleBuffer[21] = gridP->xpole; 
-  doubleBuffer[22] = gridP->ypole;
-  doubleBuffer[23] = gridP->angle;
-  doubleBuffer[24] = xchecksum ( DATATYPE_FLT, gridNdouble - 1, doubleBuffer );
-
-  xmpi ( MPI_Pack ( doubleBuffer, gridNdouble + 1, MPI_DOUBLE, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-
-  if ( gridP->xvals )
+      xassert((size = gridP->nrowlon));
+      serializePack(gridP->rowlon, size, DATATYPE_INT,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_INT , size, gridP->rowlon);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+    }
+
+  {
+    double doubleBuffer[gridNdouble];
+
+    doubleBuffer[0]  = gridP->xfirst;
+    doubleBuffer[1]  = gridP->yfirst;
+    doubleBuffer[2]  = gridP->xlast;
+    doubleBuffer[3]  = gridP->ylast;
+    doubleBuffer[4]  = gridP->xinc;
+    doubleBuffer[5]  = gridP->yinc;
+    doubleBuffer[6]  = gridP->lcc_originLon;
+    doubleBuffer[7]  = gridP->lcc_originLat;
+    doubleBuffer[8]  = gridP->lcc_lonParY;
+    doubleBuffer[9]  = gridP->lcc_lat1;
+    doubleBuffer[10] = gridP->lcc_lat2;
+    doubleBuffer[11] = gridP->lcc_xinc;
+    doubleBuffer[12] = gridP->lcc_yinc;
+    doubleBuffer[13] = gridP->lcc2_lon_0;
+    doubleBuffer[14] = gridP->lcc2_lat_0;
+    doubleBuffer[15] = gridP->lcc2_lat_1;
+    doubleBuffer[16] = gridP->lcc2_lat_2;
+    doubleBuffer[17] = gridP->lcc2_a;
+    doubleBuffer[18] = gridP->laea_lon_0;
+    doubleBuffer[19] = gridP->laea_lat_0;
+    doubleBuffer[20] = gridP->laea_a;
+    doubleBuffer[21] = gridP->xpole;
+    doubleBuffer[22] = gridP->ypole;
+    doubleBuffer[23] = gridP->angle;
+    doubleBuffer[24] = xchecksum(DATATYPE_FLT, gridNdouble - 1, doubleBuffer);
+
+    serializePack(doubleBuffer, gridNdouble, DATATYPE_FLT64,
+                  packBuffer, packBufferSize, packBufferPos, context);
+  }
+
+  if (gridP->xvals)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR)
 	size = gridP->size;
       else
 	size = gridP->xsize;
-      xassert ( size );
-      
-      xmpi ( MPI_Pack ( gridP->xvals, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->xvals );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(size);
+
+      serializePack(gridP->xvals, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->xvals);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->yvals )
+  if (gridP->yvals)
     {
-      if ( gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
+      if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR )
 	size = gridP->size;
       else
 	size = gridP->ysize;
-      xassert ( size );
-      
-      xmpi ( MPI_Pack ( gridP->yvals, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->yvals );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(size);
+      serializePack(gridP->yvals, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->yvals);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->area )
+  if (gridP->area)
     {
-      xassert ( gridP->size );
+      xassert(gridP->size);
 
-      xmpi ( MPI_Pack ( gridP->area, gridP->size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, gridP->size, gridP->area );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(gridP->area, gridP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, gridP->size, gridP->area);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->xbounds )
+  if (gridP->xbounds)
     {
       xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->xsize;
       xassert ( size );
 
-      xmpi ( MPI_Pack ( gridP->xbounds, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->xbounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(gridP->xbounds, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->xbounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->ybounds )
+  if (gridP->ybounds)
     {
-      xassert ( gridP->nvertex );
-      if ( gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED )
+      xassert(gridP->nvertex);
+      if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED)
 	size = gridP->nvertex * gridP->size;
       else
 	size = gridP->nvertex * gridP->ysize;
       xassert ( size );
 
-      xmpi ( MPI_Pack ( gridP->ybounds, size, MPI_DOUBLE, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, size, gridP->ybounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(gridP->ybounds, size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, size, gridP->ybounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
   memcpy ( &charBuffer[CDI_MAX_NAME * 0], gridP->xname,     CDI_MAX_NAME );
@@ -4794,48 +4918,46 @@ void gridPack ( void * voidP, void * packBuffer, int packBufferSize,
   memcpy ( &charBuffer[CDI_MAX_NAME * 6], gridP->xunits,    CDI_MAX_NAME );
   memcpy ( &charBuffer[CDI_MAX_NAME * 7], gridP->yunits,    CDI_MAX_NAME );
 
-  xmpi ( MPI_Pack ( charBuffer, gridNstrings * CDI_MAX_NAME, MPI_CHAR, 
-		    packBuffer, packBufferSize, packBufferPos, comm )); 
-  d = xchecksum  ( DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack( charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT,
+		    packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
 
   if ( gridP->reference )
     {
       size = strlen ( gridP->reference ) + 1;
-      xmpi ( MPI_Pack ( &size, 1, MPI_INT, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      xmpi ( MPI_Pack ( gridP->reference, size, MPI_CHAR, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_TXT, size, gridP->reference );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm )); 
+      serializePack(&size, 1, DATATYPE_INT,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      serializePack(gridP->reference, size, DATATYPE_TXT,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_TXT, size, gridP->reference);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
- 
+
   if ( gridP->mask )
     {
-      xassert ( gridP->size );
-      xmpi ( MPI_Pack ( gridP->mask, gridP->size, MPI_UNSIGNED_CHAR, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm )); 
+      xassert((size = gridP->size));
+      serializePack(gridP->mask, size, DATATYPE_UCHAR,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_TXT, size, gridP->mask);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( gridP->mask_gme )
+  if (gridP->mask_gme)
     {
-      xassert ( gridP->size );
+      xassert((size = gridP->size));
 
-      xmpi ( MPI_Pack ( gridP->mask_gme, gridP->size, MPI_UNSIGNED_CHAR, 
-			packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_TXT, gridP->size, gridP->mask );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-			packBuffer, packBufferSize, packBufferPos, comm )); 
+      serializePack(gridP->mask_gme, size, DATATYPE_UCHAR,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_TXT, size, gridP->mask);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 }
 
-#endif
-
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/institution.c b/libcdi/src/institution.c
index a7887e7..478571c 100644
--- a/libcdi/src/institution.c
+++ b/libcdi/src/institution.c
@@ -8,8 +8,9 @@
 #include "resource_handle.h"
 #include "pio_util.h"
 #include "resource_handle.h"
-#include "pio_rpc.h"
+#include "resource_unpack.h"
 #include "namespace.h"
+#include "serialize.h"
 
 #undef  UNDEFID
 #define UNDEFID  -1
@@ -34,16 +35,12 @@ institute_t;
 static int    instituteCompareP ( void * instituteptr1, void * instituteptr2 );
 static void   instituteDestroyP ( void * instituteptr );
 static void   institutePrintP   ( void * instituteptr, FILE * fp );
-#ifdef USE_MPI
-static int    instituteGetSizeP ( void * instituteptr, MPI_Comm comm );
-static void   institutePackP    ( void * instituteptr, void *buf, int size, int *position, MPI_Comm comm );
+static int    instituteGetSizeP ( void * instituteptr, void *context );
+static void   institutePackP    ( void * instituteptr, void *buf, int size, int *position, void *context );
 static int    instituteTxCode   ( void );
-#endif
 
 resOps instituteOps = { instituteCompareP, instituteDestroyP, institutePrintP
-#ifdef USE_MPI
                         ,instituteGetSizeP, institutePackP, instituteTxCode
-#endif
  };
 
 static int * instituteInitializedNsp;
@@ -93,9 +90,8 @@ void instituteDefaultEntries ( void )
   resH[11] =           institutDef( 99,   0, "KNMI",      "Royal Netherlands Meteorological Institute");
   /*     (void) institutDef(  0,   0, "IPSL", "IPSL (Institut Pierre Simon Laplace, Paris, France)"); */
 
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    for ( i = 0; i < 12 ; i++ )
-      reshSetStatus ( resH[i], &instituteOps, SUSPENDED );
+  for ( i = 0; i < 12 ; i++ )
+    reshSetStatus(resH[i], &instituteOps, SUSPENDED);
 }
 
 static
@@ -183,48 +179,45 @@ static int instituteCompareP ( void *  instituteptr1, void * instituteptr2 )
   return instituteCompareKernel ( i1, i2 );
 }
 
+struct instLoc
+{
+  institute_t *ip;
+  int id;
+};
 
-int institutInq(int center, int subcenter, const char *name, const char *longname)
+static enum cdiApplyRet
+findInstitute(int id, void *res, void *data)
 {
-  int instID = UNDEFID, instCount, * instResHs, i;
-  institute_t * ip1;
-  institute_t * ip2;
+  institute_t * ip1 = ((struct instLoc *)data)->ip;
+  institute_t * ip2 = res;
+  if (ip2->used && !instituteCompareKernel(ip1, ip2))
+    {
+      ((struct instLoc *)data)->id = id;
+      return CDI_APPLY_STOP;
+    }
+  else
+    return CDI_APPLY_GO_ON;
+}
 
-  instituteInit ();
 
-  ip1 = xmalloc ( sizeof ( institute_t ));
+int institutInq(int center, int subcenter, const char *name, const char *longname)
+{
+  instituteInit ();
 
-  ip1->self       = UNDEFID;
-  ip1->used       = 0;
-  ip1->center     = center;
-  ip1->subcenter  = subcenter;
-  ip1->name       = NULL;
-  ip1->longname   = NULL;
-  if ( name && *name )
-    ip1->name     = ( char * ) name;
-  if ( longname && *longname )
-    ip1->longname = ( char * ) longname;
+  institute_t * ip_ref = xmalloc(sizeof (*ip_ref));
+  ip_ref->self       = UNDEFID;
+  ip_ref->used       = 0;
+  ip_ref->center     = center;
+  ip_ref->subcenter  = subcenter;
+  ip_ref->name       = name && name[0] ? (char *)name : NULL;
+  ip_ref->longname   = longname && longname[0] ? (char *)longname : NULL;
 
-  instCount = instituteCount ();
-  instResHs = xmalloc ( instCount * sizeof ( int ));
-  reshGetResHListOfType ( instCount, instResHs, &instituteOps );
+  struct instLoc state = { .ip = ip_ref, .id = UNDEFID };
+  cdiResHFilterApply(&instituteOps, findInstitute, &state);
 
-  for ( i = 0; i < instCount; i++ )
-    {
-      ip2 = ( institute_t * ) reshGetVal ( instResHs[i], &instituteOps );
-      xassert ( ip2 );
+  free(ip_ref);
 
-      if ( ip2->used && ! instituteCompareKernel ( ip1, ip2 ))
-        {
-          instID = ip2->self;
-          break;
-        }
-    }
-
-  free ( instResHs );
-  free ( ip1 );
-
-  return  (instID);
+  return state.id;
 }
 
 
@@ -296,27 +289,21 @@ char *institutInqLongnamePtr(int instID)
   return instituteptr ? instituteptr->longname : NULL;
 }
 
+static enum cdiApplyRet
+activeInstitutes(int id, void *res, void *data)
+{
+  if (res && ((institute_t *)res)->used)
+    ++(*(int *)data);
+  return CDI_APPLY_GO_ON;
+}
 
 int institutInqNumber(void)
 {
-  int i, instCount, * instResHs, instNum = 0;
-  institute_t * instituteptr;
+  int instNum = 0;
 
   instituteInit ();
 
-  instCount = reshCountType ( &instituteOps );
-  instResHs = xmalloc ( instCount * sizeof ( int ));
-  reshGetResHListOfType ( instCount, instResHs, &instituteOps );
-
-  for ( i = 0; i < instCount; i++ )
-    {
-      instituteptr = ( institute_t * ) reshGetVal ( instResHs[i], &instituteOps );
-      if ( instituteptr && instituteptr->used )
-        instNum++;
-    }
-
-  if ( instResHs ) free ( instResHs );
-
+  cdiResHFilterApply(&instituteOps, activeInstitutes, &instNum);
   return instNum;
 }
 
@@ -354,7 +341,6 @@ void institutePrintP   ( void * instituteptr, FILE * fp )
 }
 
 
-#ifdef USE_MPI
 static int
 instituteTxCode ( void )
 {
@@ -365,22 +351,16 @@ enum {
   institute_nints = 5,
 };
 
-static
-int instituteGetSizeP ( void * instituteptr, MPI_Comm comm )
+static int instituteGetSizeP ( void * instituteptr, void *context)
 {
   institute_t *p = instituteptr;
-  int txsize = 0, txinc;
-  xmpi(MPI_Pack_size(institute_nints, MPI_INT, comm, &txsize));
-  xmpi(MPI_Pack_size(strlen(p->name) + 1, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
-  xmpi(MPI_Pack_size(strlen(p->longname) + 1, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
+  int txsize = serializeGetSize(institute_nints, DATATYPE_INT, context)
+    + serializeGetSize(strlen(p->name) + 1, DATATYPE_TXT, context)
+    + serializeGetSize(strlen(p->longname) + 1, DATATYPE_TXT, context);
   return txsize;
 }
 
-static
-void institutePackP ( void * instituteptr, void *buf, int size,
-                      int *position, MPI_Comm comm )
+static void institutePackP(void * instituteptr, void *buf, int size, int *position, void *context)
 {
   institute_t *p = instituteptr;
   int tempbuf[institute_nints];
@@ -389,30 +369,27 @@ void institutePackP ( void * instituteptr, void *buf, int size,
   tempbuf[2] = p->subcenter;
   tempbuf[3] = (int)strlen(p->name) + 1;
   tempbuf[4] = (int)strlen(p->longname) + 1;
-  xmpi(MPI_Pack(tempbuf, institute_nints, MPI_INT, buf, size, position, comm));
-  xmpi(MPI_Pack(p->name, tempbuf[3], MPI_CHAR, buf, size, position, comm));
-  xmpi(MPI_Pack(p->longname, tempbuf[4], MPI_CHAR, buf, size, position, comm));
+  serializePack(tempbuf, institute_nints, DATATYPE_INT, buf, size, position, context);
+  serializePack(p->name, tempbuf[3], DATATYPE_TXT, buf, size, position, context);
+  serializePack(p->longname, tempbuf[4], DATATYPE_TXT, buf, size, position, context);
 }
 
-int
-instituteUnpack(void *buf, int size, int *position, int nspTarget,
-                MPI_Comm comm)
+int instituteUnpack(void *buf, int size, int *position, int nspTarget, void *context)
 {
   int tempbuf[institute_nints];
   int instituteID;
   char *name, *longname;
-  xmpi(MPI_Unpack(buf, size, position, tempbuf, institute_nints, MPI_INT, comm));
+  serializeUnpack(buf, size, position, tempbuf, institute_nints, DATATYPE_INT, context);
   name = xmalloc(tempbuf[3]);
   longname = xmalloc(tempbuf[4]);
-  xmpi(MPI_Unpack(buf, size, position, name, tempbuf[3], MPI_CHAR, comm));
-  xmpi(MPI_Unpack(buf, size, position, longname, tempbuf[4], MPI_CHAR, comm));
+  serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
+  serializeUnpack(buf, size, position, longname, tempbuf[4], DATATYPE_TXT, context);
   instituteID = institutDef(tempbuf[1], tempbuf[2], name, longname);
   // FIXME: this should work, once all types are transferred
   //xassert(instituteID == tempbuf[0]);
   return instituteID;
 }
 
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/institution.h b/libcdi/src/institution.h
index 08deab1..536695b 100644
--- a/libcdi/src/institution.h
+++ b/libcdi/src/institution.h
@@ -1,11 +1,9 @@
 #ifndef INSTITUTION_H
 #define INSTITUTION_H
 
-#ifdef USE_MPI
 int
 instituteUnpack(void *buf, int size, int *position, int,
-                MPI_Comm comm);
-#endif
+                void *context);
 
 #endif
 
diff --git a/libcdi/src/mo_cdi.f90 b/libcdi/src/mo_cdi.f90
index c0e7b71..0468a44 100644
--- a/libcdi/src/mo_cdi.f90
+++ b/libcdi/src/mo_cdi.f90
@@ -6,6 +6,7 @@ module mo_cdi
 
       private
   
+      integer :: CDI_MAX_NAME = 256
       integer :: CDI_UNDEFID = -1
       integer :: CDI_GLOBAL = -1
       integer :: CDI_BIGENDIAN = 0
@@ -25,9 +26,10 @@ module mo_cdi
       integer :: FILETYPE_NC = 3
       integer :: FILETYPE_NC2 = 4
       integer :: FILETYPE_NC4 = 5
-      integer :: FILETYPE_SRV = 6
-      integer :: FILETYPE_EXT = 7
-      integer :: FILETYPE_IEG = 8
+      integer :: FILETYPE_NC4C = 6
+      integer :: FILETYPE_SRV = 7
+      integer :: FILETYPE_EXT = 8
+      integer :: FILETYPE_IEG = 9
       integer :: COMPRESS_NONE = 0
       integer :: COMPRESS_SZIP = 1
       integer :: COMPRESS_GZIP = 2
@@ -81,6 +83,10 @@ module mo_cdi
       integer :: DATATYPE_FLT = 252
       integer :: DATATYPE_TXT = 253
       integer :: DATATYPE_CPX = 254
+      integer :: DATATYPE_UCHAR = 255
+      integer :: CHUNK_AUTO = 1
+      integer :: CHUNK_GRID = 2
+      integer :: CHUNK_LINES = 3
       integer :: GRID_GENERIC = 1
       integer :: GRID_GAUSSIAN = 2
       integer :: GRID_GAUSSIAN_REDUCED = 3
@@ -95,6 +101,7 @@ module mo_cdi
       integer :: GRID_LCC2 = 12
       integer :: GRID_LAEA = 13
       integer :: GRID_SINUSOIDAL = 14
+      integer :: GRID_PROJECTION = 15
       integer :: ZAXIS_SURFACE = 0
       integer :: ZAXIS_GENERIC = 1
       integer :: ZAXIS_HYBRID = 2
@@ -108,10 +115,37 @@ module mo_cdi
       integer :: ZAXIS_ALTITUDE = 10
       integer :: ZAXIS_SIGMA = 11
       integer :: ZAXIS_MEANSEA = 12
+      integer :: ZAXIS_TOA = 13
+      integer :: ZAXIS_SEA_BOTTOM = 14
+      integer :: ZAXIS_ATMOSPHERE = 15
+      integer :: ZAXIS_CLOUD_BASE = 16
+      integer :: ZAXIS_CLOUD_TOP = 17
+      integer :: ZAXIS_ISOTHERM_ZERO = 18
+      integer :: ZAXIS_SNOW = 19
+      integer :: ZAXIS_LAKE_BOTTOM = 20
+      integer :: ZAXIS_SEDIMENT_BOTTOM = 21
+      integer :: ZAXIS_SEDIMENT_BOTTOM_TA = 22
+      integer :: ZAXIS_SEDIMENT_BOTTOM_TW = 23
+      integer :: ZAXIS_MIX_LAYER = 24
+      integer :: ZAXIS_REFERENCE = 25
+      integer :: TIME_CONSTANT = 0
+      integer :: TIME_VARIABLE = 1
+      integer :: TSTEP_CONSTANT = 0
+      integer :: TSTEP_INSTANT = 1
+      integer :: TSTEP_AVG = 2
+      integer :: TSTEP_ACCUM = 3
+      integer :: TSTEP_MAX = 4
+      integer :: TSTEP_MIN = 5
+      integer :: TSTEP_DIFF = 6
+      integer :: TSTEP_RMS = 7
+      integer :: TSTEP_SD = 8
+      integer :: TSTEP_COV = 9
+      integer :: TSTEP_RATIO = 10
+      integer :: TSTEP_RANGE = 11
+      integer :: TSTEP_INSTANT2 = 12
+      integer :: TSTEP_INSTANT3 = 13
       integer :: TAXIS_ABSOLUTE = 1
       integer :: TAXIS_RELATIVE = 2
-      integer :: TIME_CONSTANT = 1
-      integer :: TIME_VARIABLE = 2
       integer :: TUNIT_SECOND = 1
       integer :: TUNIT_MINUTE = 2
       integer :: TUNIT_HOUR = 3
@@ -122,23 +156,24 @@ module mo_cdi
       integer :: TUNIT_3HOURS = 8
       integer :: TUNIT_6HOURS = 9
       integer :: TUNIT_12HOURS = 10
-      integer :: TSTEP_INSTANT = 1
-      integer :: TSTEP_AVG = 2
-      integer :: TSTEP_ACCUM = 3
-      integer :: TSTEP_MAX = 4
-      integer :: TSTEP_MIN = 5
-      integer :: TSTEP_DIFF = 6
-      integer :: TSTEP_RANGE = 7
-      integer :: TSTEP_INSTANT2 = 8
-      integer :: TSTEP_INSTANT3 = 9
       integer :: CALENDAR_STANDARD = 0
       integer :: CALENDAR_PROLEPTIC = 1
       integer :: CALENDAR_360DAYS = 2
       integer :: CALENDAR_365DAYS = 3
       integer :: CALENDAR_366DAYS = 4
       integer :: CALENDAR_NONE = 5
+      integer :: PIO_NONE = 0
+      integer :: PIO_MPI = 1
+      integer :: PIO_WRITER = 2
+      integer :: PIO_ASYNCH = 3
+      integer :: PIO_FPGUARD = 4
 
       interface
+        subroutine cdiReset() bind(c,name='cdiReset')
+       end subroutine cdiReset
+      end interface
+  
+      interface
         character(c_char) function cdiStringError(cdiErrno) bind(c,name='cdiStringError')
           import :: c_int,c_char
           integer(c_int), value :: cdiErrno
@@ -164,6 +199,13 @@ module mo_cdi
       end interface
   
       interface
+        integer(c_int) function cdiHaveFiletype(filetype) bind(c,name='cdiHaveFiletype')
+          import :: c_int
+          integer(c_int), value :: filetype
+       end function cdiHaveFiletype
+      end interface
+  
+      interface
         subroutine cdiDefMissval(missval) bind(c,name='cdiDefMissval')
           import :: c_double
           real(c_double), value :: missval
@@ -302,6 +344,13 @@ module mo_cdi
       end interface
   
       interface
+        integer(c_int) function streamInqVlistIDorig(streamID) bind(c,name='streamInqVlistIDorig')
+          import :: c_int
+          integer(c_int), value :: streamID
+       end function streamInqVlistIDorig
+      end interface
+  
+      interface
         integer(c_int) function streamInqFiletype(streamID) bind(c,name='streamInqFiletype')
           import :: c_int
           integer(c_int), value :: streamID
@@ -324,33 +373,33 @@ module mo_cdi
       end interface
   
       interface
-        subroutine streamDefZtype(streamID,ztype) bind(c,name='streamDefZtype')
+        subroutine streamDefCompType(streamID,comptype) bind(c,name='streamDefCompType')
           import :: c_int
           integer(c_int), value :: streamID
-          integer(c_int), value :: ztype
-       end subroutine streamDefZtype
+          integer(c_int), value :: comptype
+       end subroutine streamDefCompType
       end interface
   
       interface
-        subroutine streamDefZlevel(streamID,zlevel) bind(c,name='streamDefZlevel')
+        subroutine streamDefCompLevel(streamID,complevel) bind(c,name='streamDefCompLevel')
           import :: c_int
           integer(c_int), value :: streamID
-          integer(c_int), value :: zlevel
-       end subroutine streamDefZlevel
+          integer(c_int), value :: complevel
+       end subroutine streamDefCompLevel
       end interface
   
       interface
-        integer(c_int) function streamInqZtype(streamID) bind(c,name='streamInqZtype')
+        integer(c_int) function streamInqCompType(streamID) bind(c,name='streamInqCompType')
           import :: c_int
           integer(c_int), value :: streamID
-       end function streamInqZtype
+       end function streamInqCompType
       end interface
   
       interface
-        integer(c_int) function streamInqZlevel(streamID) bind(c,name='streamInqZlevel')
+        integer(c_int) function streamInqCompLevel(streamID) bind(c,name='streamInqCompLevel')
           import :: c_int
           integer(c_int), value :: streamID
-       end function streamInqZlevel
+       end function streamInqCompLevel
       end interface
   
       interface
@@ -411,6 +460,16 @@ module mo_cdi
       end interface
   
       interface
+        subroutine streamWriteVarF(streamID,varID,data_vec,nmiss) bind(c,name='streamWriteVarF')
+          import :: c_int,c_float
+          integer(c_int), value :: streamID
+          integer(c_int), value :: varID
+          real(c_float), intent(in),dimension(*) :: data_vec
+          integer(c_int), value :: nmiss
+       end subroutine streamWriteVarF
+      end interface
+  
+      interface
         subroutine streamReadVarSlice(streamID,varID,levelID,data_vec,nmiss) bind(c,name='streamReadVarSlice')
           import :: c_int,c_double
           integer(c_int), value :: streamID
@@ -433,6 +492,17 @@ module mo_cdi
       end interface
   
       interface
+        subroutine streamWriteVarSliceF(streamID,varID,levelID,data_vec,nmiss) bind(c,name='streamWriteVarSliceF')
+          import :: c_int,c_float
+          integer(c_int), value :: streamID
+          integer(c_int), value :: varID
+          integer(c_int), value :: levelID
+          real(c_float), intent(in),dimension(*) :: data_vec
+          integer(c_int), value :: nmiss
+       end subroutine streamWriteVarSliceF
+      end interface
+  
+      interface
         subroutine streamInqRecord(streamID,varID,levelID) bind(c,name='streamInqRecord')
           import :: c_int
           integer(c_int), value :: streamID
@@ -469,6 +539,15 @@ module mo_cdi
       end interface
   
       interface
+        subroutine streamWriteRecordF(streamID,data_vec,nmiss) bind(c,name='streamWriteRecordF')
+          import :: c_int,c_float
+          integer(c_int), value :: streamID
+          real(c_float), intent(in),dimension(*) :: data_vec
+          integer(c_int), value :: nmiss
+       end subroutine streamWriteRecordF
+      end interface
+  
+      interface
         subroutine streamCopyRecord(streamIDdest,streamIDsrc) bind(c,name='streamCopyRecord')
           import :: c_int
           integer(c_int), value :: streamIDdest
@@ -737,12 +816,12 @@ module mo_cdi
       end interface
   
       interface
-        integer(c_int) function vlistDefVar(vlistID,gridID,zaxisID,timeID) bind(c,name='vlistDefVar')
+        integer(c_int) function vlistDefVar(vlistID,gridID,zaxisID,tsteptype) bind(c,name='vlistDefVar')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: gridID
           integer(c_int), value :: zaxisID
-          integer(c_int), value :: timeID
+          integer(c_int), value :: tsteptype
        end function vlistDefVar
       end interface
   
@@ -765,13 +844,13 @@ module mo_cdi
       end interface
   
       interface
-        subroutine vlistInqVar(vlistID,varID,gridID,zaxisID,timeID) bind(c,name='vlistInqVar')
+        subroutine vlistInqVar(vlistID,varID,gridID,zaxisID,tsteptype) bind(c,name='vlistInqVar')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
           integer(c_int), intent(out) :: gridID
           integer(c_int), intent(out) :: zaxisID
-          integer(c_int), intent(out) :: timeID
+          integer(c_int), intent(out) :: tsteptype
        end subroutine vlistInqVar
       end interface
   
@@ -792,45 +871,62 @@ module mo_cdi
       end interface
   
       interface
-        integer(c_int) function vlistInqVarTime(vlistID,varID) bind(c,name='vlistInqVarTime')
+        integer(c_int) function vlistInqVarID(vlistID,code) bind(c,name='vlistInqVarID')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: code
+       end function vlistInqVarID
+      end interface
+  
+      interface
+        integer(c_int) function vlistInqVarTsteptype(vlistID,varID) bind(c,name='vlistInqVarTsteptype')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+       end function vlistInqVarTsteptype
+      end interface
+  
+      interface
+        subroutine vlistDefVarTsteptype(vlistID,varID,tsteptype) bind(c,name='vlistDefVarTsteptype')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
-       end function vlistInqVarTime
+          integer(c_int), value :: tsteptype
+       end subroutine vlistDefVarTsteptype
       end interface
   
       interface
-        subroutine vlistDefVarZtype(vlistID,varID,ztype) bind(c,name='vlistDefVarZtype')
+        subroutine vlistDefVarCompType(vlistID,varID,comptype) bind(c,name='vlistDefVarCompType')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
-          integer(c_int), value :: ztype
-       end subroutine vlistDefVarZtype
+          integer(c_int), value :: comptype
+       end subroutine vlistDefVarCompType
       end interface
   
       interface
-        integer(c_int) function vlistInqVarZtype(vlistID,varID) bind(c,name='vlistInqVarZtype')
+        integer(c_int) function vlistInqVarCompType(vlistID,varID) bind(c,name='vlistInqVarCompType')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
-       end function vlistInqVarZtype
+       end function vlistInqVarCompType
       end interface
   
       interface
-        subroutine vlistDefVarZlevel(vlistID,varID,zlevel) bind(c,name='vlistDefVarZlevel')
+        subroutine vlistDefVarCompLevel(vlistID,varID,complevel) bind(c,name='vlistDefVarCompLevel')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
-          integer(c_int), value :: zlevel
-       end subroutine vlistDefVarZlevel
+          integer(c_int), value :: complevel
+       end subroutine vlistDefVarCompLevel
       end interface
   
       interface
-        integer(c_int) function vlistInqVarZlevel(vlistID,varID) bind(c,name='vlistInqVarZlevel')
+        integer(c_int) function vlistInqVarCompLevel(vlistID,varID) bind(c,name='vlistInqVarCompLevel')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
-       end function vlistInqVarZlevel
+       end function vlistInqVarCompLevel
       end interface
   
       interface
@@ -885,6 +981,40 @@ module mo_cdi
       end interface
   
       interface
+        subroutine vlistDefVarChunkType(vlistID,varID,chunktype) bind(c,name='vlistDefVarChunkType')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          integer(c_int), value :: chunktype
+       end subroutine vlistDefVarChunkType
+      end interface
+  
+      interface
+        integer(c_int) function vlistInqVarChunkType(vlistID,varID) bind(c,name='vlistInqVarChunkType')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+       end function vlistInqVarChunkType
+      end interface
+  
+      interface
+        subroutine vlistDefVarXYZ(vlistID,varID,xyz) bind(c,name='vlistDefVarXYZ')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          integer(c_int), value :: xyz
+       end subroutine vlistDefVarXYZ
+      end interface
+  
+      interface
+        integer(c_int) function vlistInqVarXYZ(vlistID,varID) bind(c,name='vlistInqVarXYZ')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+       end function vlistInqVarXYZ
+      end interface
+  
+      interface
         integer(c_int) function vlistInqVarNumber(vlistID,varID) bind(c,name='vlistInqVarNumber')
           import :: c_int
           integer(c_int), value :: vlistID
@@ -1033,6 +1163,24 @@ module mo_cdi
       end interface
   
       interface
+        subroutine vlistDefVarExtra(vlistID,varID,extra) bind(c,name='vlistDefVarExtra')
+          import :: c_int,c_char
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          character(c_char), dimension(*) :: extra
+       end subroutine vlistDefVarExtra
+      end interface
+  
+      interface
+        subroutine vlistInqVarExtra(vlistID,varID,extra) bind(c,name='vlistInqVarExtra')
+          import :: c_int,c_char
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          character(c_char), dimension(*) :: extra
+       end subroutine vlistInqVarExtra
+      end interface
+  
+      interface
         subroutine vlistDefVarScalefactor(vlistID,varID,scalefactor) bind(c,name='vlistDefVarScalefactor')
           import :: c_int,c_double
           integer(c_int), value :: vlistID
@@ -1067,23 +1215,6 @@ module mo_cdi
       end interface
   
       interface
-        subroutine vlistDefVarTsteptype(vlistID,varID,tsteptype) bind(c,name='vlistDefVarTsteptype')
-          import :: c_int
-          integer(c_int), value :: vlistID
-          integer(c_int), value :: varID
-          integer(c_int), value :: tsteptype
-       end subroutine vlistDefVarTsteptype
-      end interface
-  
-      interface
-        integer(c_int) function vlistInqVarTsteptype(vlistID,varID) bind(c,name='vlistInqVarTsteptype')
-          import :: c_int
-          integer(c_int), value :: vlistID
-          integer(c_int), value :: varID
-       end function vlistInqVarTsteptype
-      end interface
-  
-      interface
         subroutine vlistDefVarTimave(vlistID,varID,timave) bind(c,name='vlistDefVarTimave')
           import :: c_int
           integer(c_int), value :: vlistID
@@ -1118,19 +1249,29 @@ module mo_cdi
       end interface
   
       interface
-        integer(c_int) function vlistInqVarSize(vlistID,varID) bind(c,name='vlistInqVarSize')
+        subroutine vlistDefVarTypeOfGeneratingProcess(vlistID,varID,typeOfGeneratingProcess) bind(c,&
+       name='vlistDefVarTypeOfGeneratingProcess')
           import :: c_int
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
-       end function vlistInqVarSize
+          integer(c_int), value :: typeOfGeneratingProcess
+       end subroutine vlistDefVarTypeOfGeneratingProcess
       end interface
   
       interface
-        integer(c_int) function vlistInqVarID(vlistID,code) bind(c,name='vlistInqVarID')
+        integer(c_int) function vlistInqVarTypeOfGeneratingProcess(vlistID,varID) bind(c,name='vlistInqVarTypeOfGeneratingProcess')
           import :: c_int
           integer(c_int), value :: vlistID
-          integer(c_int), value :: code
-       end function vlistInqVarID
+          integer(c_int), value :: varID
+       end function vlistInqVarTypeOfGeneratingProcess
+      end interface
+  
+      interface
+        integer(c_int) function vlistInqVarSize(vlistID,varID) bind(c,name='vlistInqVarSize')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+       end function vlistInqVarSize
       end interface
   
       interface
@@ -1206,6 +1347,87 @@ module mo_cdi
       end interface
   
       interface
+        subroutine vlistDefVarEnsemble(vlistID,varID,ensID,ensCount,forecast_type) bind(c,name='vlistDefVarEnsemble')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          integer(c_int), value :: ensID
+          integer(c_int), value :: ensCount
+          integer(c_int), value :: forecast_type
+       end subroutine vlistDefVarEnsemble
+      end interface
+  
+      interface
+        integer(c_int) function vlistInqVarEnsemble(vlistID,varID,ensID,ensCount,forecast_type) bind(c,name='vlistInqVarEnsemble')
+          import :: c_int
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          integer(c_int), intent(out) :: ensID
+          integer(c_int), intent(out) :: ensCount
+          integer(c_int), intent(out) :: forecast_type
+       end function vlistInqVarEnsemble
+      end interface
+  
+      interface
+        subroutine cdiClearAdditionalKeys() bind(c,name='cdiClearAdditionalKeys')
+       end subroutine cdiClearAdditionalKeys
+      end interface
+  
+      interface
+        subroutine cdiDefAdditionalKey(string) bind(c,name='cdiDefAdditionalKey')
+          import :: c_char
+          character(c_char), dimension(*) :: string
+       end subroutine cdiDefAdditionalKey
+      end interface
+  
+      interface
+        subroutine vlistDefVarIntKey(vlistID,varID,name,value) bind(c,name='vlistDefVarIntKey')
+          import :: c_int,c_char
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          character(c_char), dimension(*) :: name
+          integer(c_int), value :: value
+       end subroutine vlistDefVarIntKey
+      end interface
+  
+      interface
+        subroutine vlistDefVarDblKey(vlistID,varID,name,value) bind(c,name='vlistDefVarDblKey')
+          import :: c_int,c_char,c_double
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          character(c_char), dimension(*) :: name
+          real(c_double), value :: value
+       end subroutine vlistDefVarDblKey
+      end interface
+  
+      interface
+        integer(c_int) function vlistHasVarKey(vlistID,varID,name) bind(c,name='vlistHasVarKey')
+          import :: c_int,c_char
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          character(c_char), dimension(*) :: name
+       end function vlistHasVarKey
+      end interface
+  
+      interface
+        real(c_double) function vlistInqVarDblKey(vlistID,varID,name) bind(c,name='vlistInqVarDblKey')
+          import :: c_int,c_char,c_double
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          character(c_char), dimension(*) :: name
+       end function vlistInqVarDblKey
+      end interface
+  
+      interface
+        integer(c_int) function vlistInqVarIntKey(vlistID,varID,name) bind(c,name='vlistInqVarIntKey')
+          import :: c_int,c_char
+          integer(c_int), value :: vlistID
+          integer(c_int), value :: varID
+          character(c_char), dimension(*) :: name
+       end function vlistInqVarIntKey
+      end interface
+  
+      interface
         integer(c_int) function vlistInqNatts(vlistID,varID,nattsp) bind(c,name='vlistInqNatts')
           import :: c_int
           integer(c_int), value :: vlistID
@@ -1236,35 +1458,37 @@ module mo_cdi
       end interface
   
       interface
-        integer(c_int) function vlistDefAttInt(vlistID,varID,name,len,ip_vec) bind(c,name='vlistDefAttInt')
+        integer(c_int) function vlistDefAttInt(vlistID,varID,name,type,len,ip_vec) bind(c,name='vlistDefAttInt')
           import :: c_int,c_char
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
           character(c_char), dimension(*) :: name
+          integer(c_int), value :: type
           integer(c_int), value :: len
           integer(c_int), intent(in),dimension(*) :: ip_vec
        end function vlistDefAttInt
       end interface
   
       interface
-        integer(c_int) function vlistDefAttFlt(vlistID,varID,name,len,dp_vec) bind(c,name='vlistDefAttFlt')
+        integer(c_int) function vlistDefAttFlt(vlistID,varID,name,type,len,dp_vec) bind(c,name='vlistDefAttFlt')
           import :: c_int,c_char,c_double
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
           character(c_char), dimension(*) :: name
+          integer(c_int), value :: type
           integer(c_int), value :: len
           real(c_double), intent(in),dimension(*) :: dp_vec
        end function vlistDefAttFlt
       end interface
   
       interface
-        integer(c_int) function vlistDefAttTxt(vlistID,varID,name,len,tp) bind(c,name='vlistDefAttTxt')
+        integer(c_int) function vlistDefAttTxt(vlistID,varID,name,len,tp_cbuf) bind(c,name='vlistDefAttTxt')
           import :: c_int,c_char
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
           character(c_char), dimension(*) :: name
           integer(c_int), value :: len
-          character(c_char), dimension(*) :: tp
+          character(c_char), dimension(*) :: tp_cbuf
        end function vlistDefAttTxt
       end interface
   
@@ -1291,13 +1515,13 @@ module mo_cdi
       end interface
   
       interface
-        integer(c_int) function vlistInqAttTxt(vlistID,varID,name,mlen,tp) bind(c,name='vlistInqAttTxt')
+        integer(c_int) function vlistInqAttTxt(vlistID,varID,name,mlen,tp_cbuf) bind(c,name='vlistInqAttTxt')
           import :: c_int,c_char
           integer(c_int), value :: vlistID
           integer(c_int), value :: varID
           character(c_char), dimension(*) :: name
           integer(c_int), value :: mlen
-          character(c_char), dimension(*) :: tp
+          character(c_char), dimension(*) :: tp_cbuf
        end function vlistInqAttTxt
       end interface
   
@@ -1324,6 +1548,22 @@ module mo_cdi
       end interface
   
       interface
+        subroutine gridDefMaskGME(gridID,mask_vec) bind(c,name='gridDefMaskGME')
+          import :: c_int
+          integer(c_int), value :: gridID
+          integer(c_int), intent(in),dimension(*) :: mask_vec
+       end subroutine gridDefMaskGME
+      end interface
+  
+      interface
+        integer(c_int) function gridInqMaskGME(gridID,mask_vec) bind(c,name='gridInqMaskGME')
+          import :: c_int
+          integer(c_int), value :: gridID
+          integer(c_int), intent(out),dimension(*) :: mask_vec
+       end function gridInqMaskGME
+      end interface
+  
+      interface
         subroutine gridDefMask(gridID,mask_vec) bind(c,name='gridDefMask')
           import :: c_int
           integer(c_int), value :: gridID
@@ -1348,12 +1588,6 @@ module mo_cdi
       end interface
   
       interface
-        integer(c_int) function gridSize() bind(c,name='gridSize')
-          import :: c_int
-       end function gridSize
-      end interface
-  
-      interface
         integer(c_int) function gridCreate(gridtype,size) bind(c,name='gridCreate')
           import :: c_int
           integer(c_int), value :: gridtype
@@ -1420,6 +1654,21 @@ module mo_cdi
       end interface
   
       interface
+        subroutine gridDefNP(gridID,np) bind(c,name='gridDefNP')
+          import :: c_int
+          integer(c_int), value :: gridID
+          integer(c_int), value :: np
+       end subroutine gridDefNP
+      end interface
+  
+      interface
+        integer(c_int) function gridInqNP(gridID) bind(c,name='gridInqNP')
+          import :: c_int
+          integer(c_int), value :: gridID
+       end function gridInqNP
+      end interface
+  
+      interface
         subroutine gridDefXvals(gridID,xvals_vec) bind(c,name='gridDefXvals')
           import :: c_int,c_double
           integer(c_int), value :: gridID
@@ -1743,6 +1992,68 @@ module mo_cdi
       end interface
   
       interface
+        subroutine gridDefNumber(gridID,number) bind(c,name='gridDefNumber')
+          import :: c_int
+          integer(c_int), value :: gridID
+          integer(c_int), value :: number
+       end subroutine gridDefNumber
+      end interface
+  
+      interface
+        integer(c_int) function gridInqNumber(gridID) bind(c,name='gridInqNumber')
+          import :: c_int
+          integer(c_int), value :: gridID
+       end function gridInqNumber
+      end interface
+  
+      interface
+        subroutine gridDefPosition(gridID,position) bind(c,name='gridDefPosition')
+          import :: c_int
+          integer(c_int), value :: gridID
+          integer(c_int), value :: position
+       end subroutine gridDefPosition
+      end interface
+  
+      interface
+        integer(c_int) function gridInqPosition(gridID) bind(c,name='gridInqPosition')
+          import :: c_int
+          integer(c_int), value :: gridID
+       end function gridInqPosition
+      end interface
+  
+      interface
+        subroutine gridDefReference(gridID,reference) bind(c,name='gridDefReference')
+          import :: c_int,c_char
+          integer(c_int), value :: gridID
+          character(c_char), dimension(*) :: reference
+       end subroutine gridDefReference
+      end interface
+  
+      interface
+        integer(c_int) function gridInqReference(gridID,reference) bind(c,name='gridInqReference')
+          import :: c_int,c_char
+          integer(c_int), value :: gridID
+          character(c_char), dimension(*) :: reference
+       end function gridInqReference
+      end interface
+  
+      interface
+        subroutine gridDefUUID(gridID,uuid_cbuf) bind(c,name='gridDefUUID')
+          import :: c_int,c_char
+          integer(c_int), value :: gridID
+          character(c_char), dimension(*) :: uuid_cbuf
+       end subroutine gridDefUUID
+      end interface
+  
+      interface
+        character(c_char) function gridInqUUID(gridID,uuid_cbuf) bind(c,name='gridInqUUID')
+          import :: c_int,c_char
+          integer(c_int), value :: gridID
+          character(c_char), dimension(*) :: uuid_cbuf
+       end function gridInqUUID
+      end interface
+  
+      interface
         subroutine gridDefLCC(gridID,originLon,originLat,lonParY,lat1,lat2,xinc,yinc,projflag,scanflag) bind(c,name='gridDefLCC')
           import :: c_int,c_double
           integer(c_int), value :: gridID
@@ -1988,12 +2299,6 @@ module mo_cdi
       end interface
   
       interface
-        integer(c_int) function zaxisSize() bind(c,name='zaxisSize')
-          import :: c_int
-       end function zaxisSize
-      end interface
-  
-      interface
         subroutine zaxisDefLevels(zaxisID,levels_vec) bind(c,name='zaxisDefLevels')
           import :: c_int,c_double
           integer(c_int), value :: zaxisID
@@ -2027,6 +2332,52 @@ module mo_cdi
       end interface
   
       interface
+        subroutine zaxisDefNlevRef(gridID,nhlev) bind(c,name='zaxisDefNlevRef')
+          import :: c_int
+          integer(c_int), value :: gridID
+          integer(c_int), value :: nhlev
+       end subroutine zaxisDefNlevRef
+      end interface
+  
+      interface
+        integer(c_int) function zaxisInqNlevRef(gridID) bind(c,name='zaxisInqNlevRef')
+          import :: c_int
+          integer(c_int), value :: gridID
+       end function zaxisInqNlevRef
+      end interface
+  
+      interface
+        subroutine zaxisDefNumber(gridID,number) bind(c,name='zaxisDefNumber')
+          import :: c_int
+          integer(c_int), value :: gridID
+          integer(c_int), value :: number
+       end subroutine zaxisDefNumber
+      end interface
+  
+      interface
+        integer(c_int) function zaxisInqNumber(gridID) bind(c,name='zaxisInqNumber')
+          import :: c_int
+          integer(c_int), value :: gridID
+       end function zaxisInqNumber
+      end interface
+  
+      interface
+        subroutine zaxisDefUUID(zaxisID,uuid_cbuf) bind(c,name='zaxisDefUUID')
+          import :: c_int,c_char
+          integer(c_int), value :: zaxisID
+          character(c_char), dimension(*) :: uuid_cbuf
+       end subroutine zaxisDefUUID
+      end interface
+  
+      interface
+        character(c_char) function zaxisInqUUID(zaxisID,uuid_cbuf) bind(c,name='zaxisInqUUID')
+          import :: c_int,c_char
+          integer(c_int), value :: zaxisID
+          character(c_char), dimension(*) :: uuid_cbuf
+       end function zaxisInqUUID
+      end interface
+  
+      interface
         subroutine zaxisDefName(zaxisID,name) bind(c,name='zaxisDefName')
           import :: c_int,c_char
           integer(c_int), value :: zaxisID
@@ -2067,6 +2418,14 @@ module mo_cdi
       end interface
   
       interface
+        subroutine zaxisInqStdname(zaxisID,stdname) bind(c,name='zaxisInqStdname')
+          import :: c_int,c_char
+          integer(c_int), value :: zaxisID
+          character(c_char), dimension(*) :: stdname
+       end subroutine zaxisInqStdname
+      end interface
+  
+      interface
         subroutine zaxisInqUnits(zaxisID,units) bind(c,name='zaxisInqUnits')
           import :: c_int,c_char
           integer(c_int), value :: zaxisID
@@ -2090,6 +2449,21 @@ module mo_cdi
       end interface
   
       interface
+        subroutine zaxisDefPositive(zaxisID,positive) bind(c,name='zaxisDefPositive')
+          import :: c_int
+          integer(c_int), value :: zaxisID
+          integer(c_int), value :: positive
+       end subroutine zaxisDefPositive
+      end interface
+  
+      interface
+        integer(c_int) function zaxisInqPositive(zaxisID) bind(c,name='zaxisInqPositive')
+          import :: c_int
+          integer(c_int), value :: zaxisID
+       end function zaxisInqPositive
+      end interface
+  
+      interface
         subroutine zaxisDefLtype(zaxisID,ltype) bind(c,name='zaxisDefLtype')
           import :: c_int
           integer(c_int), value :: zaxisID
@@ -2121,6 +2495,14 @@ module mo_cdi
       end interface
   
       interface
+        subroutine zaxisInqVct(zaxisID,vct_vec) bind(c,name='zaxisInqVct')
+          import :: c_int,c_double
+          integer(c_int), value :: zaxisID
+          real(c_double), intent(out),dimension(*) :: vct_vec
+       end subroutine zaxisInqVct
+      end interface
+  
+      interface
         integer(c_int) function zaxisInqVctSize(zaxisID) bind(c,name='zaxisInqVctSize')
           import :: c_int
           integer(c_int), value :: zaxisID
@@ -2679,10 +3061,12 @@ module mo_cdi
        end subroutine streamInqHistoryString
       end interface
   
+      public :: cdiReset
       public :: cdiStringError
       public :: cdiDebug
       public :: cdiLibraryVersion
       public :: cdiPrintVersion
+      public :: cdiHaveFiletype
       public :: cdiDefMissval
       public :: cdiInqMissval
       public :: cdiDefGlobal
@@ -2700,13 +3084,14 @@ module mo_cdi
       public :: streamSync
       public :: streamDefVlist
       public :: streamInqVlist
+      public :: streamInqVlistIDorig
       public :: streamInqFiletype
       public :: streamDefByteorder
       public :: streamInqByteorder
-      public :: streamDefZtype
-      public :: streamDefZlevel
-      public :: streamInqZtype
-      public :: streamInqZlevel
+      public :: streamDefCompType
+      public :: streamDefCompLevel
+      public :: streamInqCompType
+      public :: streamInqCompLevel
       public :: streamDefTimestep
       public :: streamInqTimestep
       public :: streamFilename
@@ -2714,12 +3099,15 @@ module mo_cdi
       public :: streamNtsteps
       public :: streamReadVar
       public :: streamWriteVar
+      public :: streamWriteVarF
       public :: streamReadVarSlice
       public :: streamWriteVarSlice
+      public :: streamWriteVarSliceF
       public :: streamInqRecord
       public :: streamDefRecord
       public :: streamReadRecord
       public :: streamWriteRecord
+      public :: streamWriteRecordF
       public :: streamCopyRecord
       public :: streamInqGinfo
       public :: vlistCreate
@@ -2761,17 +3149,23 @@ module mo_cdi
       public :: vlistInqVar
       public :: vlistInqVarGrid
       public :: vlistInqVarZaxis
-      public :: vlistInqVarTime
-      public :: vlistDefVarZtype
-      public :: vlistInqVarZtype
-      public :: vlistDefVarZlevel
-      public :: vlistInqVarZlevel
+      public :: vlistInqVarID
+      public :: vlistInqVarTsteptype
+      public :: vlistDefVarTsteptype
+      public :: vlistDefVarCompType
+      public :: vlistInqVarCompType
+      public :: vlistDefVarCompLevel
+      public :: vlistInqVarCompLevel
       public :: vlistDefVarParam
       public :: vlistInqVarParam
       public :: vlistDefVarCode
       public :: vlistInqVarCode
       public :: vlistDefVarDatatype
       public :: vlistInqVarDatatype
+      public :: vlistDefVarChunkType
+      public :: vlistInqVarChunkType
+      public :: vlistDefVarXYZ
+      public :: vlistInqVarXYZ
       public :: vlistInqVarNumber
       public :: vlistDefVarInstitut
       public :: vlistInqVarInstitut
@@ -2789,18 +3183,19 @@ module mo_cdi
       public :: vlistInqVarUnits
       public :: vlistDefVarMissval
       public :: vlistInqVarMissval
+      public :: vlistDefVarExtra
+      public :: vlistInqVarExtra
       public :: vlistDefVarScalefactor
       public :: vlistInqVarScalefactor
       public :: vlistDefVarAddoffset
       public :: vlistInqVarAddoffset
-      public :: vlistDefVarTsteptype
-      public :: vlistInqVarTsteptype
       public :: vlistDefVarTimave
       public :: vlistInqVarTimave
       public :: vlistDefVarTimaccu
       public :: vlistInqVarTimaccu
+      public :: vlistDefVarTypeOfGeneratingProcess
+      public :: vlistInqVarTypeOfGeneratingProcess
       public :: vlistInqVarSize
-      public :: vlistInqVarID
       public :: vlistDefIndex
       public :: vlistInqIndex
       public :: vlistDefFlag
@@ -2809,6 +3204,15 @@ module mo_cdi
       public :: vlistFindLevel
       public :: vlistMergedVar
       public :: vlistMergedLevel
+      public :: vlistDefVarEnsemble
+      public :: vlistInqVarEnsemble
+      public :: cdiClearAdditionalKeys
+      public :: cdiDefAdditionalKey
+      public :: vlistDefVarIntKey
+      public :: vlistDefVarDblKey
+      public :: vlistHasVarKey
+      public :: vlistInqVarDblKey
+      public :: vlistInqVarIntKey
       public :: vlistInqNatts
       public :: vlistInqAtt
       public :: vlistDelAtt
@@ -2821,10 +3225,11 @@ module mo_cdi
       public :: gridName
       public :: gridNamePtr
       public :: gridCompress
+      public :: gridDefMaskGME
+      public :: gridInqMaskGME
       public :: gridDefMask
       public :: gridInqMask
       public :: gridPrint
-      public :: gridSize
       public :: gridCreate
       public :: gridDestroy
       public :: gridDuplicate
@@ -2834,6 +3239,8 @@ module mo_cdi
       public :: gridInqXsize
       public :: gridDefYsize
       public :: gridInqYsize
+      public :: gridDefNP
+      public :: gridInqNP
       public :: gridDefXvals
       public :: gridInqXvals
       public :: gridDefYvals
@@ -2876,6 +3283,14 @@ module mo_cdi
       public :: gridDefGMEni2
       public :: gridInqGMEni3
       public :: gridDefGMEni3
+      public :: gridDefNumber
+      public :: gridInqNumber
+      public :: gridDefPosition
+      public :: gridInqPosition
+      public :: gridDefReference
+      public :: gridInqReference
+      public :: gridDefUUID
+      public :: gridInqUUID
       public :: gridDefLCC
       public :: gridInqLCC
       public :: gridDefLcc2
@@ -2904,23 +3319,32 @@ module mo_cdi
       public :: zaxisDuplicate
       public :: zaxisResize
       public :: zaxisPrint
-      public :: zaxisSize
       public :: zaxisDefLevels
       public :: zaxisInqLevels
       public :: zaxisDefLevel
       public :: zaxisInqLevel
+      public :: zaxisDefNlevRef
+      public :: zaxisInqNlevRef
+      public :: zaxisDefNumber
+      public :: zaxisInqNumber
+      public :: zaxisDefUUID
+      public :: zaxisInqUUID
       public :: zaxisDefName
       public :: zaxisDefLongname
       public :: zaxisDefUnits
       public :: zaxisInqName
       public :: zaxisInqLongname
+      public :: zaxisInqStdname
       public :: zaxisInqUnits
       public :: zaxisDefPrec
       public :: zaxisInqPrec
+      public :: zaxisDefPositive
+      public :: zaxisInqPositive
       public :: zaxisDefLtype
       public :: zaxisInqLtype
       public :: zaxisInqLevelsPtr
       public :: zaxisDefVct
+      public :: zaxisInqVct
       public :: zaxisInqVctSize
       public :: zaxisInqVctPtr
       public :: zaxisInqLbounds
@@ -2994,6 +3418,7 @@ module mo_cdi
       public :: streamInqHistoryString
       public :: ctrim
 
+      public :: CDI_MAX_NAME
       public :: CDI_UNDEFID
       public :: CDI_GLOBAL
       public :: CDI_BIGENDIAN
@@ -3013,6 +3438,7 @@ module mo_cdi
       public :: FILETYPE_NC
       public :: FILETYPE_NC2
       public :: FILETYPE_NC4
+      public :: FILETYPE_NC4C
       public :: FILETYPE_SRV
       public :: FILETYPE_EXT
       public :: FILETYPE_IEG
@@ -3069,6 +3495,10 @@ module mo_cdi
       public :: DATATYPE_FLT
       public :: DATATYPE_TXT
       public :: DATATYPE_CPX
+      public :: DATATYPE_UCHAR
+      public :: CHUNK_AUTO
+      public :: CHUNK_GRID
+      public :: CHUNK_LINES
       public :: GRID_GENERIC
       public :: GRID_GAUSSIAN
       public :: GRID_GAUSSIAN_REDUCED
@@ -3083,6 +3513,7 @@ module mo_cdi
       public :: GRID_LCC2
       public :: GRID_LAEA
       public :: GRID_SINUSOIDAL
+      public :: GRID_PROJECTION
       public :: ZAXIS_SURFACE
       public :: ZAXIS_GENERIC
       public :: ZAXIS_HYBRID
@@ -3096,10 +3527,37 @@ module mo_cdi
       public :: ZAXIS_ALTITUDE
       public :: ZAXIS_SIGMA
       public :: ZAXIS_MEANSEA
-      public :: TAXIS_ABSOLUTE
-      public :: TAXIS_RELATIVE
+      public :: ZAXIS_TOA
+      public :: ZAXIS_SEA_BOTTOM
+      public :: ZAXIS_ATMOSPHERE
+      public :: ZAXIS_CLOUD_BASE
+      public :: ZAXIS_CLOUD_TOP
+      public :: ZAXIS_ISOTHERM_ZERO
+      public :: ZAXIS_SNOW
+      public :: ZAXIS_LAKE_BOTTOM
+      public :: ZAXIS_SEDIMENT_BOTTOM
+      public :: ZAXIS_SEDIMENT_BOTTOM_TA
+      public :: ZAXIS_SEDIMENT_BOTTOM_TW
+      public :: ZAXIS_MIX_LAYER
+      public :: ZAXIS_REFERENCE
       public :: TIME_CONSTANT
       public :: TIME_VARIABLE
+      public :: TSTEP_CONSTANT
+      public :: TSTEP_INSTANT
+      public :: TSTEP_AVG
+      public :: TSTEP_ACCUM
+      public :: TSTEP_MAX
+      public :: TSTEP_MIN
+      public :: TSTEP_DIFF
+      public :: TSTEP_RMS
+      public :: TSTEP_SD
+      public :: TSTEP_COV
+      public :: TSTEP_RATIO
+      public :: TSTEP_RANGE
+      public :: TSTEP_INSTANT2
+      public :: TSTEP_INSTANT3
+      public :: TAXIS_ABSOLUTE
+      public :: TAXIS_RELATIVE
       public :: TUNIT_SECOND
       public :: TUNIT_MINUTE
       public :: TUNIT_HOUR
@@ -3110,21 +3568,17 @@ module mo_cdi
       public :: TUNIT_3HOURS
       public :: TUNIT_6HOURS
       public :: TUNIT_12HOURS
-      public :: TSTEP_INSTANT
-      public :: TSTEP_AVG
-      public :: TSTEP_ACCUM
-      public :: TSTEP_MAX
-      public :: TSTEP_MIN
-      public :: TSTEP_DIFF
-      public :: TSTEP_RANGE
-      public :: TSTEP_INSTANT2
-      public :: TSTEP_INSTANT3
       public :: CALENDAR_STANDARD
       public :: CALENDAR_PROLEPTIC
       public :: CALENDAR_360DAYS
       public :: CALENDAR_365DAYS
       public :: CALENDAR_366DAYS
       public :: CALENDAR_NONE
+      public :: PIO_NONE
+      public :: PIO_MPI
+      public :: PIO_WRITER
+      public :: PIO_ASYNCH
+      public :: PIO_FPGUARD
 
 contains
 
diff --git a/libcdi/src/model.c b/libcdi/src/model.c
index 2546219..0ca7e99 100644
--- a/libcdi/src/model.c
+++ b/libcdi/src/model.c
@@ -7,8 +7,9 @@
 #include "cdi_int.h"
 #include "pio_util.h"
 #include "resource_handle.h"
-#include "pio_rpc.h"
+#include "resource_unpack.h"
 #include "namespace.h"
+#include "serialize.h"
 
 #undef  UNDEFID
 #define UNDEFID -1
@@ -37,16 +38,13 @@ static void modelInit(void);
 static int    modelCompareP ( void * modelptr1, void * modelptr2 );
 static void   modelDestroyP ( void * modelptr );
 static void   modelPrintP   ( void * modelptr, FILE * fp );
-#ifdef USE_MPI
-static int    modelGetSizeP ( void * modelptr, MPI_Comm comm );
-static void   modelPackP    ( void * modelptr, void * buff, int size, int *position, MPI_Comm comm);
+static int    modelGetSizeP ( void * modelptr, void *context);
+static void   modelPackP    ( void * modelptr, void * buff, int size,
+                              int *position, void *context);
 static int    modelTxCode   ( void );
-#endif
 
 resOps modelOps = { modelCompareP, modelDestroyP, modelPrintP
-#ifdef USE_MPI
                     , modelGetSizeP, modelPackP, modelTxCode
-#endif
 };
 
 static
@@ -106,9 +104,8 @@ void modelDefaultEntries ( void )
   instID  = institutInq(  0,   1, "NCEP", NULL);
   resH[9] = modelDef(instID,  80, "T62L28MRF");
   
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    for ( i = 0; i < 10 ; i++ )
-      reshSetStatus ( resH[i], &modelOps, SUSPENDED );  
+  for ( i = 0; i < 10 ; i++ )
+    reshSetStatus(resH[i], &modelOps, SUSPENDED);
 }
 
 static
@@ -149,59 +146,65 @@ int modelSize ( void )
   return reshCountType ( &modelOps );
 }
 
-
-int modelInq(int instID, int modelgribID, char *name)
+struct modelLoc
 {
-  int modelID = UNDEFID;
-  size_t len;
-  int found;
-  int modelCount;
-  model_t *modelptr;
-  int i, * modelResHs;
-
-  modelInit ();
-
-  modelCount = modelSize();
-  modelResHs = xmalloc ( modelCount * sizeof ( int ));
-  reshGetResHListOfType ( modelCount, modelResHs, &modelOps );
+  char *name;
+  int instID, modelgribID, resID;
+};
 
-  for( i = 0; i < modelCount; i++ )
+static enum cdiApplyRet
+findModelByID(int resID, void *res, void *data)
+{
+  model_t *modelptr = res;
+  struct modelLoc *ret = data;
+  int instID = ret->instID, modelgribID = ret->modelgribID;
+  if (modelptr->used
+      && modelptr->instID == instID
+      && modelptr->modelgribID == modelgribID)
     {
-      modelID = modelResHs[i];
-      modelptr = ( model_t * ) reshGetVal ( modelID, &modelOps );
+      ret->resID = resID;
+      return CDI_APPLY_STOP;
+    }
+  else
+    return CDI_APPLY_GO_ON;
+}
 
-      if ( modelptr->used )
+static enum cdiApplyRet
+findModelByName(int resID, void *res, void *data)
+{
+  model_t *modelptr = res;
+  struct modelLoc *ret = data;
+  int instID = ret->instID, modelgribID = ret->modelgribID;
+  const char *name = ret->name;
+  if (modelptr->used
+      && (instID == -1 || modelptr->instID == instID)
+      && (modelgribID == 0 || modelptr->modelgribID == modelgribID)
+      && modelptr->name)
+    {
+      const char *p = name, *q = modelptr->name;
+      while (*p != '\0' && *p == *q)
+        ++p, ++q;
+      if (*p == '\0' || *q == '\0')
         {
-          if ( name && *name )
-            {
-              found = 1;
-              if ( instID      != -1 && modelptr->instID      != instID )      found = 0;
-              if ( modelgribID !=  0 && modelptr->modelgribID != modelgribID ) found = 0;
-
-              if ( found )
-                {
-                  if ( modelptr->name )
-                    {
-                      len = strlen(modelptr->name);
-                      if ( strncmp(modelptr->name, name, len) == 0 ) break;
-                      len = strlen(name);
-                      if ( strncmp(modelptr->name, name, len) == 0 ) break;
-                    }
-                }
-            }
-          else
-            {
-              if ( modelptr->instID      == instID &&
-                   modelptr->modelgribID == modelgribID ) break;
-            }
+          ret->resID = resID;
+          return CDI_APPLY_STOP;
         }
     }
+  return CDI_APPLY_GO_ON;
+}
 
-  if ( i == modelCount ) modelID = UNDEFID;
-
-  if ( modelResHs ) free ( modelResHs );
+int modelInq(int instID, int modelgribID, char *name)
+{
+  modelInit ();
 
-  return (modelID);
+  struct modelLoc searchState = { .name = name, .instID = instID,
+                                  .modelgribID = modelgribID,
+                                  .resID = UNDEFID };
+  if (name && *name)
+    cdiResHFilterApply(&modelOps, findModelByName, &searchState);
+  else
+    cdiResHFilterApply(&modelOps, findModelByID, &searchState);
+  return searchState.resID;
 }
 
 
@@ -288,8 +291,6 @@ void modelPrintP   ( void * modelptr, FILE * fp )
 }
 
 
-#ifdef USE_MPI
-
 static int
 modelTxCode ( void )
 {
@@ -301,49 +302,50 @@ enum {
 };
 
 
-static
-int modelGetSizeP ( void * modelptr, MPI_Comm comm )
+static int modelGetSizeP(void * modelptr, void *context)
 {
   model_t *p = modelptr;
-  int txsize = 0, txinc;
-  xmpi(MPI_Pack_size(model_nints, MPI_INT, comm, &txsize));
-  xmpi(MPI_Pack_size(strlen(p->name) + 1, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
+  int txsize = serializeGetSize(model_nints, DATATYPE_INT, context)
+    + serializeGetSize(p->name?strlen(p->name) + 1:0, DATATYPE_TXT, context);
   return txsize;
 }
 
 
-static
-void modelPackP ( void * modelptr, void * buf, int size,
-                  int *position, MPI_Comm comm )
+static void modelPackP(void * modelptr, void * buf, int size, int *position, void *context)
 {
   model_t *p = modelptr;
   int tempbuf[model_nints];
   tempbuf[0] = p->self;
   tempbuf[1] = p->instID;
   tempbuf[2] = p->modelgribID;
-  tempbuf[3] = (int)strlen(p->name) + 1;
-  xmpi(MPI_Pack(tempbuf, model_nints, MPI_INT, buf, size, position, comm));
-  xmpi(MPI_Pack(p->name, tempbuf[3], MPI_CHAR, buf, size, position, comm));
+  tempbuf[3] = p->name ? (int)strlen(p->name) + 1 : 0;
+  serializePack(tempbuf, model_nints, DATATYPE_INT, buf, size, position, context);
+  if (p->name)
+    serializePack(p->name, tempbuf[3], DATATYPE_TXT, buf, size, position, context);
 }
 
 int
-modelUnpack(void *buf, int size, int *position, int nspTarget,
-            MPI_Comm comm)
+modelUnpack(void *buf, int size, int *position, int nspTarget, void *context)
 {
   int tempbuf[model_nints];
   int modelID;
   char *name;
-  xmpi(MPI_Unpack(buf, size, position, tempbuf, model_nints, MPI_INT, comm));
-  name = xmalloc(tempbuf[3]);
-  xmpi(MPI_Unpack(buf, size, position, name, tempbuf[3], MPI_CHAR, comm));
+  serializeUnpack(buf, size, position, tempbuf, model_nints, DATATYPE_INT, context);
+  if (tempbuf[3] != 0)
+    {
+      name = xmalloc(tempbuf[3]);
+      serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
+    }
+  else
+    {
+      name = "";
+    }
   modelID = modelDef( namespaceAdaptKey ( tempbuf[1], nspTarget ), tempbuf[2], name);
   // FIXME: this should work, once all types are transferred
   //assert(modelID == tempbuf[0]);
   return modelID;
 }
 
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/model.h b/libcdi/src/model.h
index 8df7253..ebee758 100644
--- a/libcdi/src/model.h
+++ b/libcdi/src/model.h
@@ -1,11 +1,9 @@
 #ifndef MODEL_H
 #define MODEL_H
 
-#ifdef USE_MPI
 int
 modelUnpack(void *buf, int size, int *position,
-            int, MPI_Comm comm);
-#endif
+            int, void *context);
 
 #endif
 /*
diff --git a/libcdi/src/namespace.c b/libcdi/src/namespace.c
index 7d53462..e156c41 100644
--- a/libcdi/src/namespace.c
+++ b/libcdi/src/namespace.c
@@ -3,15 +3,76 @@
 #include <stdio.h>
 #include "cdi.h"
 #include "namespace.h"
+#include "resource_handle.h"
 #include "pio_util.h"
-
+#include "serialize.h"
+#include "error.h"
+#include "cdf_int.h"
+#include "file.h"
+#include "cdi_int.h"
+#include "stream_cdf.h"
 
 static int nNamespaces = 1;
 static int activeNamespace = 0;
-static int serialHLF = 1;
-static int * hasLocalFiles = &serialHLF;
-static int serialRS = STAGE_DEFINITION;
-static statusCode * resStatus = (statusCode *) &serialRS;
+
+#ifdef HAVE_LIBNETCDF
+#define CDI_NETCDF_SWITCHES                     \
+  { .func = (void (*)()) nc__create },          \
+  { .func = (void (*)()) cdf_def_var_serial },  \
+  { .func = (void (*)()) cdfDefTimestep },      \
+  { .func = (void (*)()) cdfDefVars }
+
+#else
+#define CDI_NETCDF_SWITCHES
+#endif
+
+#define defaultSwitches {                                   \
+    { .func = (void (*)()) cdiAbortC_serial },              \
+    { .func = (void (*)()) serializeGetSizeInCore },        \
+    { .func = (void (*)()) serializePackInCore },           \
+    { .func = (void (*)()) serializeUnpackInCore },         \
+    { .func = (void (*)()) fileOpen_serial },               \
+    { .func = (void (*)()) fileWrite },                     \
+    { .func = (void (*)()) fileClose_serial },              \
+    { .func = (void (*)()) cdiStreamOpenDefaultDelegate },  \
+    { .func = (void (*)()) cdiStreamDefVlist_ },            \
+    { .func = (void (*)()) cdiStreamWriteVar_ },            \
+    { .func = (void (*)()) cdiStreamwriteVarChunk_ },       \
+    { .data = NULL },                                       \
+    { .func = (void (*)()) cdiStreamCloseDefaultDelegate }, \
+    { .func = (void (*)()) cdiStreamDefTimestep_ }, \
+    { .func = (void (*)()) cdiStreamSync_ },                \
+    CDI_NETCDF_SWITCHES                        \
+    }
+
+struct namespace
+{
+  statusCode resStage;
+  union namespaceSwitchValue switches[NUM_NAMESPACE_SWITCH];
+} initialNamespace = {
+  .resStage = STAGE_DEFINITION,
+  .switches = defaultSwitches
+};
+
+struct namespace *namespaces = &initialNamespace;
+
+static int namespacesSize = 1;
+
+#if  defined  (HAVE_LIBPTHREAD)
+#  include <pthread.h>
+
+static pthread_mutex_t namespaceMutex = PTHREAD_MUTEX_INITIALIZER;
+
+#  define NAMESPACE_LOCK()         pthread_mutex_lock(&namespaceMutex)
+#  define NAMESPACE_UNLOCK()       pthread_mutex_unlock(&namespaceMutex)
+
+#else
+
+#  define NAMESPACE_LOCK()
+#  define NAMESPACE_UNLOCK()
+
+#endif
+
 
 enum {
   intbits = sizeof(int) * CHAR_BIT,
@@ -27,6 +88,7 @@ enum {
 };
 
 
+#if 0
 void namespaceShowbits ( int n, char *name )
 {
   int i;
@@ -42,6 +104,7 @@ void namespaceShowbits ( int n, char *name )
   bitvalues[intbits] = '\0';
   fprintf (stdout, "%s: %s\n", name, bitvalues );
 }
+#endif
 
 
 int namespaceIdxEncode ( namespaceTuple_t tin )
@@ -67,34 +130,74 @@ namespaceTuple_t namespaceResHDecode ( int resH )
   return tin;
 }
 
-
-void namespaceInit ( int nspn, int * argHasLocalFile )
+int
+namespaceNew()
 {
-  /* FIXME: this should not be PIO-only */
-#ifdef USE_MPI
-  int nspID;
-
-  xassert(nspn <= NUM_NAMESPACES && nspn >= 1 );
-
-  nNamespaces = nspn;
-  if ( nspn >= 1 )
+  int newNamespaceID = -1;
+  NAMESPACE_LOCK();
+  if (namespacesSize > nNamespaces)
     {
-      hasLocalFiles = xmalloc ( nspn * sizeof ( hasLocalFiles[0] ));
-      for ( nspID = 0; nspID < nspn; nspID++ )
-	hasLocalFiles[nspID] = argHasLocalFile[nspID];
-      resStatus = xmalloc ( nspn * sizeof ( resStatus[0] ));
+      /* namespace is already available and only needs reinitialization */
+      for (int i = 0; i < namespacesSize; ++i)
+        if (namespaces[i].resStage == STAGE_UNUSED)
+          {
+            newNamespaceID = i;
+            break;
+          }
     }
-#endif
+  else if (namespacesSize == 1)
+    {
+      /* make room for additional namespace */
+      struct namespace *newNameSpaces
+        = xmalloc((namespacesSize + 1) * sizeof (namespaces[0]));
+      memcpy(newNameSpaces, namespaces, sizeof (namespaces[0]));
+      namespaces = newNameSpaces;
+      ++namespacesSize;
+      newNamespaceID = 1;
+    }
+  else if (namespacesSize < NUM_NAMESPACES)
+    {
+      /* make room for additional namespace */
+      newNamespaceID = namespacesSize;
+      namespaces
+        = xrealloc(namespaces, (namespacesSize + 1) * sizeof (namespaces[0]));
+      ++namespacesSize;
+    }
+  else /* implicit: namespacesSize >= NUM_NAMESPACES */
+    {
+      NAMESPACE_UNLOCK();
+      return -1;
+    }
+  xassert(newNamespaceID >= 0 && newNamespaceID < NUM_NAMESPACES);
+  ++nNamespaces;
+  namespaces[newNamespaceID].resStage = STAGE_DEFINITION;
+  memcpy(namespaces[newNamespaceID].switches,
+         (union namespaceSwitchValue[NUM_NAMESPACE_SWITCH])defaultSwitches,
+         sizeof (namespaces[newNamespaceID].switches));
+  reshListCreate(newNamespaceID);
+  NAMESPACE_UNLOCK();
+  return newNamespaceID;
 }
 
+void
+namespaceDelete(int namespaceID)
+{
+  NAMESPACE_LOCK();
+  xassert(namespaceID < namespacesSize && nNamespaces);
+  reshListDestruct(namespaceID);
+  namespaces[namespaceID].resStage = STAGE_UNUSED;
+  --nNamespaces;
+  NAMESPACE_UNLOCK();
+}
 
 void namespaceCleanup ( void )
 {
   if ( nNamespaces > 1 )
     {
-      free ( hasLocalFiles );
-      hasLocalFiles = NULL;
-      free ( resStatus );
+      initialNamespace = namespaces[0];
+      free(namespaces);
+      namespaces = &initialNamespace;
+      nNamespaces = 1;
     }
 }
 
@@ -107,12 +210,9 @@ int namespaceGetNumber ()
 
 void pioNamespaceSetActive ( int nId )
 {
-  /* FIXME: this should not be PIO-only */
-#ifdef USE_MPI
-  xassert ( nId < nNamespaces && nId >= 0 );
-
+  xassert(nId < namespacesSize && nId >= 0
+          && namespaces[nId].resStage != STAGE_UNUSED);
   activeNamespace = nId;
-#endif
 }
 
 
@@ -121,15 +221,6 @@ int namespaceGetActive ()
   return activeNamespace;
 }
 
-
-int namespaceHasLocalFile ( int nId )
-{
-  xassert ( nId < nNamespaces && nId >= 0 );
-
-  return hasLocalFiles ? hasLocalFiles[nId] : 0;
-}
-
-
 int namespaceAdaptKey ( int key, int nspTarget )
 {
   namespaceTuple_t tin;
@@ -167,14 +258,40 @@ int namespaceAdaptKey2 ( int key )
 void namespaceDefResStatus ( statusCode argResStatus )
 {
   int nsp = namespaceGetActive ();
-  resStatus[nsp] = argResStatus;
+  namespaces[nsp].resStage = argResStatus;
 }
 
 
 statusCode namespaceInqResStatus ( void )
 {
   int nsp = namespaceGetActive ();
-  return resStatus[nsp];
+  return namespaces[nsp].resStage;
+}
+
+void namespaceSwitchSet(enum namespaceSwitch sw, union namespaceSwitchValue value)
+{
+  xassert(sw > NSSWITCH_NO_SUCH_SWITCH && sw < NUM_NAMESPACE_SWITCH);
+  int nsp = namespaceGetActive();
+  namespaces[nsp].switches[sw] = value;
+}
+
+union namespaceSwitchValue namespaceSwitchGet(enum namespaceSwitch sw)
+{
+  xassert(sw > NSSWITCH_NO_SUCH_SWITCH && sw < NUM_NAMESPACE_SWITCH);
+  int nsp = namespaceGetActive();
+  return namespaces[nsp].switches[sw];
+}
+
+void cdiReset(void)
+{
+  NAMESPACE_LOCK();
+  for (int namespaceID = 0; namespaceID < namespacesSize; ++namespaceID)
+    namespaceDelete(namespaceID);
+  namespaces = &initialNamespace;
+  namespacesSize = 1;
+  nNamespaces = 1;
+  activeNamespace = 0;
+  NAMESPACE_UNLOCK();
 }
 
 /*
diff --git a/libcdi/src/namespace.h b/libcdi/src/namespace.h
index e5de439..00188d8 100644
--- a/libcdi/src/namespace.h
+++ b/libcdi/src/namespace.h
@@ -1,31 +1,75 @@
 #ifndef NAMESPACE_H
 #define NAMESPACE_H
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+
 typedef enum {
   STAGE_DEFINITION = 0,
   STAGE_TIMELOOP   = 1,
-  STAGE_CLEANUP    = 2
+  STAGE_CLEANUP    = 2,
+  STAGE_UNUSED     = 3,
 } statusCode;
 
 typedef struct {
   int idx;
   int nsp;
-  statusCode resStatus;
 } namespaceTuple_t;
 
+enum namespaceSwitch
+{
+  NSSWITCH_NO_SUCH_SWITCH = -1,
+  NSSWITCH_ABORT,
+  NSSWITCH_SERIALIZE_GET_SIZE,
+  NSSWITCH_SERIALIZE_PACK,
+  NSSWITCH_SERIALIZE_UNPACK,
+  NSSWITCH_FILE_OPEN,
+  NSSWITCH_FILE_WRITE,
+  NSSWITCH_FILE_CLOSE,
+  NSSWITCH_STREAM_OPEN_BACKEND,
+  NSSWITCH_STREAM_DEF_VLIST_,
+  NSSWITCH_STREAM_WRITE_VAR_,
+  NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
+  NSSWITCH_STREAM_WRITE_VAR_PART_,
+  NSSWITCH_STREAM_CLOSE_BACKEND,
+  NSSWITCH_STREAM_DEF_TIMESTEP_,
+  NSSWITCH_STREAM_SYNC,
+#ifdef HAVE_LIBNETCDF
+  NSSWITCH_NC__CREATE,
+  NSSWITCH_CDF_DEF_VAR,
+  NSSWITCH_CDF_DEF_TIMESTEP,
+  NSSWITCH_CDF_STREAM_SETUP,
+#endif
+  NUM_NAMESPACE_SWITCH,
+};
+
+union namespaceSwitchValue
+{
+  void *data;
+  void (*func)();
+};
+
+#define NSSW_FUNC(p) ((union namespaceSwitchValue){ .func = (void (*)())(p) })
+#define NSSW_DATA(p) ((union namespaceSwitchValue){ .data = (void *)(p) })
+
+int              namespaceNew();
+void             namespaceDelete(int namespaceID);
 void             namespaceCleanup      ( void );
-void             namespaceInit         ( int, int * );
-void             namespaceShowbits     ( int, char * );
 int              namespaceGetNumber    ( void );
 int              namespaceGetActive    ( void );
 int              namespaceIdxEncode    ( namespaceTuple_t );
 int              namespaceIdxEncode2   ( int, int );
 namespaceTuple_t namespaceResHDecode   ( int );
-int              namespaceHasLocalFile ( int );
 int              namespaceAdaptKey     ( int, int );
 int              namespaceAdaptKey2    ( int );
 void             namespaceDefResStatus ( statusCode );
 statusCode       namespaceInqResStatus ( void );
+void namespaceSwitchSet(enum namespaceSwitch sw,
+                        union namespaceSwitchValue value);
+union namespaceSwitchValue namespaceSwitchGet(enum namespaceSwitch sw);
+
 
 #endif
 /*
diff --git a/libcdi/src/pio.c b/libcdi/src/pio.c
index 1dd918f..e71200b 100644
--- a/libcdi/src/pio.c
+++ b/libcdi/src/pio.c
@@ -5,10 +5,19 @@
 
 #ifdef USE_MPI
 
+#include <ctype.h>
+#include <yaxt.h>
+
+#include "file.h"
+#include "cdi_int.h"
+#include "namespace.h"
+
 #include "pio.h"
 #include "cdi.h"
 #include "pio_comm.h"
 #include "pio_impl.h"
+#include "pio_interface.h"
+#include "pio_rpc.h"
 #include "pio_util.h"
 
 char * command2charP[6] = {"IO_Open_file", "IO_Close_file",
@@ -55,7 +64,8 @@ struct fileOpTag decodeFileOpTag(int tag)
 
 /***************************************************************/
 
-size_t pioFileWrite ( int fileID, int tsID, const void *buffer, size_t len )
+size_t
+cdiPioFileWrite(int fileID, const void *restrict buffer, size_t len, int tsID)
 {
   size_t iret = CDI_UNDEFID;
 
@@ -104,10 +114,13 @@ int pioFileClose ( int id )
 
 /***************************************************************/
 
-int pioFileOpenW ( const char *filename )
+int pioFileOpen(const char *filename, const char *mode)
 {
   int iret = CDI_UNDEFID;
 
+  if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0)
+    xabort("Unsupported mode \"%s\" in parallel file open.", mode);
+
   switch ( commInqIOMode ())
     {
     case PIO_MPI:
diff --git a/libcdi/src/pio.h b/libcdi/src/pio.h
index c6f6716..e7138a7 100644
--- a/libcdi/src/pio.h
+++ b/libcdi/src/pio.h
@@ -9,13 +9,17 @@
 #include <stdlib.h>
 #include <mpi.h>
 
+#include "cdi_int.h"
+
 void   backendCleanup  ( void );
 void   backendInit     ( void );
 void   backendFinalize ( void );
-int    pioFileOpenW    ( const char* );
+int pioFileOpen(const char *filename, const char *mode);
 int    pioFileClose    ( int );
-size_t pioFileWrite    ( int, int, const void*, size_t );
-
+size_t cdiPioFileWrite(int fileID, const void *restrict buffer, size_t len,
+                       int tsID);
+#else
+typedef int MPI_Comm;
 #endif
 
 #endif
diff --git a/libcdi/src/pio_c_temp.h b/libcdi/src/pio_c_temp.h
deleted file mode 100644
index d621364..0000000
--- a/libcdi/src/pio_c_temp.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef PIO_C_TEMP
-#define PIO_C_TEMP
-
-#if defined (HAVE_CONFIG_H)
-#  include "config.h"
-#endif
-
-#ifdef USE_MPI
-#include "mpi.h"
-#else
-typedef int MPI_Comm; 
-#endif
-
-MPI_Comm pioInit_c ( MPI_Comm, int, int, int, int * );
-
-#endif
-/*
- * Local Variables:
- * c-file-style: "Java"
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * show-trailing-whitespace: t
- * require-trailing-newline: t
- * End:
- */
diff --git a/libcdi/src/pio_cdf_int.c b/libcdi/src/pio_cdf_int.c
new file mode 100644
index 0000000..1dcdbe8
--- /dev/null
+++ b/libcdi/src/pio_cdf_int.c
@@ -0,0 +1,75 @@
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#if defined USE_MPI && defined (HAVE_NETCDF4) && defined (HAVE_PARALLEL_NC4)
+
+#include <netcdf.h>
+#ifdef HAVE_NETCDF_PAR_H
+#include <netcdf_par.h>
+#endif
+
+#include "namespace.h"
+#include "pio.h"
+#include "pio_comm.h"
+#include "pio_cdf_int.h"
+#include "pio_util.h"
+
+#include "pio_cdf_int.h"
+
+static int
+cdiPio_nc__create(const char *path, int cmode,
+                  size_t initialsz, size_t *chunksizehintp,
+                  int *ncidp)
+{
+  int status;
+  if (cmode & NC_NETCDF4
+      && commInqIOMode() != PIO_NONE)
+    {
+      cmode |= NC_MPIPOSIX;
+      status = nc_create_par(path, cmode, commInqCommColl(),
+                             MPI_INFO_NULL, ncidp);
+    }
+  else if (cmode & (NC_64BIT_OFFSET | NC_CLASSIC_MODEL)
+           && commInqIOMode() != PIO_NONE)
+    {
+      /* FIXME: improve handling of pnetcdf here */
+      abort();
+    }
+  else
+    status = nc__create(path, cmode, initialsz, chunksizehintp, ncidp);
+  return status;
+}
+
+static void
+cdiPioCdfDefVar(int ncid, const char *name, nc_type xtype, int ndims,
+                const int dimids[], int *varidp)
+{
+  cdf_def_var_serial(ncid, name, xtype, ndims, dimids, varidp);
+  if (commInqIOMode() != PIO_NONE)
+    {
+      xdebug("%s", "calling nc_var_par_access");
+      int status = nc_var_par_access(ncid, *varidp, NC_COLLECTIVE);
+      if ( status != NC_NOERR )
+        Error("%s", nc_strerror(status));
+    }
+}
+
+void
+cdiPioEnableNetCDFParAccess()
+{
+  namespaceSwitchSet(NSSWITCH_NC__CREATE, NSSW_FUNC(cdiPio_nc__create));
+  namespaceSwitchSet(NSSWITCH_CDF_DEF_VAR, NSSW_FUNC(cdiPioCdfDefVar));
+}
+
+
+#endif
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
diff --git a/libcdi/src/pio_cdf_int.h b/libcdi/src/pio_cdf_int.h
new file mode 100644
index 0000000..741c659
--- /dev/null
+++ b/libcdi/src/pio_cdf_int.h
@@ -0,0 +1,15 @@
+#ifndef PIO_CDF_INT_H
+#define PIO_CDF_INT_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifdef HAVE_LIBNETCDF
+#include "cdf_int.h"
+
+void
+cdiPioEnableNetCDFParAccess();
+
+#endif
+#endif
diff --git a/libcdi/src/pio_client.c b/libcdi/src/pio_client.c
new file mode 100644
index 0000000..16b8f94
--- /dev/null
+++ b/libcdi/src/pio_client.c
@@ -0,0 +1,256 @@
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifdef USE_MPI
+#include <ctype.h>
+
+#include <yaxt.h>
+
+#include "namespace.h"
+#include "taxis.h"
+
+#include "pio.h"
+#include "pio_client.h"
+#include "pio_comm.h"
+#include "pio_interface.h"
+#include "pio_rpc.h"
+#include "pio_util.h"
+#include "pio_serialize.h"
+
+static int
+cdiPioClientStreamOpen(const char *filename, const char *filemode,
+                       int filetype, stream_t *streamptr,
+                       int recordBufIsToBeCreated)
+{
+  union winHeaderEntry header;
+  size_t filename_len;
+  if ( tolower ( * filemode ) == 'w' )
+    {
+      statusCode nspStatus = namespaceInqResStatus ();
+      switch ( nspStatus )
+        {
+        case STAGE_DEFINITION:
+          break;
+        case STAGE_TIMELOOP:
+          filename_len = strlen(filename);
+          xassert(filename_len > 0 && filename_len < MAXDATAFILENAME);
+          header.funcCall
+            = (struct funcCallDesc){
+            .funcID = STREAMOPEN,
+            .funcArgs.newFile = { .fnamelen = (int)filename_len,
+                                  .filetype = filetype } };
+          pioBufferFuncCall(header, filename, filename_len + 1);
+          xdebug("WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, filenamesz=%zu,"
+                 " filename=%s, filetype=%d",
+                 funcMap[(-1 - STREAMOPEN)], filename_len + 1, filename,
+                 filetype);
+          break;
+        case STAGE_CLEANUP:
+          xabort ( "TRANSITION TO IO PROCESSES ALREADY FINISHED." );
+          break;
+        default:
+          xabort ( "INTERNAL ERROR" );
+        }
+    }
+  else
+    Error("cdiPIO read support not implemented");
+  return 1;
+}
+
+static void
+cdiPioClientStreamDefVlist_(int streamID, int vlistID)
+{
+  union winHeaderEntry header;
+  statusCode nspStatus = namespaceInqResStatus ();
+  switch ( nspStatus )
+    {
+    case STAGE_DEFINITION:
+      break;
+    case STAGE_TIMELOOP:
+      header.funcCall
+        = (struct funcCallDesc){
+        .funcID = STREAMDEFVLIST,
+        .funcArgs.streamChange = { streamID, vlistID } };
+      pioBufferFuncCall(header, NULL, 0);
+      xdebug("WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, streamID=%d,"
+             " vlistID=%d", funcMap[(-1 - STREAMDEFVLIST)], streamID, vlistID);
+      break;
+    case STAGE_CLEANUP:
+      xabort ( "TRANSITION TO IO PROCESSES ALREADY FINISHED." );
+      break;
+    default:
+      xabort ( "INTERNAL ERROR" );
+    }
+  cdiStreamDefVlist_(streamID, vlistID);
+}
+
+static void
+cdiPioClientStreamWriteVar_(int streamID, int varID, int memtype,
+                            const void *data, int nmiss)
+{
+  xabort("parallel writing requires explicit partition information,"
+         " use streamWriteVarPart!");
+}
+
+static void
+cdiPioClientStreamWriteVarChunk_(int streamID, int varID, int memtype,
+                                 const int rect[][2],
+                                 const void *data, int nmiss)
+{
+  int vlistID = streamInqVlist(streamID);
+  int size = vlistInqVarSize(vlistID, varID),
+    varShape[3];
+  unsigned ndims = (unsigned)cdiPioQueryVarDims(varShape, vlistID, varID);
+  Xt_int varShapeXt[3], chunkShape[3] = { 1, 1, 1 }, origin[3] = { 0, 0, 0 };
+  /* FIXME: verify xt_int ranges are good enough */
+  for (unsigned i = 0; i < 3; ++i)
+    varShapeXt[i] = varShape[i];
+  for (unsigned i = 0; i < ndims; ++i)
+    chunkShape[i] = rect[i][1] - rect[i][0] + 1;
+  int varSize = varShape[0] * varShape[1] * varShape[2];
+  xassert(varSize == size);
+  Xt_idxlist chunkDesc
+    = xt_idxsection_new(0, ndims, varShapeXt, chunkShape, origin);
+  pioBufferPartData(streamID, varID, data, nmiss, chunkDesc);
+  xt_idxlist_delete(chunkDesc);
+}
+
+static void
+cdiPioClientStreamWriteVarPart(int streamID, int varID, const void *data,
+                               int nmiss, Xt_idxlist partDesc)
+{
+  switch (namespaceInqResStatus())
+    {
+    case STAGE_DEFINITION:
+      xabort("DEFINITION STAGE: PARALLEL WRITING NOT POSSIBLE.");
+      break;
+    case STAGE_TIMELOOP:
+      pioBufferPartData(streamID, varID, data, nmiss, partDesc);
+      return;
+    case STAGE_CLEANUP:
+      xabort("CLEANUP STAGE: PARALLEL WRITING NOT POSSIBLE.");
+      break;
+    default:
+      xabort("INTERNAL ERROR");
+    }
+}
+
+#if defined HAVE_LIBNETCDF
+static void
+cdiPioCdfDefTimestepNOP(stream_t *streamptr, int tsID)
+{
+}
+#endif
+
+static void
+cdiPioClientStreamNOP(stream_t *streamptr)
+{
+}
+
+
+static void
+cdiPioClientStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted)
+{
+  union winHeaderEntry header;
+  statusCode nspStatus = namespaceInqResStatus ();
+  switch ( nspStatus )
+    {
+    case STAGE_DEFINITION:
+      break;
+    case STAGE_TIMELOOP:
+      header.funcCall
+        = (struct funcCallDesc){
+        .funcID = STREAMCLOSE,
+        .funcArgs.streamChange = { streamptr->self, CDI_UNDEFID } };
+      pioBufferFuncCall(header, NULL, 0);
+      xdebug("WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, streamID=%d",
+             funcMap[-1 - STREAMCLOSE], streamptr->self);
+      break;
+    case STAGE_CLEANUP:
+      break;
+    default:
+      xabort ( "INTERNAL ERROR" );
+    }
+}
+
+static int
+cdiPioClientStreamDefTimestep_(stream_t *streamptr, int tsID)
+{
+  union winHeaderEntry header;
+  statusCode nspStatus = namespaceInqResStatus ();
+  int taxisID, buf_size, position;
+  char *buf;
+  MPI_Comm commCalc;
+  switch ( nspStatus )
+    {
+    case STAGE_DEFINITION:
+      break;
+    case STAGE_TIMELOOP:
+      position = 0;
+      taxisID = vlistInqTaxis(streamptr->vlistID);
+      header.funcCall
+        = (struct funcCallDesc){
+        .funcID = STREAMDEFTIMESTEP,
+        .funcArgs.streamNewTimestep = { streamptr->self, tsID } };
+      commCalc = commInqCommCalc();
+      buf_size = reshResourceGetPackSize(taxisID, &taxisOps, &commCalc);
+      buf = xmalloc((size_t)buf_size);
+      reshPackResource(taxisID, &taxisOps, buf, buf_size, &position,
+                       &commCalc);
+      pioBufferFuncCall(header, buf, buf_size);
+      free(buf);
+      break;
+    case STAGE_CLEANUP:
+      break;
+    default:
+      xabort ( "INTERNAL ERROR" );
+    }
+  return cdiStreamDefTimestep_(streamptr, tsID);
+}
+
+void
+cdiPioClientSetup(int *pioNamespace_, int *pioNamespace)
+{
+  commEvalPhysNodes ();
+  commDefCommsIO ();
+  *pioNamespace_ = *pioNamespace = namespaceNew();
+  int callerCDINamespace = namespaceGetActive();
+  pioNamespaceSetActive(*pioNamespace_);
+  serializeSetMPI();
+  namespaceSwitchSet(NSSWITCH_STREAM_OPEN_BACKEND,
+                     NSSW_FUNC(cdiPioClientStreamOpen));
+  namespaceSwitchSet(NSSWITCH_STREAM_DEF_VLIST_,
+                     NSSW_FUNC(cdiPioClientStreamDefVlist_));
+  namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_,
+                     NSSW_FUNC(cdiPioClientStreamWriteVar_));
+  namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
+                     NSSW_FUNC(cdiPioClientStreamWriteVarChunk_));
+  namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_PART_,
+                     NSSW_FUNC(cdiPioClientStreamWriteVarPart));
+  namespaceSwitchSet(NSSWITCH_STREAM_CLOSE_BACKEND,
+                     NSSW_FUNC(cdiPioClientStreamClose));
+  namespaceSwitchSet(NSSWITCH_STREAM_DEF_TIMESTEP_,
+                     NSSW_FUNC(cdiPioClientStreamDefTimestep_));
+  namespaceSwitchSet(NSSWITCH_STREAM_SYNC,
+                     NSSW_FUNC(cdiPioClientStreamNOP));
+#ifdef HAVE_LIBNETCDF
+  namespaceSwitchSet(NSSWITCH_CDF_DEF_TIMESTEP,
+                     NSSW_FUNC(cdiPioCdfDefTimestepNOP));
+  namespaceSwitchSet(NSSWITCH_CDF_STREAM_SETUP,
+                     NSSW_FUNC(cdiPioClientStreamNOP));
+#endif
+  pioNamespaceSetActive(callerCDINamespace);
+}
+
+
+#endif
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
diff --git a/libcdi/src/pio_client.h b/libcdi/src/pio_client.h
new file mode 100644
index 0000000..7875064
--- /dev/null
+++ b/libcdi/src/pio_client.h
@@ -0,0 +1,7 @@
+#ifndef PIO_CLIENT_H
+#define PIO_CLIENT_H
+
+void
+cdiPioClientSetup(int *pioNamespace_, int *pioNamespace);
+
+#endif
diff --git a/libcdi/src/pio_comm.c b/libcdi/src/pio_comm.c
index a5ce345..389a2e6 100644
--- a/libcdi/src/pio_comm.c
+++ b/libcdi/src/pio_comm.c
@@ -40,6 +40,7 @@ typedef struct {
   int rankColl;
 
   MPI_Comm commCalc;
+  int rankCalc, sizeCalc;
 
   MPI_Comm * commsIO;
   int nProcsColl;
@@ -61,28 +62,30 @@ void pioInfoInit ( pioInfo_t * p )
   p->nProcsIO             = CDI_UNDEFID;
   p->nProcsModel          = CDI_UNDEFID;
   p->isProcIO             = CDI_UNDEFID;
-                          
+
   p->commGlob             = MPI_COMM_NULL;
   p->sizeGlob             = CDI_UNDEFID;
   p->rankGlob             = CDI_UNDEFID;
   p->root                 = CDI_UNDEFID;
-                          
+
   p->commPio              = MPI_COMM_NULL;
   p->sizePio              = CDI_UNDEFID;
-  p->rankPio              = CDI_UNDEFID;
-                          
+  p->rankPio              = -1;
+
   p->commNode             = MPI_COMM_NULL;
   p->sizeNode             = CDI_UNDEFID;
   p->rankNode             = CDI_UNDEFID;
   p->hostname[0]          = 0;
   p->specialRankNode      = CDI_UNDEFID;
-                          
+
   p->commColl             = MPI_COMM_NULL;
   p->sizeColl             = CDI_UNDEFID;
   p->rankColl             = CDI_UNDEFID;
-                          
+
   p->commCalc             = MPI_COMM_NULL;
-                          
+  p->rankCalc             = -1;
+  p->sizeCalc             = -1;
+
   p->commsIO              = NULL;
   p->nodeInfo.hostID      = CDI_UNDEFID;
   p->nodeInfo.isProcColl  = CDI_UNDEFID;
@@ -111,33 +114,35 @@ void commDestroy ( void )
   if ( info->nodeMap   != NULL ) free ( info->nodeMap );
   if ( info->nodeSizes != NULL ) free ( info->nodeSizes );
 
-  if ( info->commsIO != NULL ) 
+  if ( info->commsIO != NULL )
     {
       for ( collID = 0; collID < info->nProcsColl; collID++ )
 	if ( info->commsIO[collID] != MPI_COMM_NULL )
-	  xmpi ( MPI_Comm_free ( &info->commsIO[collID] ));
-      free ( info->commsIO ); 
+	  xmpi(MPI_Comm_free(info->commsIO + collID));
+      free ( info->commsIO );
       info->commsIO = NULL;
     }
 
   if ( info->commColl != MPI_COMM_NULL )
     {
-      xmpi ( MPI_Comm_free ( &info->commColl )); 
+      xmpi ( MPI_Comm_free ( &info->commColl ));
       info->commColl = MPI_COMM_NULL;
     }
-  
+
+  free(info->procsCollMap);
+
   if ( info->commNode != MPI_COMM_NULL )
     {
-      xmpi ( MPI_Comm_free ( &info->commNode )); 
+      xmpi ( MPI_Comm_free ( &info->commNode ));
       info->commNode = MPI_COMM_NULL;
     }
-  
+
   if ( info->commPio != MPI_COMM_NULL )
     {
-      xmpi ( MPI_Comm_free ( &info->commPio )); 
+      xmpi ( MPI_Comm_free ( &info->commPio ));
       info->commPio = MPI_COMM_NULL;
     }
-  
+
   free ( info );
   info = NULL;
 }
@@ -249,21 +254,51 @@ int      commInqIOMode  ( void )
 
 void     commDefCommPio  ( void )
 {
-  int nProcsModel;
+  int nProcsCalc;
+  MPI_Group grpAll, grpCalc, grpPio;
+  int calcRange[3], pioRange[3];
 
   xassert ( info != NULL &&
            info->commGlob != MPI_COMM_NULL &&
            info->IOMode  != CDI_UNDEFID &&
            info->nProcsIO != CDI_UNDEFID );
 
-  nProcsModel = info->sizeGlob - info->nProcsIO;
+  nProcsCalc = info->sizeGlob - info->nProcsIO;
+
+  info->isProcIO = info->rankGlob >= nProcsCalc ? 1 : 0;
 
-  info->isProcIO = info->rankGlob >= nProcsModel ? 1 : 0;
+  xmpi(MPI_Comm_group(info->commGlob, &grpAll));
 
-  xmpi ( MPI_Comm_split ( info->commGlob, info->isProcIO, 0, 
-                          &info->commPio ));
-  xmpi ( MPI_Comm_size ( info->commPio, &info->sizePio ));
-  xmpi ( MPI_Comm_rank ( info->commPio, &info->rankPio )); 
+  calcRange[0] = 0;
+  calcRange[1] = info->sizeGlob - info->nProcsIO - 1;
+  calcRange[2] = 1;
+  xmpi(MPI_Group_range_incl(grpAll, info->nProcsIO==info->sizeGlob?0:1,
+                            &calcRange, &grpCalc));
+  xmpi(MPI_Comm_create(info->commGlob, grpCalc, &info->commCalc));
+
+  pioRange[0] = info->sizeGlob - info->nProcsIO;
+  pioRange[1] = info->sizeGlob - 1;
+  pioRange[2] = 1;
+  xmpi(MPI_Group_range_incl(grpAll, 1, &pioRange, &grpPio));
+  xmpi(MPI_Comm_create(info->commGlob, grpPio, &info->commPio));
+
+  if (info->commPio != MPI_COMM_NULL)
+    {
+      xmpi(MPI_Comm_size(info->commPio, &info->sizePio));
+      xmpi(MPI_Comm_rank(info->commPio, &info->rankPio));
+      info->sizeCalc = nProcsCalc;
+      info->rankCalc = -1;
+    }
+  else
+    {
+      info->sizePio = nProcsCalc;
+      info->rankPio = -1;
+      xmpi(MPI_Comm_size(info->commCalc, &info->sizeCalc));
+      xmpi(MPI_Comm_rank(info->commCalc, &info->rankCalc));
+    }
+  xmpi(MPI_Group_free(&grpCalc));
+  xmpi(MPI_Group_free(&grpPio));
+  xmpi(MPI_Group_free(&grpAll));
 }
 
 
@@ -279,16 +314,16 @@ MPI_Comm commInqCommPio  ( void )
 MPI_Comm commInqCommModel ( void )
 {
   xassert ( info != NULL &&
-           info->commPio != MPI_COMM_NULL &&
+           info->commCalc != MPI_COMM_NULL &&
            info->isProcIO == 0 );
-  return info->commPio;
+  return info->commCalc;
 }
 
 
 int      commInqRankPio       ( void )
 { 
   xassert ( info != NULL &&
-           info->rankPio != CDI_UNDEFID &&
+           info->rankPio >= 0 &&
            info->isProcIO == 1 );
   return info->rankPio;
 }
@@ -297,9 +332,9 @@ int      commInqRankPio       ( void )
 int      commInqRankModel       ( void )
 { 
   xassert ( info != NULL &&
-           info->rankPio != CDI_UNDEFID &&
+           info->rankCalc >= 0 &&
            info->isProcIO == 0 );
-  return info->rankPio;
+  return info->rankCalc;
 }
 
 
@@ -340,57 +375,69 @@ int      commInqRankColl    ( void )
   return info->rankColl; 
 }
 
-
-static int cmpr ( const void *a, const void *b )
+static int
+cmpstringp(const void *p1, const void *p2)
 {
-  return strcmp ( *( char ** ) a, *( char ** ) b);
+  return strcmp(* (char * const *) p1, * (char * const *) p2);
 }
 
-
 void commDefCommNode ( void )
 {
-  int size, len, i, j, test;
-  char * myHost, ** allHosts, * allHosts0, * curr;
+  int size;
+  char * myHost, (*allHosts)[MPI_MAX_PROCESSOR_NAME], **sortedHosts;
 
   xassert ( info != NULL &&
            info->commPio != MPI_COMM_NULL );
 
   size = info->sizePio;
 
-  myHost = xmalloc ( MPI_MAX_PROCESSOR_NAME * sizeof ( myHost[0] ));
-  xmpi ( MPI_Get_processor_name ( myHost, &len ));
-  xassert ( myHost[0] != '\0' );
-  strncpy ( info->hostname, myHost, len );
-  info->hostname[len] = '\0';
-
-  allHosts    = xmalloc ( size * sizeof ( allHosts[0] ));
-  allHosts[0] = xmalloc ( size * MPI_MAX_PROCESSOR_NAME *
-                          sizeof ( allHosts[0][0] ));
-  allHosts0 = allHosts[0];
-  for ( i = 1; i < size; i++ )
-    allHosts[i] = allHosts[0] + i * MPI_MAX_PROCESSOR_NAME;
-
-  xmpi ( MPI_Allgather ( myHost, MPI_MAX_PROCESSOR_NAME, MPI_CHAR,
-                         & ( allHosts[0][0] ), MPI_MAX_PROCESSOR_NAME,
-                         MPI_CHAR, info->commPio ));
-
-  qsort ( allHosts, size, sizeof ( char * ), cmpr );
-
-  i = 0;
-  j = 0;
-
-  while ( i < size )
-    {
-      curr = allHosts[i];
-      j++;
-      if (( test = strcmp ( myHost, curr )) == 0 ) info->nodeInfo.hostID = j;
-
-      while ( ++i < size )
-        if (( test = strcmp ( allHosts[i], curr )) != 0)
-          break;
-    }
-
-  info->nodeInfo.nNodes = j;
+  myHost = xmalloc(MPI_MAX_PROCESSOR_NAME);
+  {
+    int len;
+    xmpi ( MPI_Get_processor_name ( myHost, &len ));
+    xassert ( myHost[0] != '\0' );
+    strncpy(info->hostname, myHost, len);
+    info->hostname[len] = '\0';
+  }
+
+  allHosts = xmalloc(size * MPI_MAX_PROCESSOR_NAME);
+  sortedHosts = xmalloc(size * sizeof(sortedHosts[0]));
+
+  {
+    int i;
+    for (i = 0; i < size; ++i)
+      sortedHosts[i] = allHosts[i];
+  }
+
+  xmpi(MPI_Allgather(myHost, MPI_MAX_PROCESSOR_NAME, MPI_CHAR,
+                     allHosts[0], MPI_MAX_PROCESSOR_NAME,
+                     MPI_CHAR, info->commPio ));
+
+  qsort(sortedHosts, size, sizeof (sortedHosts[0]),
+        (int (*)(const void *, const void *))cmpstringp);
+
+  {
+    int i = 1, nHosts = 1;
+    if (!strcmp(myHost, sortedHosts[0]))
+      {
+        info->nodeInfo.hostID = 1;
+      }
+    else
+      {
+        for (; i < size && strcmp(myHost, sortedHosts[i]); ++i)
+          if (strcmp(sortedHosts[i - 1], sortedHosts[i]))
+            {
+              /* new host seen, might be ours */
+              nHosts += 1;
+              if (!strcmp(sortedHosts[i], myHost))
+                info->nodeInfo.hostID = nHosts - 1;
+            }
+      }
+    for (; i < size && strcmp(myHost, sortedHosts[i]); ++i)
+      if (strcmp(sortedHosts[i - 1], sortedHosts[i]))
+        nHosts += 1;
+    info->nodeInfo.nNodes = nHosts;
+  }
 
   xassert ( info->nodeInfo.hostID != CDI_UNDEFID );
 
@@ -401,9 +448,9 @@ void commDefCommNode ( void )
   if ( info->IOMode >= info->minIOModeWithSpecialProcs )
     info->specialRankNode = info->sizeNode - 1;
 
-  free ( allHosts0 );
-  free ( allHosts );
-  free ( myHost );
+  free(sortedHosts);
+  free(allHosts);
+  free(myHost);
 
   return;
 }
@@ -516,7 +563,7 @@ void     commEvalPhysNodes  ( void )
 
   if ( info->rankGlob == info->root )
     {
-      xassert ( info->rankPio == info->root );
+      xassert ( info->rankCalc == info->root );
  
       for ( i = info->nProcsModel; i < info->sizeGlob; i++ )
         {
@@ -527,7 +574,7 @@ void     commEvalPhysNodes  ( void )
     }
 
   xmpi ( MPI_Bcast ( nodeInfo, size, MPI_INTEGER, info->root, 
-                     info->commPio ));
+                     info->commCalc ));
 
   // consistency check, count collectors
   for ( IOID = 0; IOID < info->nProcsIO; IOID++ )
@@ -644,7 +691,7 @@ int *    commInqNodeSizes   ( void )
 // collective call
 void     commDefCommsIO     ( void )
 {
-  MPI_Group groupGlob, currGroupIO;
+  MPI_Group groupGlob;
   int collID, * ranks, i, currIORank;
   char name[MAXCOMMIONAME];
 
@@ -664,18 +711,20 @@ void     commDefCommsIO     ( void )
   
   ranks = xmalloc (( info->nProcsModel + 1 ) * sizeof ( ranks[0] ));
   for ( i = 0; i < info->nProcsModel; i++ )
-    * ( ranks + i ) = i;
+    ranks[i] = i;
   
   xmpi ( MPI_Comm_group ( info->commGlob, &groupGlob )); 
 
   for ( collID = 0; collID < info->nProcsColl; collID++ )
     {
       currIORank = info->nodeMap[collID];
-      * ( ranks + info->nProcsModel ) = currIORank;
-      xmpi ( MPI_Group_incl ( groupGlob, info->nProcsModel + 1, 
-                              ranks, &currGroupIO ));
-      xmpi ( MPI_Comm_create ( info->commGlob, currGroupIO,  
-                               info->commsIO + collID ));
+      ranks[info->nProcsModel] = currIORank;
+      MPI_Group currGroupIO;
+      xmpi(MPI_Group_incl(groupGlob, info->nProcsModel + 1,
+                          ranks, &currGroupIO));
+      xmpi(MPI_Comm_create(info->commGlob, currGroupIO,
+                           info->commsIO + collID));
+      xmpi(MPI_Group_free(&currGroupIO));
       if ( info->rankGlob == currIORank )
 	info->commCalc = info->commsIO[collID];
 
@@ -697,7 +746,6 @@ void     commDefCommsIO     ( void )
 	xdebugComm ( &info->commCalc );
     }
 
-  xmpi ( MPI_Group_free ( &currGroupIO ));
   xmpi ( MPI_Group_free ( &groupGlob ));
   free ( ranks );
 
diff --git a/libcdi/src/pio_interface.c b/libcdi/src/pio_interface.c
index b8098cf..fbe8791 100644
--- a/libcdi/src/pio_interface.c
+++ b/libcdi/src/pio_interface.c
@@ -2,23 +2,33 @@
 #  include "config.h"
 #endif
 
+#include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
+
+#ifdef USE_MPI
+#include <mpi.h>
+#include <yaxt.h>
+#endif
+
 #include "cdi.h"
-#include "limits.h"
 #include "pio_util.h"
 #include "vlist_var.h"
 
 #ifdef USE_MPI
 #include "namespace.h"
+#include "pio.h"
+#include "pio_serialize.h"
 #include "pio_interface.h"
 #include "pio_comm.h"
 #include "pio_rpc.h"
+#include "pio_client.h"
 #include "pio_server.h"
 #include "resource_handle.h"
 #include "cdi_int.h"
 #include "vlist.h"
+
 extern resOps streamOps;
 
 
@@ -29,11 +39,18 @@ static struct rdmaWin
   MPI_Win win;
   int postSet, refuseFuncCall;
   MPI_Group ioGroup;
+  int dictSize, dictDataUsed, dictRPCUsed, dict;
 } *txWin = NULL;
 
 
-char * funcMap[nFuncs] = {"streamOpen", "streamDefVlist", "streamClose" };
+const char * const funcMap[numRPCFuncs] = {
+  "streamOpen",
+  "streamDefVlist",
+  "streamClose",
+  "streamDefTimestep",
+};
 
+float cdiPIOpartInflate_;
 
 /****************************************************/
 
@@ -77,13 +94,14 @@ mapProblems(int problemSizes[], int * problemMapping, int nProblems,
   for ( j = 0; j < nWriter; j++ )
     meanBucket[j] = ( double ) sum * ( * ( w + j ));
 
+  memset(buckets, 0, sizeof (buckets));
+
   for ( i = 0; i < nProblems; i++ )
     {
       currCapacity = INT_MIN;
 
       for ( j = 0; j < nWriter; j++ )
 	{
-	  if ( !i ) buckets[j] = 0.0;
 	  nextCapacity = meanBucket[j] - ( buckets[j] + ( *ip[i] ));
 
 	  if ( nextCapacity > currCapacity )
@@ -96,12 +114,15 @@ mapProblems(int problemSizes[], int * problemMapping, int nProblems,
       buckets[writerIdx] +=  *ip[i];
     }
 
-  xprintArray3 (  "problemSizes = ", problemSizes, nProblems, DATATYPE_INT );
-  xprintArray3 ( "vector of indices, qsort of problemSizes", dummy,
-                nProblems, DATATYPE_INT );
-  xprintArray3 ( "problemMapping", problemMapping, nProblems, DATATYPE_INT );
-  xprintArray3 ( "meanBucket", meanBucket, nWriter, DATATYPE_FLT );
-  xprintArray3 ( "actual buckets", buckets, nWriter, DATATYPE_INT );
+  if ( ddebug )
+    {
+      xprintArray3 (  "problemSizes = ", problemSizes, nProblems, DATATYPE_INT );
+      xprintArray3 ( "vector of indices, qsort of problemSizes", dummy,
+                    nProblems, DATATYPE_INT );
+      xprintArray3 ( "problemMapping", problemMapping, nProblems, DATATYPE_INT );
+      xprintArray3 ( "meanBucket", meanBucket, nWriter, DATATYPE_FLT );
+      xprintArray3 ( "actual buckets", buckets, nWriter, DATATYPE_INT );
+    }
 }
 
 /****************************************************/
@@ -221,45 +242,12 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping,
 /************************************************************************/
 
 static void
-defVarDeco(int vlistID, int varID)
-{
-  int varSize, cRank, lChunk, rem, lOffset;
-  int nProcsModel = commInqNProcsModel ();
-  deco_t deco[nProcsModel];
-
-  varSize = vlistInqVarSize ( vlistID, varID );
-
-  for ( cRank = 0; cRank < nProcsModel; cRank++ )
-    {
-      lChunk = varSize / nProcsModel;
-      lOffset = cRank * lChunk;
-      rem = varSize % nProcsModel;
-      if ( cRank < rem )
-        {
-          lChunk++;
-          lOffset += cRank;
-        }
-      else
-        lOffset += rem;
-
-      deco[cRank].rank   = cRank;
-      deco[cRank].offset = lOffset;
-      deco[cRank].chunk  = lChunk;
-    }
-  vlistDefVarDeco ( vlistID, varID, nProcsModel, &deco[0] );
-}
-
-/************************************************************************/
-
-
-static void
 varsMapNDeco(int nNodes, int *nodeSizes)
 {
   int nStreams, nVars, * resHs, * streamSizes, * varSizes, * varMapping,
     * collectsData;
   int i, j, k = 0;
   int nProcsColl = commInqNProcsColl ();
-  char text[1024];
 
   xdebug ( "START, nProcsColl=%d", nProcsColl );
 
@@ -290,8 +278,6 @@ varsMapNDeco(int nNodes, int *nodeSizes)
   for ( i = 0; i < nStreams; i++ )
     for ( j = 0; j < * ( streamSizes + i ); j++ )
       {
-        defVarDeco ( streamInqVlist ( *( resHs + i )), j );
-        defVarDeco ( streamInqVlistIDorig ( * ( resHs + i )), j );
         vlistDefVarIOrank ( streamInqVlist ( * ( resHs + i )), j,
                             * ( varMapping + k ));
         vlistDefVarIOrank ( streamInqVlistIDorig ( * ( resHs + i )), j,
@@ -301,14 +287,10 @@ varsMapNDeco(int nNodes, int *nodeSizes)
 
   for ( j = 0; j < nProcsColl; j++ )
     if ( collectsData[j] == 0 )
-      {
-        sprintf ( text,
-                  "\nAT LEAST ONE COLLECTOR PROCESS IDLES, "
-                  "CURRENTLY NOT COVERED: "
-                  "PE%d collects no data",
-                  commCollID2RankGlob ( j ));
-        xabort ( text );
-      }
+      xabort("AT LEAST ONE COLLECTOR PROCESS IDLES, "
+             "CURRENTLY NOT COVERED: "
+             "PE%d collects no data",
+             commCollID2RankGlob(j));
 
   if ( varMapping )   free ( varMapping );
   if ( varSizes )     free ( varSizes );
@@ -328,71 +310,106 @@ void modelWinCleanup ( void )
 
   xdebug("%s", "START");
   if (txWin != NULL)
-    for ( collID = 0; collID < commInqNProcsColl (); collID ++ )
-      {
-        if (txWin[collID].postSet)
-          xmpi(MPI_Win_wait(txWin[collID].win));
-        xmpi(MPI_Win_free(&txWin[collID].win));
-        xmpi ( MPI_Free_mem ( txWin[collID].buffer ));
-        xmpi(MPI_Group_free(&txWin[collID].ioGroup));
-      }
-
-  if (txWin) free(txWin);
+    {
+      for ( collID = 0; collID < commInqNProcsColl (); collID ++ )
+        {
+          if (txWin[collID].postSet)
+            xmpi(MPI_Win_wait(txWin[collID].win));
+          xmpi(MPI_Win_free(&txWin[collID].win));
+          xmpi ( MPI_Free_mem ( txWin[collID].buffer ));
+          xmpi(MPI_Group_free(&txWin[collID].ioGroup));
+        }
+      free(txWin);
+    }
 
   xdebug("%s", "RETURN. CLEANED UP MPI_WIN'S");
 }
 
 /************************************************************************/
 
+struct collDesc
+{
+  int numDataRecords, numRPCRecords;
+};
+
 static void
 modelWinDefBufferSizes(void)
 {
-  int collID, nstreams, * streamIndexList, streamNo, vlistID, nvars, varID;
-  int collIDchunk = 0, sumWinBufferSize = 0;
+  int collID, nstreams, * streamIndexList, streamNo, nvars, varID;
+  int sumWinBufferSize = 0;
   int nProcsColl  = commInqNProcsColl ();
   int rankGlob    = commInqRankGlob ();
-  int rankModel   = commInqRankModel ();
   int root = commInqRootGlob ();
+  struct collDesc *collIndex;
 
   xdebug("%s", "START");
   xassert(txWin != NULL);
 
   nstreams = reshCountType ( &streamOps );
   streamIndexList = xmalloc ( nstreams * sizeof ( streamIndexList[0] ));
+  collIndex = xcalloc(nProcsColl, sizeof (collIndex[0]));
   reshGetResHListOfType ( nstreams, streamIndexList, &streamOps );
   for ( streamNo = 0; streamNo < nstreams; streamNo++ )
     {
-      // space required for data
-      vlistID = streamInqVlist ( streamIndexList[streamNo] );
+      // memory required for data
+      int streamID = streamIndexList[streamNo];
+      int vlistID = streamInqVlist(streamID);
       nvars = vlistNvars ( vlistID );
       for ( varID = 0; varID < nvars; varID++ )
         {
-          collID = CDI_UNDEFID;
-          collID = commRankGlob2CollID ( vlistInqVarIOrank ( vlistID, varID ));
-          collIDchunk = vlistInqVarDecoChunk ( vlistID, varID, rankModel );
+          int collID = commRankGlob2CollID(vlistInqVarIOrank(vlistID, varID));
+          int collIDchunk;
+          {
+            int varSize = vlistInqVarSize(vlistID, varID);
+            int nProcsModel = commInqNProcsModel();
+            collIDchunk = (int)ceilf(cdiPIOpartInflate_
+                                     * (varSize + nProcsModel - 1)/nProcsModel);
+          }
           xassert ( collID != CDI_UNDEFID && collIDchunk > 0 );
-          txWin[collID].size += collIDchunk * sizeof (double) +
-            winBufferOverheadChunk * sizeof (int);
+          collIndex[collID].numDataRecords += 2;
+          txWin[collID].size += (size_t)collIDchunk * sizeof (double)
+            /* re-align chunks to multiple of double size */
+            + sizeof (double) - 1
+            /* one header for data record, one for corresponding part
+             * descriptor*/
+            + 2 * sizeof (union winHeaderEntry)
+            /* FIXME: heuristic for size of packed Xt_idxlist */
+            + sizeof (Xt_int) * collIDchunk * 3;
         }
 
-      // space required for the 3 function calls streamOpen, streamDefVlist, streamClose
+      // memory required for the function calls encoded
+      // for remote execution
       // once per stream and timestep for all collprocs only on the modelproc root
       if ( rankGlob == root )
         for ( collID = 0; collID < nProcsColl; collID++ )
-          txWin[collID].size += 3 * winBufferOverheadFuncCall * sizeof (int)
-            + 5 * sizeof (int) + MAXDATAFILENAME;
+          {
+            collIndex[collID].numRPCRecords += numRPCFuncs;
+            txWin[collID].size +=
+              numRPCFuncs * sizeof (union winHeaderEntry)
+              + MAXDATAFILENAME
+              /* data part of streamDefTimestep */
+              + (2 * CDI_MAX_NAME + sizeof (taxis_t));
+          }
     }
-  free ( streamIndexList );
-
-  for ( collID = 0; collID < nProcsColl; collID++ )
+  for (collID = 0; collID < nProcsColl; ++collID)
     {
-      txWin[collID].size += winBufferOverhead * sizeof (int);
+      int numRecords = 1 + collIndex[collID].numDataRecords
+        + collIndex[collID].numRPCRecords;
+      txWin[collID].dictSize = numRecords;
+      txWin[collID].dictDataUsed = 1;
+      txWin[collID].dictRPCUsed = 0;
+      /* account for size header */
+      txWin[collID].size += sizeof (union winHeaderEntry);
+      txWin[collID].size = roundUpToMultiple(txWin[collID].size,
+                                             PIO_WIN_ALIGN);
       sumWinBufferSize += txWin[collID].size;
     }
+  free(collIndex);
+  free ( streamIndexList );
+
   xdebug("sumWinBufferSize=%zu, MAXWINBUFFERSIZE=%zu", (size_t)sumWinBufferSize,
          (size_t)MAXWINBUFFERSIZE);
   xassert ( sumWinBufferSize <= MAXWINBUFFERSIZE );
-  /* xprintArray("txWin.size", txWin, nProcsColl, DATATYPE_INT); */
   xdebug("%s", "RETURN");
 }
 
@@ -412,8 +429,11 @@ static
             txWin[collID].size >= 0         &&
             txWin[collID].size <= MAXWINBUFFERSIZE);
   memset(txWin[collID].buffer, 0, txWin[collID].size);
-  txWin[collID].head = txWin[collID].buffer;
+  txWin[collID].head = txWin[collID].buffer
+    + txWin[collID].dictSize * sizeof (union winHeaderEntry);
   txWin[collID].refuseFuncCall = 0;
+  txWin[collID].dictDataUsed = 1;
+  txWin[collID].dictRPCUsed = 0;
 }
 
 
@@ -439,7 +459,8 @@ void modelWinCreate ( void )
       xmpi(MPI_Alloc_mem((MPI_Aint)txWin[collID].size, MPI_INFO_NULL,
                          &txWin[collID].buffer));
       xassert ( txWin[collID].buffer != NULL );
-      txWin[collID].head = txWin[collID].buffer;
+      txWin[collID].head = txWin[collID].buffer
+        + txWin[collID].dictSize * sizeof (union winHeaderEntry);
       xmpi(MPI_Win_create(txWin[collID].buffer, (MPI_Aint)txWin[collID].size, 1,
                           MPI_INFO_NULL, commInqCommsIO(collID),
                           &txWin[collID].win));
@@ -453,41 +474,88 @@ void modelWinCreate ( void )
 /************************************************************************/
 
 static void
-modelWinBufferPutAtEnd(const char * caller,
-                       int collID, const void * argBuffer, size_t size)
+modelWinEnqueue(int collID,
+                union winHeaderEntry header, const void *data, size_t size)
 {
-  /*
-    xdebug ( "collID=%d, size=%d, newBufferHead=%d, oldBufferSize=%d",
-    collID, size, txWin[collID].head - txWin[collID].buffer + size,
-    txWin[collID].size );
-  */
-  if ( txWin == NULL ||
-       argBuffer     == NULL ||
-       size           < 0    ||
-       collID         < 0    ||
-       collID        >= commInqNProcsColl () ||
-       txWin[collID].head - txWin[collID].buffer + size > txWin[collID].size)
-    xabort("caller: %s", caller);
-
-  memcpy ( txWin[collID].head, argBuffer, size );
-  txWin[collID].head += size;
+  union winHeaderEntry *winDict
+    = (union winHeaderEntry *)txWin[collID].buffer;
+  int targetEntry;
+  if (header.dataRecord.streamID > 0)
+    {
+      targetEntry = (txWin[collID].dictDataUsed)++;
+      int offset = header.dataRecord.offset
+        = (int)roundUpToMultiple(txWin[collID].head - txWin[collID].buffer,
+                                 sizeof (double));
+      memcpy(txWin[collID].buffer + offset, data, size);
+      txWin[collID].head = txWin[collID].buffer + offset + size;
+    }
+  else if (header.partDesc.partDescMarker == PARTDESCMARKER)
+    {
+      targetEntry = (txWin[collID].dictDataUsed)++;
+      Xt_uid uid = header.partDesc.uid;
+      int offset = -1;
+      /* search if same uid entry has already been enqueued */
+      for (int entry = 2; entry < targetEntry; entry += 2)
+        {
+          xassert(winDict[entry].partDesc.partDescMarker
+                  == PARTDESCMARKER);
+          if (winDict[entry].partDesc.uid == uid)
+            {
+              offset = winDict[entry].partDesc.offset;
+              break;
+            }
+        }
+      if (offset == -1)
+        {
+          /* not yet used partition descriptor, serialize at
+           * current position */
+          int position = 0;
+          MPI_Comm comm = commInqCommsIO(collID);
+          header.partDesc.offset
+            = (int)(txWin[collID].head - txWin[collID].buffer);
+          size_t size = xt_idxlist_get_pack_size((Xt_idxlist)data, comm);
+          size_t remaining_size = txWin[collID].size
+            - (txWin[collID].head - txWin[collID].buffer);
+          xassert(size <= remaining_size);
+          xt_idxlist_pack((Xt_idxlist)data, txWin[collID].head,
+                          (int)remaining_size, &position, comm);
+          txWin[collID].head += position;
+        }
+      else
+        /* duplicate entries are copied only once per timestep */
+        header.partDesc.offset = offset;
+    }
+  else
+    {
+      targetEntry = txWin[collID].dictSize - ++(txWin[collID].dictRPCUsed);
+      if (header.funcCall.funcID == STREAMOPEN)
+        {
+          header.funcCall.funcArgs.newFile.offset
+            = (int)(txWin[collID].head - txWin[collID].buffer);
+          memcpy(txWin[collID].head, data, size);
+          txWin[collID].head += size;
+        }
+      else if (header.funcCall.funcID == STREAMDEFTIMESTEP)
+        {
+          header.funcCall.funcArgs.streamNewTimestep.offset
+            = (int)(txWin[collID].head - txWin[collID].buffer);
+          memcpy(txWin[collID].head, data, size);
+          txWin[collID].head += size;
+        }
+    }
+  winDict[targetEntry] = header;
 }
 
-/************************************************************************/
-
-void pioBufferData ( const int streamID, const int varID, const double *data, int nmiss )
+void
+pioBufferPartData(int streamID, int varID, const double *data,
+                  int nmiss, Xt_idxlist partDesc)
 {
-  int chunk, vlistID, collID = CDI_UNDEFID;
-  int tokenSep = SEPARATOR, tokenData = DATATOKEN;
-  size_t size;
-  int rankModel = commInqRankModel ();
+  int vlistID, collID = CDI_UNDEFID;
 
   vlistID  = streamInqVlist ( streamID );
   collID   = commRankGlob2CollID ( vlistInqVarIOrank ( vlistID, varID ));
-  chunk    = vlistInqVarDecoChunk ( vlistID, varID, rankModel );
   xassert ( collID         >= 0                    &&
             collID         <  commInqNProcsColl () &&
-            chunk          >= 0                    &&
             txWin != NULL);
 
   if (txWin[collID].postSet)
@@ -497,166 +565,54 @@ void pioBufferData ( const int streamID, const int varID, const double *data, in
       modelWinFlushBuffer ( collID );
     }
 
-  size = chunk * sizeof ( double ) + winBufferOverheadChunk * sizeof ( int );
-  xassert(txWin[collID].head - txWin[collID].buffer + size < txWin[collID].size);
+  Xt_int chunk = xt_idxlist_get_num_indices(partDesc);
+  xassert(chunk <= INT_MAX);
 
-  modelWinBufferPutAtEnd ( __func__, collID, &tokenData, sizeof ( tokenData ));
-  modelWinBufferPutAtEnd ( __func__, collID, &streamID , sizeof ( streamID ));
-  modelWinBufferPutAtEnd ( __func__, collID, &varID    , sizeof ( varID ));
-  modelWinBufferPutAtEnd ( __func__, collID, data      , chunk * sizeof ( double ));
-  modelWinBufferPutAtEnd ( __func__, collID, &nmiss    , sizeof ( nmiss ));
-  modelWinBufferPutAtEnd ( __func__, collID, &tokenSep , sizeof ( tokenSep ));
+  union winHeaderEntry dataHeader
+    = { .dataRecord = { streamID, varID, -1, nmiss } };
+  modelWinEnqueue(collID, dataHeader, data, chunk * sizeof (data[0]));
+  {
+    union winHeaderEntry partHeader
+      = { .partDesc = { .partDescMarker = PARTDESCMARKER,
+                        .uid = xt_idxlist_get_uid(partDesc),
+                        .offset = 0 } };
+    modelWinEnqueue(collID, partHeader, partDesc, 0);
+  }
 
   txWin[collID].refuseFuncCall = 1;
 }
 
 /************************************************************************/
 
-void pioBufferFuncCall(int funcID, int argc, ... )
+void pioBufferFuncCall(union winHeaderEntry header,
+                       const void *data, size_t data_len)
 {
-  va_list ap;
   int rankGlob = commInqRankGlob ();
   int root = commInqRootGlob ();
   int collID, nProcsColl = commInqNProcsColl ();
-  int tokenSep = SEPARATOR, tokenFuncCall = FUNCCALL;
-  size_t size = 0;
+  int funcID = header.funcCall.funcID;
 
-  xassert(funcID >= 0 && funcID < nFuncs);
-  xdebug("%s, func: %s", "START", funcMap[funcID]);
+  xassert(funcID >= MINFUNCID && funcID <= MAXFUNCID);
+  xdebug("%s, func: %s", "START", funcMap[(-1 - funcID)]);
 
   if ( rankGlob != root ) return;
 
-  xassert (argc          >= 1                    &&
-           argc          <= 2                    &&
-           txWin != NULL);
-
-  va_start ( ap, argc );
+  xassert(txWin != NULL);
 
-  switch ( funcID )
+  for (collID = 0; collID < nProcsColl; ++collID)
     {
-    case STREAMCLOSE:
-      {
-        int streamID;
-
-        xassert ( argc == 1 );
-        streamID  = va_arg ( ap, int );
-
-        for ( collID = 0; collID < nProcsColl; collID++ )
-          {
-            size = ( winBufferOverheadFuncCall + 1 ) * sizeof ( int );
-            xassert(txWin[collID].head - txWin[collID].buffer + size <
-                    txWin[collID].size);
-
-            if (txWin[collID].postSet)
-              {
-                xmpi(MPI_Win_wait(txWin[collID].win));
-                txWin[collID].postSet = 0;
-                modelWinFlushBuffer ( collID );
-              }
-
-            xassert(txWin[collID].refuseFuncCall == 0);
-
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenFuncCall,
-                                     sizeof ( tokenFuncCall));
-            modelWinBufferPutAtEnd ( __func__, collID, &funcID,
-                                     sizeof ( funcID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &streamID,
-                                     sizeof ( streamID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenSep,
-                                     sizeof ( tokenSep ));
-          }
-      xdebug ( "WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, streamID=%d",
-               funcMap[funcID], streamID );
-      }
-      break;
-    case STREAMOPEN:
-      {
-        char * filename;
-        int    filetype;
-        size_t filenamesz;
-
-        xassert ( argc == 2 );
-        filename  = va_arg ( ap, char * );
-        filenamesz = strlen ( filename );
-        xassert ( filenamesz > 0 &&
-                  filenamesz < MAXDATAFILENAME );
-        filetype  = va_arg ( ap, int );
-
-        for ( collID = 0; collID < nProcsColl; collID++ )
-          {
-            size = ( winBufferOverheadFuncCall + 2 ) * sizeof ( int ) +
-              MAXDATAFILENAME;
-            xassert(txWin[collID].head - txWin[collID].buffer + size <
-                    txWin[collID].size);
-
-            if (txWin[collID].postSet)
-              {
-                xmpi(MPI_Win_wait(txWin[collID].win));
-                txWin[collID].postSet = 0;
-                modelWinFlushBuffer ( collID );
-              }
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenFuncCall,
-                                     sizeof ( tokenFuncCall));
-            modelWinBufferPutAtEnd ( __func__, collID, &funcID,
-                                     sizeof ( funcID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &filenamesz,
-                                     sizeof ( filenamesz ));
-            modelWinBufferPutAtEnd ( __func__, collID, filename,
-                                     filenamesz );
-            modelWinBufferPutAtEnd ( __func__, collID, &filetype,
-                                     sizeof ( filetype ));
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenSep,
-                                     sizeof ( tokenSep ));
-          }
-
-        xdebug("WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, filenamesz=%zu,"
-               " filename=%s, filetype=%d",
-               funcMap[funcID], filenamesz, filename, filetype );
-      }
-      break;
-    case STREAMDEFVLIST:
-      {
-        int streamID, vlistID;
-
-        xassert ( argc == 2 );
-        streamID  = va_arg ( ap, int );
-        vlistID   = va_arg ( ap, int );
-
-        for ( collID = 0; collID < nProcsColl; collID++ )
-          {
-            size = ( winBufferOverheadFuncCall + 2 ) * sizeof ( int );
-            xassert(txWin[collID].head - txWin[collID].buffer + size <
-                    txWin[collID].size);
-
-            if (txWin[collID].postSet)
-              {
-                xmpi(MPI_Win_wait(txWin[collID].win));
-                txWin[collID].postSet = 0;
-                modelWinFlushBuffer ( collID );
-              }
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenFuncCall,
-                                     sizeof ( tokenFuncCall));
-            modelWinBufferPutAtEnd ( __func__, collID, &funcID,
-                                     sizeof ( funcID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &streamID,
-                                     sizeof ( streamID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &vlistID,
-                                     sizeof ( streamID ));
-            modelWinBufferPutAtEnd ( __func__, collID, &tokenSep,
-                                     sizeof ( tokenSep ));
-          }
-
-        xdebug ( "WROTE FUNCTION CALL IN BUFFER OF WINS:  %s, streamID=%d,"
-                 " vlistID=%d",
-                 funcMap[funcID], streamID, vlistID );
-      }
-      break;
-    default:
-      xabort ( "FUNCTION NOT MAPPED!" );
+      if (txWin[collID].postSet)
+        {
+          xmpi(MPI_Win_wait(txWin[collID].win));
+          txWin[collID].postSet = 0;
+          modelWinFlushBuffer ( collID );
+        }
+      xassert(txWin[collID].dictRPCUsed + txWin[collID].dictDataUsed
+              < txWin[collID].dictSize);
+      xassert(txWin[collID].refuseFuncCall == 0);
+      modelWinEnqueue(collID, header, data, data_len);
     }
 
-  va_end ( ap );
-
   xdebug("%s", "RETURN");
 }
 
@@ -664,30 +620,10 @@ void pioBufferFuncCall(int funcID, int argc, ... )
 
 /*****************************************************************************/
 
-int pioInqVarDecoChunk ( int vlistID, int varID )
-{
-#ifdef USE_MPI
-   int rankModel = commInqRankModel ();
-   xassert ( rankModel != CDI_UNDEFID );
-   return vlistInqVarDecoChunk ( vlistID, varID, rankModel );
-#endif
-   return vlistInqVarDecoChunk ( vlistID, varID, CDI_UNDEFID );
-}
-
-/*****************************************************************************/
-
-int pioInqVarDecoOff ( int vlistID, int varID )
-{
-#ifdef USE_MPI
-   int rankModel = commInqRankModel ();
-   xassert ( rankModel != CDI_UNDEFID );
-   return vlistInqVarDecoOff ( vlistID, varID, rankModel );
-#else
-   return vlistInqVarDecoOff ( vlistID, varID, CDI_UNDEFID );
+/* pioInit definition must currently compile even in non-MPI configurations */
+#ifndef MPI_VERSION
+#  define MPI_Comm int
 #endif
-}
-
-/*****************************************************************************/
 /**
    @brief initializes the MPI_Communicators needed for the
   communication between the calculator PEs and the I/O PEs and within the
@@ -705,13 +641,22 @@ int pioInqVarDecoOff ( int vlistID, int varID )
 
   @param comm MPI_Communicator of all calling PEs
   @param nIOP number of I/O PEs
+  @param partInflate allow for array partitions on comute
+  PE that are at most sized \f$ partInflate * \lceil arraySize /
+  numComputePEs \rceil \f$
   @return int indicating wether the calling PE is a calcutator (1) or not (0)
 */
 
 #ifdef USE_MPI
-MPI_Comm pioInit_c ( MPI_Comm commGlob, int nProcsIO, int IOMode,
-                     int nNamespaces, int * hasLocalFile )
+static int pioNamespace_ = -1;
+static int xtInitByCDI = 0;
+#endif
+
+MPI_Comm
+pioInit(MPI_Comm commGlob, int nProcsIO, int IOMode,
+        int *pioNamespace, float partInflate)
 {
+#ifdef USE_MPI
   int sizeGlob;
 
   if ( IOMode < PIO_MINIOMODE || IOMode > PIO_MAXIOMODE )
@@ -722,73 +667,61 @@ MPI_Comm pioInit_c ( MPI_Comm commGlob, int nProcsIO, int IOMode,
     xabort ( "PIO_ASYNCH DOES NOT WORK ON SX." );
 #endif
 
+  if ((xtInitByCDI = (!xt_initialized() || xt_finalized())))
+    {
+      xt_initialize(commGlob);
+    }
   commInit ();
   commDefCommGlob ( commGlob );
   sizeGlob = commInqSizeGlob ();
 
-  if ( nProcsIO <= 0 || nProcsIO > sizeGlob - 1 )
-    xabort ( "DISTRIBUTION OF TASKS ON PROCS IS NOT VALID." );
+  if (((IOMode != PIO_NONE && (nProcsIO <= 0 || nProcsIO > sizeGlob - 1)))
+      || (IOMode == PIO_NONE && nProcsIO != 1))
+    xabort("DISTRIBUTION OF TASKS ON PROCS IS NOT VALID.\n"
+           "nProcsIO=%d, sizeGlob=%d\n", nProcsIO, sizeGlob);
 
   commDefNProcsIO ( nProcsIO );
   commDefIOMode   ( IOMode, PIO_MAXIOMODE, PIO_MINIOMODEWITHSPECIALPROCS );
   commDefCommPio  ();
 
+  xassert(partInflate >= 1.0);
+  cdiPIOpartInflate_ = partInflate;
+
   // JUST FOR TEST CASES WITH ONLY ONE MPI TASK
   if ( commInqSizeGlob () == 1 )
     {
-      namespaceInit ( nNamespaces, hasLocalFile );
+      pioNamespace_ = *pioNamespace = namespaceNew();
       return commInqCommGlob ();
     }
 
   if ( commInqIsProcIO ())
     {
+      serializeSetMPI();
+      namespaceSwitchSet(NSSWITCH_ABORT, NSSW_FUNC(cdiAbortC_MPI));
+      namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(pioFileOpen));
+      namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(pioFileClose));
       IOServer ();
+      namespaceDelete(0);
       commDestroy ();
+      xt_finalize();
       MPI_Finalize ();
       exit ( EXIT_SUCCESS );
     }
   else
-    {
-      commEvalPhysNodes ();
-      commDefCommsIO ();
-      namespaceInit ( nNamespaces, hasLocalFile );
-    }
+    cdiPioClientSetup(&pioNamespace_, pioNamespace);
 
   xdebug ( "nProcsGlob=%d, RETURN", sizeGlob );
   return commInqCommModel ();
-}
-#endif
-
-/*****************************************************************************/
-
-int pioInit ( int commGlobArg, int nProcsIO, int IOMode, int nNamespaces,
-              int * hasLocalFile )
-{
-#ifdef USE_MPI
-  xdebug("START: %s, nProcsIO=%d, IOMode=%d, nNamespaces=%d",
-         "cdi parallel",
-         nProcsIO, IOMode, nNamespaces );
 #else
-  xdebug("START: %s, nProcsIO=%d, IOMode=%d, nNamespaces=%d",
-         "cdi serial",
-         nProcsIO, IOMode, nNamespaces );
+  abort();
 #endif
+}
 
-#ifdef USE_MPI
-  MPI_Comm commGlob;
-
-  commGlob = MPI_COMM_NULL;
-  commGlob = MPI_Comm_f2c (( MPI_Fint ) commGlobArg );
-  xassert ( commGlob != MPI_COMM_NULL );
-
-  return MPI_Comm_c2f ( pioInit_c ( commGlob, nProcsIO, IOMode, nNamespaces,
-                                    hasLocalFile ));
+#ifndef MPI_VERSION
+#  undef MPI_Comm
 #endif
-  xdebug("%s", "RETURN" );
-  return 0;
-}
 
-/************************************************************************/
+/*****************************************************************************/
 
 void  pioEndDef ( void )
 {
@@ -801,11 +734,10 @@ void  pioEndDef ( void )
 
   varsMapNDeco ( commInqNNodes (), commInqNodeSizes ());
 
-  reshListPrint ( "reshListModel" );
-  
   if ( rankGlob < commInqNProcsColl ())
     {
-      reshPackBufferCreate ( &buffer, &bufferSize, commInqCommsIO ( rankGlob ));
+      MPI_Comm comm = commInqCommsIO ( rankGlob );
+      reshPackBufferCreate(&buffer, &bufferSize, &comm);
 
       xmpi ( MPI_Send ( buffer, bufferSize, MPI_PACKED, commInqNProcsModel (),
                         RESOURCES, commInqCommsIO ( rankGlob )));
@@ -850,7 +782,7 @@ void pioFinalize ( void )
 #ifdef USE_MPI
   int collID, ibuffer = 1111;
   xdebug("%s", "START");
-  namespaceCleanup ();
+  namespaceDelete(pioNamespace_);
   for ( collID = 0; collID < commInqNProcsColl (); collID++ )
     {
       xmpi ( MPI_Send ( &ibuffer, 1, MPI_INT, commInqNProcsModel (),
@@ -859,36 +791,31 @@ void pioFinalize ( void )
     }
   modelWinCleanup ();
   commDestroy ();
+  if (xtInitByCDI)
+    xt_finalize();
   xdebug("%s", "RETURN");
 #endif
 }
 
  /************************************************************************/
 
-void pioWriteTimestep ( int tsID, int vdate, int vtime )
+void pioWriteTimestep()
 {
 #ifdef USE_MPI
-  int collID, buffer[timestepSize], iAssert = 0;
-  int tokenEnd = END;
+  int collID, iAssert = 0;
+  /* int tokenEnd = END; */
   int rankGlob = commInqRankGlob ();
   int nProcsColl = commInqNProcsColl ();
   int nProcsModel = commInqNProcsModel ();
 
   xdebug("%s", "START");
 
-  xassert ( tsID       >= 0     &&
-            vdate      >= 0     &&
-            vtime      >= 0     &&
-            txWin != NULL);
-
-  buffer[0] = tsID;
-  buffer[1] = vdate;
-  buffer[2] = vtime;
+  xassert(txWin != NULL);
 
   if ( rankGlob < nProcsColl )
     {
-      xmpi ( MPI_Send ( &buffer[0], timestepSize, MPI_INTEGER, nProcsModel,
-                        WRITETS, commInqCommsIO ( rankGlob )));
+      xmpi(MPI_Send(NULL, 0, MPI_INT, nProcsModel,
+                    WRITETS, commInqCommsIO(rankGlob)));
       xdebug("%s", "SENT MESSAGE WITH TAG \"WRITETS\"");
     }
 
@@ -900,17 +827,45 @@ void pioWriteTimestep ( int tsID, int vdate, int vtime )
           txWin[collID].postSet = 0;
           modelWinFlushBuffer ( collID );
         }
-      modelWinBufferPutAtEnd ( __func__, collID, &tokenEnd, 
-                               sizeof ( tokenEnd ));
+      union winHeaderEntry header
+        = { .headerSize = { .sizeID = HEADERSIZEMARKER,
+                            .numDataEntries = txWin[collID].dictDataUsed,
+                            .numRPCEntries = txWin[collID].dictRPCUsed } };
+      union winHeaderEntry *winDict
+        = (union winHeaderEntry *)txWin[collID].buffer;
+      winDict[0] = header;
+
       xmpi(MPI_Win_post(txWin[collID].ioGroup, iAssert, txWin[collID].win));
       txWin[collID].postSet = 1;
     }
 
-  xdebug ( "RETURN. messages sent, windows posted: tsID=%d, vdate=%d, vtime=%d", 
-           tsID, vdate, vtime );
+  xdebug("%s", "RETURN. messages sent, windows posted");
 
 #endif
 }
+
+#if defined USE_MPI
+void
+streamWriteVarPart(int streamID, int varID, const void *data,
+                   int nmiss, Xt_idxlist partDesc)
+{
+  if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
+
+  check_parg(data);
+
+  void (*myStreamWriteVarPart)(int streamID, int varID, const void *data,
+                               int nmiss, Xt_idxlist partDesc)
+    = (void (*)(int, int, const void *, int, Xt_idxlist))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_PART_).func;
+
+  if (!myStreamWriteVarPart)
+    xabort("local part writing is unsupported!");
+
+  myStreamWriteVarPart(streamID, varID, data, nmiss, partDesc);
+}
+#endif
+
+
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/pio_interface.h b/libcdi/src/pio_interface.h
index 1319d8f..7d128b9 100644
--- a/libcdi/src/pio_interface.h
+++ b/libcdi/src/pio_interface.h
@@ -8,9 +8,18 @@
 #ifdef USE_MPI
 
 #include <mpi.h>
+#include <yaxt.h>
 
-void pioBufferData ( int, int, const double *, int );
-void pioBufferFuncCall(int, int, ... );
+#include "pio_rpc.h"
+
+void
+pioBufferPartData(int streamID, int varID, const double *data,
+                  int nmiss, Xt_idxlist partDesc);
+void pioBufferData (int, int, const double *, int );
+void pioBufferFuncCall(union winHeaderEntry header,
+                       const void *data, size_t data_len);
+
+extern float cdiPIOpartInflate_;
 
 #endif
 
diff --git a/libcdi/src/pio_list_set.c b/libcdi/src/pio_list_set.c
index c0344b8..3b821ae 100644
--- a/libcdi/src/pio_list_set.c
+++ b/libcdi/src/pio_list_set.c
@@ -95,9 +95,8 @@ listSetAdd(listSet *q, void *v)
     q->head = newCons;
 
   q->tail = newCons;
-  q->count  ++;
 
-  return 0;
+  return q->count++;
 }
 
 int
diff --git a/libcdi/src/pio_mpinonb.c b/libcdi/src/pio_mpinonb.c
index f2a8f80..0b01618 100644
--- a/libcdi/src/pio_mpinonb.c
+++ b/libcdi/src/pio_mpinonb.c
@@ -93,8 +93,8 @@ int destroyAFiledataMPINONB ( void *v )
 
   of = (aFiledataM * ) v;
 
-  xdebug ( "IOPE%d: name=%s, close file, in", 
-           rankNode, of->name );
+  xdebug ( "IOPE%d: close file %d, name=\"%s\"",
+           rankNode, of->fileID, of->name );
   
   /* close file */
 
@@ -304,7 +304,7 @@ int fowMPINONB ( const char *filename )
 
   xdebug("IOPE%d: name=%s, init and added aFiledataM, return id = %d",
          rankNode, filename, id);
-  
+  of->fileID = id;
   return id;
 }
 
diff --git a/libcdi/src/pio_posixasynch.c b/libcdi/src/pio_posixasynch.c
index 6fe3dad..b5ac645 100644
--- a/libcdi/src/pio_posixasynch.c
+++ b/libcdi/src/pio_posixasynch.c
@@ -304,6 +304,7 @@ void pioWriterAIO(void)
 	      bfd = initBFiledataPA(filename, buffersize, nProcsCollNode);
               if ((id = listSetAdd(bibBFiledataPA, bfd)) < 0)
                 xabort("fileID=%d not unique", rtag.id);
+              bfd->fileID = id;
 	    }
 	  else
 	    if (strcmp(filename, bfd->name) != 0)
diff --git a/libcdi/src/pio_posixfpguardsendrecv.c b/libcdi/src/pio_posixfpguardsendrecv.c
index 9b067e8..024fd08 100644
--- a/libcdi/src/pio_posixfpguardsendrecv.c
+++ b/libcdi/src/pio_posixfpguardsendrecv.c
@@ -47,8 +47,8 @@ typedef struct
 {
   long offset;
   bool finished;
-  bool *nfinished;
   int fileID;
+  bool nfinished[];
 } bFiledataPF;
 
 static int
@@ -97,25 +97,19 @@ static aFiledataPF *initAFiledataPF ( const char *key, size_t bs)
     xabort("Failed to open %s", afd->name);
 
   afd->command = IO_Open_file;
-  
   return afd;
 }
 
 /***************************************************************/
 static bFiledataPF *
-initBFiledataPF(int key, int nc)
+initBFiledataPF(int fileID, int nc)
 {
   bFiledataPF *bfd;
-  int i;
-
-  bfd = ( bFiledataPF * ) xmalloc ( sizeof ( bFiledataPF ));
-  memset ( bfd, 0, sizeof ( bFiledataPF ));
+  size_t bfdSize = sizeof (bFiledataPF) + nc * sizeof (bool);
+  bfd = xcalloc(1, bfdSize);
   bfd->offset = 0;
   bfd->finished = false;
-  bfd->nfinished = ( bool * ) xmalloc ( nc * sizeof ( bool ));
-
-  for ( i = 0; i < nc; i++ )
-    *( bfd->nfinished + i ) = true;
+  bfd->fileID = fileID;
 
   return bfd;
 }
@@ -151,7 +145,6 @@ destroyBFiledataPF(void *v)
   int iret = 0;
   bFiledataPF *bfd = (bFiledataPF * ) v;
   
-  free ( bfd->nfinished );
   free ( bfd );
 
   return iret;
@@ -200,16 +193,15 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
       	case IO_Open_file:
 
           if (!(bfd = listSetGet(bibBFiledataPF, fileIDTestB,
-                               (void *)(intptr_t)rtag.id)))
+                                 (void *)(intptr_t)rtag.id)))
 	    {
 	      bfd = initBFiledataPF(rtag.id, nProcsCollNode);
 
 	      if ((iret = listSetAdd(bibBFiledataPF, bfd)) < 0)
 		xabort("fileID=%d not unique", rtag.id);
+              bfd->fileID = iret;
 	    }
 
-	  *( bfd->nfinished + source ) = false;
-
           xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id,
                  rtag.command, command2charP[rtag.command], bfd->offset);
 	  
@@ -228,7 +220,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
 	case IO_Set_fp:
 
           if (!(bfd = listSetGet(bibBFiledataPF, fileIDTestB,
-                               (void *)(intptr_t)rtag.id)))
+                                 (void *)(intptr_t)rtag.id)))
             xabort("fileId=%d not in set", rtag.id);
 
           xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id,
@@ -289,11 +281,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
             sentFinalize[source] = true;
             doFinalize = true;
             for ( collID = 0; collID < nProcsCollNode; collID++ )
-              if ( !sentFinalize[collID] ) 
-                {
-                  doFinalize = false;
-                  break;
-                }
+              doFinalize &= sentFinalize[collID];
             if ( doFinalize )
               {
                 if (!listSetIsEmpty(bibBFiledataPF))
@@ -493,9 +481,20 @@ int fowPOSIXFPGUARDSENDRECV ( const char *filename )
 
   if ((id = listSetAdd(bibAFiledataPF, afd)) < 0)
     xabort("filename %s not unique", afd->name);
-
+  afd->fileID = id;
   xdebug("name=%s, init and add aFiledataPF, return id = %d",
          filename, id);
+  {
+    long offset, amount = 0L;
+    int tag = encodeFileOpTag(afd->fileID, afd->command);
+    int specialRank = commInqSpecialRankNode ();
+    MPI_Status status;
+    MPI_Comm commNode = commInqCommNode ();
+    xmpi(MPI_Sendrecv(&amount, 1, MPI_LONG, specialRank, tag,
+                      &offset, 1, MPI_LONG, specialRank, tag,
+                      commNode, &status));
+  }
+  afd->command = IO_Set_fp;
   return id;
 }
 
diff --git a/libcdi/src/pio_posixnonb.c b/libcdi/src/pio_posixnonb.c
index 33e80f2..216b46f 100644
--- a/libcdi/src/pio_posixnonb.c
+++ b/libcdi/src/pio_posixnonb.c
@@ -194,6 +194,7 @@ pioWriterStdIO(void)
 	      
 	      if ((id = listSetAdd(bibBFiledataP, bfd)) < 0)
                 xabort("fileID=%d not unique", rtag.id);
+              bfd->fileID = id;
 	    }
 	  else
 	    if (strcmp(filename, bfd->name) != 0)
diff --git a/libcdi/src/pio_record_send.c b/libcdi/src/pio_record_send.c
index 8af2815..60a6c13 100644
--- a/libcdi/src/pio_record_send.c
+++ b/libcdi/src/pio_record_send.c
@@ -147,9 +147,8 @@ defTimestep(remoteFileBuf *afd, int tsID)
 }
 
 static void
-flushOp(void *b, void *tsID)
+flushOp(remoteFileBuf *fb, int tsID)
 {
-  remoteFileBuf *fb = b;
   sendP(fb, fb->fileID);
   defTimestep(fb, (int)(intptr_t)tsID);
 }
@@ -165,14 +164,13 @@ pioSendWrite(int id, int tsID, const void *buffer, size_t len)
 
   afd = listSetGet(bibRemoteFileBuf, fileIDTest, (void *)(intptr_t)id);
 
-  flush = ( tsID != afd->tsID ) ? 1 : 0;
+  flush = tsID != afd->tsID;
 
-  if ( flush == 1 )
+  if ( flush )
     {
-      xdebug ( "tsID = %d, flush buffer", tsID );
-
-      listSetForeach(bibRemoteFileBuf, flushOp, (void *)(intptr_t)tsID);
+      xdebug("tsID = %d, flush buffer for fileID=%d", tsID, afd->fileID);
 
+      flushOp(afd, tsID);
       {
         double startTime;
         MPI_Status status;
@@ -248,6 +246,7 @@ pioSendOpen(const char *filename)
   static long buffersize = 0;
   int root = 0, id, iret, messageLength = 32;
   char message[messageLength];
+  MPI_Comm commCollectors = commInqCommColl();
 
   /* broadcast buffersize to collectors */
   if (!buffersize)
@@ -261,13 +260,14 @@ pioSendOpen(const char *filename)
           xdebug("filename=%s, broadcast buffersize=%ld to collectors ...",
                  filename, buffersize);
 	}
-      xmpi(MPI_Bcast(&buffersize, 1, MPI_LONG, root, commInqCommColl()));
+      xmpi(MPI_Bcast(&buffersize, 1, MPI_LONG, root, commCollectors));
     }
 
   /* init and add remoteFileBuf */
   afd = initRemoteFileBuf(filename, buffersize);
   if ((id = listSetAdd(bibRemoteFileBuf, afd)) < 0)
     xabort("filename %s is not unique", afd->name);
+  afd->fileID = id;
 
   xdebug("filename=%s, init and added remoteFileBuf, return id = %d",
          filename, id);
@@ -293,7 +293,8 @@ pioSendOpen(const char *filename)
              filename, temp);
       free(temp);
     }
-
+  sendP(afd, afd->fileID);
+  xmpi(MPI_Barrier(commCollectors));
   return id;
 }
 
diff --git a/libcdi/src/pio_rpc.c b/libcdi/src/pio_rpc.c
deleted file mode 100644
index 1197092..0000000
--- a/libcdi/src/pio_rpc.c
+++ /dev/null
@@ -1,140 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#ifdef USE_MPI
-#include "pio_rpc.h"
-#include "cdi.h"
-#include "pio_comm.h"
-#include "pio_util.h"
-#include "institution.h"
-#include "model.h"
-#include "vlist.h"
-#include "namespace.h"
-
-
-extern void   gridUnpack ( char *, int, int *, int, MPI_Comm );
-extern void  zaxisUnpack ( char *, int, int *, int, MPI_Comm );
-extern void  taxisUnpack ( char *, int, int *, int, MPI_Comm );
-extern double cdiDefaultMissval;  
-extern int streamNint;
-
-
-/*****************************************************************************/
-
-static
-void streamUnpack ( char * unpackBuffer, int unpackBufferSize, 
-		   int * unpackBufferPos, int nspTarget, MPI_Comm comm )
-{
-  int intBuffer[streamNint], streamID;
-  double d;
-  char filename[CDI_MAX_NAME];
-
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      intBuffer, streamNint, MPI_INT, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &d, 1, MPI_DOUBLE, comm ));
-  xassert ( xchecksum ( DATATYPE_INT, streamNint, intBuffer ) == d );
-
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &cdiDefaultMissval, 1, MPI_DOUBLE, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &filename, intBuffer[2], MPI_CHAR, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos, 
-		      &d, 1, MPI_DOUBLE, comm ));
-  xassert ( d == xchecksum ( DATATYPE_TXT, intBuffer[2], filename ));
-  streamID = streamOpenWrite ( filename, intBuffer[1] );
-  xdebug ("streamID=%d, intBuffer[0]=%d, nspTarget=%d,"
-          " namespaceAdaptKey(a,b)=%d",
-          streamID, intBuffer[0], nspTarget,  
-          namespaceAdaptKey ( intBuffer[0], nspTarget ));
-  xassert ( streamID >= 0 &&
-            namespaceAdaptKey ( intBuffer[0], nspTarget ) == streamID );
-  xdebug ("streamID=%d, vlistID=%d", streamID, namespaceAdaptKey ( intBuffer[4], nspTarget ));
-
-  streamDefVlist ( streamID, namespaceAdaptKey ( intBuffer[4], nspTarget ));
-  xassert ( streamInqVlist ( streamID ) == 
-            namespaceAdaptKey ( intBuffer[3], nspTarget ));
-
-  streamDefByteorder ( streamID, intBuffer[5] );
-  streamDefCompType  ( streamID, intBuffer[6] );
-  streamDefCompLevel ( streamID, intBuffer[7] ); 
-  cdiDefGlobal  ( "REGULARGRID", intBuffer[8] );
-  cdiDefGlobal     ( "SORTNAME", intBuffer[9] ); 
-  cdiDefGlobal ( "HAVE_MISSVAL", intBuffer[10] );
-}
-
-
-/*****************************************************************************/
-
-
-void rpcUnpackResources ( char * unpackBuffer, int unpackBufferSize, 
-			  MPI_Comm comm )
-{ 
-  int token1, token2, nspTarget;
-  int unpackBufferPos = 0;
-
-  xdebug("%s", "START");
-	  
-  while ( unpackBufferPos < unpackBufferSize )
-    {
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			  &token1, 1, MPI_INT, comm ));
-      
-      switch ( token1 )
-	{
-	case END:
-	  return;
-	case START:
-	  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			      &nspTarget, 1, MPI_INT, comm ));
-	  break;
-	case GRID:
-	  gridUnpack      ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			    nspTarget, comm );
-	  break;
-	case ZAXIS: 
-	  zaxisUnpack     ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			    nspTarget, comm );
-	  break;
-	case TAXIS:
-	  taxisUnpack     ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			    nspTarget, comm );
-	  break;
-	case INSTITUTE:
-          instituteUnpack ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			    nspTarget, comm);
-	  break;
-	case MODEL:
-          modelUnpack     ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			    nspTarget, comm);
-	  break;
-	case STREAM:
-	  streamUnpack    ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			    nspTarget, comm );
-	  break;
-	case VLIST:
-          vlistUnpack     (unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			   nspTarget, comm);
-	  break;
-	default: 
-	  xabort ( "TOKEN MAPS NO VALID DATATYPE" );
-	}
-
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, &unpackBufferPos, 
-			  &token2, 1, MPI_INT, comm ));
-      xassert ( token2 == SEPARATOR );
-    }
-  xdebug("%s", "RETURN");
-}
-
-#endif
-/*
- * Local Variables:
- * c-file-style: "Java"
- * c-basic-offset: 2
- * indent-tabs-mode: nil
- * show-trailing-whitespace: t
- * require-trailing-newline: t
- * End:
- */
diff --git a/libcdi/src/pio_rpc.h b/libcdi/src/pio_rpc.h
index 1c35843..f02caae 100644
--- a/libcdi/src/pio_rpc.h
+++ b/libcdi/src/pio_rpc.h
@@ -8,45 +8,91 @@
 #ifdef USE_MPI
 
 #include <mpi.h>
+#include <yaxt.h>
 
 typedef enum
   {
     FINALIZE,
     RESOURCES,
     WINCREATE,
-    WRITETS
+    WRITETS,
+    COLLBUFTX,
+    COLLBUFNMISS,
   } command;
 
-enum 
-{ GRID      = 1,
-  ZAXIS     = 2,
-  TAXIS     = 3,
-  INSTITUTE = 4,
-  MODEL     = 5,
-  STREAM    = 6,
-  VLIST     = 7,
-  START     = 55555555,
-  SEPARATOR = 66666666,
-  DATATOKEN = 77777777,
-  FUNCCALL  = 88888888,
-  END       = 99999999 
-};
+#define MAXWINBUFFERSIZE ((size_t)2048 * 1024 * 1024)
 
 enum
 {
-  winBufferOverhead = 1,
-  winBufferOverheadChunk = 5,
-  winBufferOverheadFuncCall = 3,
-  timestepSize = 3
+  numRPCFuncs = 4,
+  STREAMOPEN = -1,
+  STREAMDEFVLIST = -2,
+  STREAMCLOSE = -3,
+  STREAMDEFTIMESTEP = -4,
+  HEADERSIZEMARKER = -numRPCFuncs - 1,
+  PARTDESCMARKER = -numRPCFuncs - 2,
+};
+enum { MAXDATAFILENAME = 256, MINFUNCID = -numRPCFuncs, MAXFUNCID = -1 };
+extern const char * const funcMap[numRPCFuncs];
+
+struct headerSize
+{
+  int sizeID, numDataEntries, numRPCEntries;
+};
+
+struct dataRecord
+{
+  int streamID, varID, offset, nmiss;
+};
+
+struct funcCallDesc
+{
+  int funcID;
+  union
+  {
+    struct
+    {
+      int streamID, vlistID;
+    } streamChange;
+    struct
+    {
+      int streamID, tsID, offset;
+    } streamNewTimestep;
+    struct
+    {
+      int fnamelen, offset, filetype;
+    } newFile;
+  } funcArgs;
 };
 
-#define MAXWINBUFFERSIZE ((size_t)512 * 1024 * 1024)
+/* Describes offset and ID of serialized partition descriptor.
+ * partDescMarker == PARTDESCMARKER, always. */
+struct partDescRecord
+{
+  int partDescMarker, offset;
+  Xt_uid uid;
+};
+
+union winHeaderEntry
+{
+  struct headerSize headerSize;
+  struct dataRecord dataRecord;
+  struct funcCallDesc funcCall;
+  struct partDescRecord partDesc;
+};
 
-enum { nFuncs = 3, STREAMOPEN = 0, STREAMDEFVLIST = 1, STREAMCLOSE = 2 };
-enum { MAXDATAFILENAME = 256, MINFUNCID = STREAMOPEN, MAXFUNCID = STREAMCLOSE };
-extern char * funcMap[nFuncs];
+/* round size to next multiple of factor */
+static inline size_t
+roundUpToMultiple(size_t size, size_t factor)
+{
+  return (size + factor - 1)/factor * factor;
+}
 
-void rpcUnpackResources ( char *, int, MPI_Comm );
+enum
+{
+  /* align window base addresses and sizes to this value */
+  PIO_WIN_ALIGN = sizeof (double),
+};
 
 #endif
 
diff --git a/libcdi/src/pio_serialize.c b/libcdi/src/pio_serialize.c
new file mode 100644
index 0000000..8296d7b
--- /dev/null
+++ b/libcdi/src/pio_serialize.c
@@ -0,0 +1,115 @@
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifdef USE_MPI
+
+#include <mpi.h>
+
+#include "cdi.h"
+#include "namespace.h"
+#include "pio_serialize.h"
+#include "pio_util.h"
+
+static struct
+{
+  int cdidt;
+  MPI_Datatype mpidt;
+} dtDict[]
+  = {
+#if MPI_VERSION == 1 || (MPI_VERSION == 2 && MPI_SUBVERSION < 2)
+#define CDI_DT_MATCH_NEEDED 1
+  { DATATYPE_INT8, MPI_SIGNED_CHAR },
+  { DATATYPE_INT16, MPI_SHORT },
+#else
+  { DATATYPE_INT8, MPI_INT8_T },
+  { DATATYPE_INT16, MPI_INT16_T },
+#endif
+  { DATATYPE_INT, MPI_INT },
+  { DATATYPE_FLT64, MPI_DOUBLE },
+  { DATATYPE_TXT, MPI_CHAR },
+  { DATATYPE_UCHAR, MPI_UNSIGNED_CHAR }
+};
+
+static inline int
+lookupDt(int datatype)
+{
+  for (size_t i = 0; i < sizeof (dtDict) / sizeof (dtDict[0]); ++i)
+    if (dtDict[i].cdidt == datatype)
+      return i;
+  abort();
+}
+
+#if CDI_DT_MATCH_NEEDED
+static int dtDictMatchComplete = 0;
+
+static inline void
+  dtDictFixMPIType(int i, int typeclass, int size)
+{
+  MPI_Aint lb, extent;
+  xmpi(MPI_Type_get_extent(dtDict[i].mpidt, &lb, &extent));
+  if ((int)extent != size)
+    {
+      /* type size mismatch needs to be fixed */
+      MPI_Type_match_size(typeclass, size, &dtDict[i].mpidt);
+    }
+}
+
+static void
+  setupDtDict()
+{
+  dtDictFixMPIType(lookupDt(DATATYPE_INT8), MPI_TYPECLASS_INTEGER,
+                   (int)sizeof (int8_t));
+  dtDictFixMPIType(lookupDt(DATATYPE_INT8), MPI_TYPECLASS_INTEGER,
+                   (int)sizeof (int16_t));
+}
+#endif
+
+int serializeGetSizeMPI(int count, int datatype, void *context)
+{
+  int size;
+  xmpi(MPI_Pack_size(count, dtDict[lookupDt(datatype)].mpidt,
+                     *(MPI_Comm *)context, &size));
+  return size;
+}
+
+
+void serializePackMPI(void *data, int count, int datatype,
+                      void *buf, int buf_size, int *position, void *context)
+{
+  xmpi(MPI_Pack(data, count, dtDict[lookupDt(datatype)].mpidt,
+                buf, buf_size, position, *(MPI_Comm *)context));
+}
+
+void serializeUnpackMPI(void *buf, int buf_size, int *position,
+                        void *data, int count, int datatype, void *context)
+{
+  xmpi(MPI_Unpack(buf, buf_size, position, data, count,
+                  dtDict[lookupDt(datatype)].mpidt, *(MPI_Comm *)context));
+}
+
+void serializeSetMPI()
+{
+#if CDI_DT_MATCH_NEEDED
+  if (!dtDictMatchComplete)
+    setupDtDict();
+#endif
+  namespaceSwitchSet(NSSWITCH_SERIALIZE_GET_SIZE,
+                     NSSW_FUNC(serializeGetSizeMPI));
+  namespaceSwitchSet(NSSWITCH_SERIALIZE_PACK,
+                     NSSW_FUNC(serializePackMPI));
+  namespaceSwitchSet(NSSWITCH_SERIALIZE_UNPACK,
+                     NSSW_FUNC(serializeUnpackMPI));
+}
+
+
+#endif
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
diff --git a/libcdi/src/pio_serialize.h b/libcdi/src/pio_serialize.h
new file mode 100644
index 0000000..97a349b
--- /dev/null
+++ b/libcdi/src/pio_serialize.h
@@ -0,0 +1,14 @@
+#ifndef SERIALIZE_PIO_H
+#define SERIALIZE_PIO_H
+/*
+ * Interfaces for marshalling via MPI
+ */
+int serializeGetSizeMPI(int count, int datatype, void *context);
+void serializePackMPI(void *data, int count, int datatype,
+                          void *buf, int buf_size, int *position, void *context);
+void serializeUnpackMPI(void *buf, int buf_size, int *position,
+                        void *data, int count, int datatype, void *context);
+/* switch current namespace to use MPI serialization */
+void serializeSetMPI();
+
+#endif
diff --git a/libcdi/src/pio_server.c b/libcdi/src/pio_server.c
index fa151c3..0e1e0ac 100644
--- a/libcdi/src/pio_server.c
+++ b/libcdi/src/pio_server.c
@@ -9,59 +9,79 @@
 #include "pio_server.h"
 
 
+#include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "limits.h"
+
+#ifdef HAVE_PARALLEL_NC4
+#include <core/ppm_combinatorics.h>
+#include <core/ppm_rectilinear.h>
+#include <ppm/ppm_uniform_partition.h>
+#endif
+#include <yaxt.h>
+
 #include "cdi.h"
+#include "namespace.h"
+#include "taxis.h"
 #include "pio.h"
 #include "pio_comm.h"
+#include "pio_interface.h"
 #include "pio_rpc.h"
 #include "pio_util.h"
 #include "cdi_int.h"
+#ifndef HAVE_NETCDF_PAR_H
+#define MPI_INCLUDED
+#endif
+#include "pio_cdf_int.h"
 #include "resource_handle.h"
+#include "resource_unpack.h"
+#include "stream_cdf.h"
 #include "vlist_var.h"
 
+
 extern resOps streamOps;
 extern void arrayDestroy ( void );
 
 static struct
 {
   size_t size;
-  unsigned char *buffer, *head;
+  unsigned char *buffer;
+  int dictSize;
 } *rxWin = NULL;
 
 static MPI_Win getWin = MPI_WIN_NULL;
 static MPI_Group groupModel = MPI_GROUP_NULL;
 
+#ifdef HAVE_PARALLEL_NC4
+/* prime factorization of number of pio collectors */
+static uint32_t *pioPrimes;
+static int numPioPrimes;
+#endif
 
 /************************************************************************/
 
 static
 void serverWinCleanup ()
 {
-  int i;
-  int nProcsCalc = commInqNProcsModel ();
-  
-  if ( getWin != MPI_WIN_NULL )
-    xmpi ( MPI_Win_free ( &getWin ));
-  
+  if (getWin != MPI_WIN_NULL)
+    xmpi(MPI_Win_free(&getWin));
   if (rxWin)
     {
-      for ( i = 0; i < nProcsCalc; i++ )
-        free(rxWin[i].buffer);
+      free(rxWin[0].buffer);
       free(rxWin);
     }
 
   xdebug("%s", "cleaned up mpi_win");
 }
- 
+
  /************************************************************************/
 
-static 
-  void collDefBufferSizes ()
+static size_t
+collDefBufferSizes()
 {
   int nstreams, * streamIndexList, streamNo, vlistID, nvars, varID, iorank;
-  int modelID, decoChunk, sumGetBufferSizes = 0;
+  int modelID;
+  size_t sumGetBufferSizes = 0;
   int rankGlob = commInqRankGlob ();
   int nProcsModel = commInqNProcsModel ();
   int root = commInqRootGlob ();
@@ -84,27 +104,49 @@ static
             {
               for ( modelID = 0; modelID < nProcsModel; modelID++ )
                 {
-                  decoChunk =  vlistInqVarDecoChunk ( vlistID, varID, modelID );
+                  int decoChunk;
+                  {
+                    int varSize = vlistInqVarSize(vlistID, varID);
+                    int nProcsModel = commInqNProcsModel();
+                    decoChunk =
+                      (int)ceilf(cdiPIOpartInflate_
+                                 * (varSize + nProcsModel - 1)/nProcsModel);
+                  }
                   xassert ( decoChunk > 0 );
                   rxWin[modelID].size += decoChunk * sizeof (double)
-                    + winBufferOverheadChunk * sizeof (int);
+                    /* re-align chunks to multiple of double size */
+                    + sizeof (double) - 1
+                    /* one header for data record, one for
+                     * corresponding part descriptor*/
+                    + 2 * sizeof (union winHeaderEntry)
+                    /* FIXME: heuristic for size of packed Xt_idxlist */
+                    + sizeof (Xt_int) * decoChunk * 3;
+                  rxWin[modelID].dictSize += 2;
                 }
             }
-    }
+        }
       // space required for the 3 function calls streamOpen, streamDefVlist, streamClose 
       // once per stream and timestep for all collprocs only on the modelproc root
-      rxWin[root].size += 3 * winBufferOverheadFuncCall * sizeof (int)
-        + 5 * sizeof (int) + MAXDATAFILENAME;
+      rxWin[root].size += numRPCFuncs * sizeof (union winHeaderEntry)
+        /* serialized filename */
+        + MAXDATAFILENAME
+        /* data part of streamDefTimestep */
+        + (2 * CDI_MAX_NAME + sizeof (taxis_t));
+      rxWin[root].dictSize += numRPCFuncs;
     }
   free ( streamIndexList );
 
   for ( modelID = 0; modelID < nProcsModel; modelID++ )
     {
-      rxWin[modelID].size += winBufferOverhead * sizeof (int);
-      sumGetBufferSizes += rxWin[modelID].size;
+      /* account for size header */
+      rxWin[modelID].dictSize += 1;
+      rxWin[modelID].size += sizeof (union winHeaderEntry);
+      rxWin[modelID].size = roundUpToMultiple(rxWin[modelID].size,
+                                              PIO_WIN_ALIGN);
+      sumGetBufferSizes += (size_t)rxWin[modelID].size;
     }
   xassert ( sumGetBufferSizes <= MAXWINBUFFERSIZE );
-  /* xprintArray ( "getBufferSize", getBufferSize, nProcsModel, DATATYPE_INT ); */
+  return sumGetBufferSizes;
 }
 
  /************************************************************************/
@@ -125,14 +167,14 @@ static
   xmpi ( MPI_Comm_group ( commCalc, &groupCalc ));
   xmpi ( MPI_Group_excl ( groupCalc, 1, ranks, &groupModel ));
 
-  rxWin = xmalloc(nProcsModel * sizeof (rxWin[0]));
-  collDefBufferSizes ();
-  /* xprintArray ( "getBufferSizes", getBufferSize, nProcsModel, DATATYPE_INT ); */
-
-  for ( modelID = 0; modelID < nProcsModel; modelID++ )
+  rxWin = xcalloc(nProcsModel, sizeof (rxWin[0]));
+  size_t totalBufferSize = collDefBufferSizes();
+  rxWin[0].buffer = xmalloc(totalBufferSize);
+  size_t ofs = 0;
+  for ( modelID = 1; modelID < nProcsModel; modelID++ )
     {
-      rxWin[modelID].buffer = xmalloc(rxWin[modelID].size);
-      rxWin[modelID].head = rxWin[modelID].buffer;
+      ofs += rxWin[modelID - 1].size;
+      rxWin[modelID].buffer = rxWin[0].buffer + ofs;
     }
 
   xdebug("%s", "created mpi_win, allocated getBuffer");
@@ -140,193 +182,620 @@ static
 
 /************************************************************************/
 
-static
-  void getBufferGetFromEnd ( const char * caller, int line,  
-                             int ID, void * argBuffer, size_t size )
+static void
+readFuncCall(struct funcCallDesc *header)
 {
-  if (rxWin == NULL ||
-      argBuffer     == NULL ||
-      size           < 0    ||
-      ID             < 0    ||
-      ID             >= commInqNProcsModel () ||
-      rxWin[ID].head - rxWin[ID].buffer + size > rxWin[ID].size)
-    xabort("caller: %s, line %d, ID = %d, nProcsModel=%d,"
-           " size = %lu, rxWin[%d].head = %ld, rxWin[%d].size = %lu",
-           caller, line, ID, (unsigned long)size, ID,
-           commInqNProcsModel(), rxWin[ID].head - rxWin[ID].buffer,
-           ID, (unsigned long)rxWin[ID].size);
-  memcpy ( argBuffer, rxWin[ID].head, size );
-  rxWin[ID].head += size;
-}
-
-/************************************************************************/
-
-static
-  void readFuncCall ( void )
-{
-  int funcID, tokenID;
   int root = commInqRootGlob ();
+  int funcID = header->funcID;
 
-  getBufferGetFromEnd ( __func__, __LINE__, 
-                        root, &funcID, sizeof ( funcID ));
-  xassert ( funcID >= MINFUNCID && funcID <= MAXFUNCID );
-  
+  xassert(funcID >= MINFUNCID && funcID <= MAXFUNCID);
   switch ( funcID )
     {
     case STREAMCLOSE:
       {
-        int streamID;
-
-        getBufferGetFromEnd ( __func__, __LINE__, 
-                              root, &streamID, sizeof ( streamID ));
-        streamClose ( streamID );
-        xdebug ( "READ FUNCTION CALL FROM WIN:  %s, streamID=%d,"
-                 " closed stream", 
-                 funcMap[funcID], streamID );
+        int streamID
+          = namespaceAdaptKey2(header->funcArgs.streamChange.streamID);
+        streamClose(streamID);
+        xdebug("READ FUNCTION CALL FROM WIN:  %s, streamID=%d,"
+               " closed stream",
+               funcMap[(-1 - funcID)], streamID);
       }
       break;
     case STREAMOPEN:
       {
-        char *filename;
-        size_t filenamesz;
-        int filetype, streamID;
-
-        getBufferGetFromEnd ( __func__, __LINE__, 
-                              root, &filenamesz, sizeof ( filenamesz ));
+        size_t filenamesz = header->funcArgs.newFile.fnamelen;
         xassert ( filenamesz > 0 && filenamesz < MAXDATAFILENAME );
-        filename = xmalloc(filenamesz + 1);
-        getBufferGetFromEnd ( __func__, __LINE__, 
-                              root, filename, filenamesz );
-        filename[filenamesz] = '\0';
-        getBufferGetFromEnd ( __func__, __LINE__, 
-                              root, &filetype, sizeof ( filetype ));
-        xassert ( filetype >= MINFILETYPE && filetype <= MAXFILETYPE );
-        streamID = streamOpenWrite ( filename, filetype );
+        const char *filename
+          = (const char *)(rxWin[root].buffer
+                           + header->funcArgs.newFile.offset);
+        xassert(filename[filenamesz] == '\0');
+        int filetype = header->funcArgs.newFile.filetype;
+        int streamID = streamOpenWrite(filename, filetype);
+        xassert(streamID != CDI_ELIBNAVAIL);
         xdebug("READ FUNCTION CALL FROM WIN:  %s, filenamesz=%zu,"
                " filename=%s, filetype=%d, OPENED STREAM %d",
-               funcMap[funcID], filenamesz, filename,
+               funcMap[(-1 - funcID)], filenamesz, filename,
                filetype, streamID);
-        free(filename);
       }
-      break; 
+      break;
     case STREAMDEFVLIST:
       {
-        int streamID, vlistID;
-
-        getBufferGetFromEnd ( __func__, __LINE__, 
-                              root, &streamID, sizeof ( vlistID ));
-        getBufferGetFromEnd ( __func__, __LINE__, 
-                              root, &vlistID, sizeof ( vlistID ));
-        streamDefVlist ( streamID, vlistID );
-        xdebug ( "READ FUNCTION CALL FROM WIN:  %s, streamID=%d,"
-                 " vlistID=%d, called streamDefVlist ().", 
-                 funcMap[funcID], streamID, vlistID );
+        int streamID
+          = namespaceAdaptKey2(header->funcArgs.streamChange.streamID);
+        int vlistID = namespaceAdaptKey2(header->funcArgs.streamChange.vlistID);
+        streamDefVlist(streamID, vlistID);
+        xdebug("READ FUNCTION CALL FROM WIN:  %s, streamID=%d,"
+               " vlistID=%d, called streamDefVlist ().",
+               funcMap[(-1 - funcID)], streamID, vlistID);
+      }
+      break;
+    case STREAMDEFTIMESTEP:
+      {
+        MPI_Comm commCalc = commInqCommCalc ();
+        int streamID = header->funcArgs.streamNewTimestep.streamID;
+        int nspTarget = namespaceResHDecode(streamID).nsp;
+        streamID = namespaceAdaptKey2(streamID);
+        int tsID
+          = header->funcArgs.streamNewTimestep.tsID;
+        int oldTaxisID
+          = vlistInqTaxis(streamInqVlist(streamID));
+        int position = header->funcArgs.streamNewTimestep.offset;
+        int changedTaxisID
+          = taxisUnpack((char *)rxWin[root].buffer, (int)rxWin[root].size,
+                        &position, nspTarget, &commCalc, 0);
+        taxis_t *oldTaxisPtr = taxisPtr(oldTaxisID);
+        taxis_t *changedTaxisPtr = taxisPtr(changedTaxisID);
+        ptaxisCopy(oldTaxisPtr, changedTaxisPtr);
+        taxisDestroy(changedTaxisID);
+        streamDefTimestep(streamID, tsID);
       }
       break;
     default:
       xabort ( "REMOTE FUNCTIONCALL NOT IMPLEMENTED!" );
     }
-  getBufferGetFromEnd ( __func__, __LINE__, 
-                        root, &tokenID, sizeof ( tokenID ));
-  xassert ( tokenID == SEPARATOR );
 }
 
 /************************************************************************/
 
-static
-void readGetBuffers ( int tsID, int vdate, int vtime )
+static void
+resizeVarGatherBuf(int vlistID, int varID, double **buf, int *bufSize)
+{
+  int size = vlistInqVarSize(vlistID, varID);
+  if (size <= *bufSize) ; else
+    *buf = xrealloc(*buf, (*bufSize = size) * sizeof (buf[0][0]));
+}
+
+static void
+gatherArray(int root, int nProcsModel, int headerIdx,
+            int vlistID,
+            double *gatherBuf, int *nmiss)
+{
+  union winHeaderEntry *winDict
+    = (union winHeaderEntry *)rxWin[root].buffer;
+  int streamID = winDict[headerIdx].dataRecord.streamID;
+  int varID = winDict[headerIdx].dataRecord.varID;
+  int varShape[3] = { 0, 0, 0 };
+  cdiPioQueryVarDims(varShape, vlistID, varID);
+  Xt_int varShapeXt[3];
+  static const Xt_int origin[3] = { 0, 0, 0 };
+  for (unsigned i = 0; i < 3; ++i)
+    varShapeXt[i] = varShape[i];
+  int varSize = varShape[0] * varShape[1] * varShape[2];
+  int *partOfs = xmalloc(2 * varSize * sizeof (partOfs[0])),
+    *gatherOfs = partOfs + varSize;
+  Xt_idxlist *part = xmalloc(nProcsModel * sizeof (part[0]));
+  MPI_Comm commCalc = commInqCommCalc();
+  {
+    int nmiss_ = 0, partOfsOfs = 0;
+    for (int modelID = 0; modelID < nProcsModel; modelID++)
+      {
+        struct dataRecord *dataHeader
+          = &((union winHeaderEntry *)
+              rxWin[modelID].buffer)[headerIdx].dataRecord;
+        struct partDescRecord *partHeader
+          = &((union winHeaderEntry *)
+              rxWin[modelID].buffer)[headerIdx + 1].partDesc;
+        int position = partHeader->offset;
+        xassert(namespaceAdaptKey2(dataHeader->streamID) == streamID
+                && dataHeader->varID == varID
+                && partHeader->partDescMarker == PARTDESCMARKER
+                && position > 0
+                && ((size_t)position
+                    >= sizeof (union winHeaderEntry) * rxWin[modelID].dictSize)
+                && ((size_t)position < rxWin[modelID].size));
+        part[modelID] = xt_idxlist_unpack(rxWin[modelID].buffer,
+                                          (int)rxWin[modelID].size,
+                                          &position, commCalc);
+        Xt_int partSize = xt_idxlist_get_num_indices(part[modelID]);
+        size_t charOfs = (rxWin[modelID].buffer + dataHeader->offset)
+          - rxWin[0].buffer;
+        xassert(charOfs % sizeof (double) == 0
+                && charOfs / sizeof (double) + partSize <= INT_MAX);
+        int elemOfs = charOfs / sizeof (double);
+        for (int i = 0; i < (int)partSize; ++i)
+          partOfs[partOfsOfs + i] = elemOfs + i;
+        partOfsOfs += partSize;
+        nmiss_ += dataHeader->nmiss;
+      }
+    *nmiss = nmiss_;
+  }
+  Xt_idxlist srcList = xt_idxlist_collection_new(part, nProcsModel);
+  for (int modelID = 0; modelID < nProcsModel; modelID++)
+    xt_idxlist_delete(part[modelID]);
+  free(part);
+  Xt_xmap gatherXmap;
+  {
+    Xt_idxlist dstList
+      = xt_idxsection_new(0, 3, varShapeXt, varShapeXt, origin);
+    struct Xt_com_list full = { .list = dstList, .rank = 0 };
+    gatherXmap = xt_xmap_intersection_new(1, &full, 1, &full, srcList, dstList,
+                                        MPI_COMM_SELF);
+    xt_idxlist_delete(dstList);
+  }
+  xt_idxlist_delete(srcList);
+  for (int i = 0; i < varSize; ++i)
+    gatherOfs[i] = i;
+
+  Xt_redist gatherRedist
+    = xt_redist_p2p_off_new(gatherXmap, partOfs, gatherOfs, MPI_DOUBLE);
+  xt_xmap_delete(gatherXmap);
+  xt_redist_s_exchange1(gatherRedist, rxWin[0].buffer, gatherBuf);
+  free(partOfs);
+  xt_redist_delete(gatherRedist);
+}
+
+struct xyzDims
+{
+  int sizes[3];
+};
+
+static inline int
+xyzGridSize(struct xyzDims dims)
+{
+  return dims.sizes[0] * dims.sizes[1] * dims.sizes[2];
+}
+
+#ifdef HAVE_PARALLEL_NC4
+static void
+queryVarBounds(struct PPM_extent varShape[3], int vlistID, int varID)
+{
+  varShape[0].first = 0;
+  varShape[1].first = 0;
+  varShape[2].first = 0;
+  int sizes[3];
+  cdiPioQueryVarDims(sizes, vlistID, varID);
+  for (unsigned i = 0; i < 3; ++i)
+    varShape[i].size = sizes[i];
+}
+
+/* compute distribution of collectors such that number of collectors
+ * <= number of variable grid cells in each dimension */
+static struct xyzDims
+varDimsCollGridMatch(const struct PPM_extent varDims[3])
+{
+  xassert(PPM_extents_size(3, varDims) >= commInqSizeColl());
+  struct xyzDims collGrid = { { 1, 1, 1 } };
+  /* because of storage order, dividing dimension 3 first is preferred */
+  for (int i = 0; i < numPioPrimes; ++i)
+    {
+      for (int dim = 2; dim >=0; --dim)
+        if (collGrid.sizes[dim] * pioPrimes[i] <= varDims[dim].size)
+          {
+            collGrid.sizes[dim] *= pioPrimes[i];
+            goto nextPrime;
+          }
+      /* no position found, retrack */
+      xabort("Not yet implemented back-tracking needed.");
+      nextPrime:
+      ;
+    }
+  return collGrid;
+}
+
+static void
+myVarPart(struct PPM_extent varShape[3], struct xyzDims collGrid,
+          struct PPM_extent myPart[3])
+{
+  int32_t myCollGridCoord[3];
+  {
+    struct PPM_extent collGridShape[3];
+    for (int i = 0; i < 3; ++i)
+      {
+        collGridShape[i].first = 0;
+        collGridShape[i].size = collGrid.sizes[i];
+      }
+    PPM_lidx2rlcoord_e(3, collGridShape, commInqRankColl(), myCollGridCoord);
+    xdebug("my coord: (%d, %d, %d)", myCollGridCoord[0], myCollGridCoord[1],
+           myCollGridCoord[2]);
+  }
+  PPM_uniform_partition_nd(3, varShape, collGrid.sizes,
+                           myCollGridCoord, myPart);
+}
+#elif defined (HAVE_LIBNETCDF)
+/* needed for writing when some files are only written to by a single process */
+/* cdiOpenFileMap(fileID) gives the writer process */
+int cdiPioSerialOpenFileMap(int streamID)
+{
+  return stream_to_pointer(streamID)->ownerRank;
+}
+/* for load-balancing purposes, count number of files per process */
+/* cdiOpenFileCounts[rank] gives number of open files rank has to himself */
+static int *cdiSerialOpenFileCount = NULL;
+int cdiPioNextOpenRank()
+{
+  xassert(cdiSerialOpenFileCount != NULL);
+  int commCollSize = commInqSizeColl();
+  int minRank = 0, minOpenCount = cdiSerialOpenFileCount[0];
+  for (int i = 1; i < commCollSize; ++i)
+    if (cdiSerialOpenFileCount[i] < minOpenCount)
+      {
+        minOpenCount = cdiSerialOpenFileCount[i];
+        minRank = i;
+      }
+  return minRank;
+}
+
+void cdiPioOpenFileOnRank(int rank)
+{
+  xassert(cdiSerialOpenFileCount != NULL
+          && rank >= 0 && rank < commInqSizeColl());
+  ++(cdiSerialOpenFileCount[rank]);
+}
+
+
+void cdiPioCloseFileOnRank(int rank)
+{
+  xassert(cdiSerialOpenFileCount != NULL
+          && rank >= 0 && rank < commInqSizeColl());
+  xassert(cdiSerialOpenFileCount[rank] > 0);
+  --(cdiSerialOpenFileCount[rank]);
+}
+
+static void
+cdiPioServerCdfDefVars(stream_t *streamptr)
+{
+  int rank, rankOpen;
+  if (commInqIOMode() == PIO_NONE
+      || ((rank = commInqRankColl())
+          == (rankOpen = cdiPioSerialOpenFileMap(streamptr->self))))
+    cdfDefVars(streamptr);
+}
+
+#endif
+
+static void readGetBuffers()
 {
-  int modelID;
-  double * data = NULL, * dataHead = NULL;
-  int streamID = CDI_UNDEFID, streamIDNew = CDI_UNDEFID;
-  int varID, vlistID = CDI_UNDEFID, taxisID;
-  int size, chunk;
-  int tokenID, tokenID2;
-  
-  int nmiss = 0;
-  char text[1024];
   int nProcsModel = commInqNProcsModel ();
   int root        = commInqRootGlob ();
-  
+#ifdef HAVE_NETCDF4
+  int myCollRank = commInqRankColl();
+  MPI_Comm collComm = commInqCommColl();
+#endif
   xdebug("%s", "START");
-  
-  getBufferGetFromEnd ( __func__, __LINE__, 
-                        root, &tokenID, sizeof ( tokenID ));
 
-  while ( tokenID != END )
-    {
-      switch ( tokenID )
-        {
-        case DATATOKEN:
-          getBufferGetFromEnd ( __func__, __LINE__, 
-                                root, &streamIDNew, sizeof ( streamID ));
-          if ( streamIDNew != streamID )
+  union winHeaderEntry *winDict
+    = (union winHeaderEntry *)rxWin[root].buffer;
+  xassert(winDict[0].headerSize.sizeID == HEADERSIZEMARKER);
+  {
+    int dictSize = rxWin[root].dictSize,
+      firstNonRPCEntry = dictSize - winDict[0].headerSize.numRPCEntries - 1,
+      headerIdx,
+      numFuncCalls = 0;
+    for (headerIdx = dictSize - 1;
+         headerIdx > firstNonRPCEntry;
+         --headerIdx)
+      {
+        struct funcCallDesc *header
+          = &(winDict[headerIdx].funcCall);
+        xassert(header->funcID >= MINFUNCID
+                && header->funcID <= MAXFUNCID);
+        ++numFuncCalls;
+        readFuncCall(header);
+      }
+    xassert(numFuncCalls == winDict[0].headerSize.numRPCEntries);
+  }
+  /* build list of streams, data was transferred for */
+  {
+    int numDataEntries = winDict[0].headerSize.numDataEntries;
+    int streamIdx;
+    struct {
+      int streamID, filetype;
+      int firstHeaderIdx, lastHeaderIdx;
+      int numVars, *varMap;
+    } *streamMap;
+    int numStreamIDs = 0, sizeStreamMap = 16;
+    streamMap = xmalloc(sizeStreamMap * sizeof (streamMap[0]));
+    int streamIDOld = CDI_UNDEFID;
+    int oldStreamIdx = CDI_UNDEFID;
+    int filetype = CDI_UNDEFID;
+    for (int headerIdx = 1; headerIdx < numDataEntries; headerIdx += 2)
+      {
+        int streamID
+          = winDict[headerIdx].dataRecord.streamID
+          = namespaceAdaptKey2(winDict[headerIdx].dataRecord.streamID);
+        xassert(streamID > 0);
+        if (streamID != streamIDOld)
+          {
+            for (int i = numStreamIDs - 1; i >= 0; --i)
+              if ((streamIDOld = streamMap[i].streamID) == streamID)
+                {
+                  filetype = streamMap[i].filetype;
+                  oldStreamIdx = i;
+                  goto streamIDInventorized;
+                }
+            if (numStreamIDs < sizeStreamMap) ; else
+              streamMap = xrealloc(streamMap,
+                                   (sizeStreamMap *= 2)
+                                   * sizeof (streamMap[0]));
+            streamMap[numStreamIDs].streamID = streamID;
+            streamMap[numStreamIDs].firstHeaderIdx = headerIdx;
+            streamMap[numStreamIDs].numVars = -1;
+            oldStreamIdx = numStreamIDs;
+            streamIDOld = streamID;
+            filetype = streamInqFiletype(streamID);
+            streamMap[numStreamIDs].filetype = filetype;
+            if (filetype == FILETYPE_NC || filetype == FILETYPE_NC2
+                || filetype == FILETYPE_NC4)
+              {
+                int vlistID = streamInqVlist(streamID);
+                int nvars = vlistNvars(vlistID);
+                streamMap[numStreamIDs].numVars = nvars;
+                streamMap[numStreamIDs].varMap
+                  = xmalloc(sizeof (streamMap[numStreamIDs].varMap[0])
+                            * nvars);
+                for (int i = 0; i < nvars; ++i)
+                  streamMap[numStreamIDs].varMap[i] = -1;
+              }
+            ++numStreamIDs;
+          }
+        streamIDInventorized:
+        streamMap[oldStreamIdx].lastHeaderIdx = headerIdx;
+        if (filetype == FILETYPE_NC || filetype == FILETYPE_NC2
+                || filetype == FILETYPE_NC4)
+          {
+            int varID = winDict[headerIdx].dataRecord.varID;
+            streamMap[oldStreamIdx].varMap[varID] = headerIdx;
+          }
+      }
+    double *data = NULL;
+#if defined (HAVE_PARALLEL_NC4)
+    double *writeBuf = NULL;
+#endif
+    int currentDataBufSize = 0;
+    for (streamIdx = 0; streamIdx < numStreamIDs; ++streamIdx)
+      {
+        int streamID = streamMap[streamIdx].streamID;
+        int vlistID = streamInqVlist(streamID);
+        int fileType = streamMap[streamIdx].filetype;
+
+        switch (fileType)
+          {
+          case FILETYPE_GRB:
+          case FILETYPE_GRB2:
             {
-              streamID = streamIDNew;
-              vlistID = streamInqVlist ( streamID );
-              taxisID = vlistInqTaxis ( vlistID );
-              taxisDefVdate ( taxisID, vdate );
-              taxisDefVtime ( taxisID, vtime );
-              streamDefTimestep ( streamID, tsID );
+              int headerIdx, lastHeaderIdx = streamMap[streamIdx].lastHeaderIdx;
+              for (headerIdx = streamMap[streamIdx].firstHeaderIdx;
+                   headerIdx <= lastHeaderIdx;
+                   headerIdx += 2)
+                if (streamID == winDict[headerIdx].dataRecord.streamID)
+                  {
+                    int varID = winDict[headerIdx].dataRecord.varID;
+                    int size = vlistInqVarSize(vlistID, varID);
+                    int nmiss;
+                    resizeVarGatherBuf(vlistID, varID, &data,
+                                       &currentDataBufSize);
+                    gatherArray(root, nProcsModel, headerIdx,
+                                vlistID, data, &nmiss);
+                    streamWriteVar(streamID, varID, data, nmiss);
+                    if ( ddebug > 2 )
+                      {
+                        char text[1024];
+                        sprintf(text, "streamID=%d, var[%d], size=%d",
+                                streamID, varID, size);
+                        xprintArray(text, data, size, DATATYPE_FLT);
+                      }
+                  }
             }
-          getBufferGetFromEnd(__func__, __LINE__, root, &varID, sizeof (varID));
-          size = vlistInqVarSize ( vlistID, varID );
-          data = xmalloc ( size * sizeof ( double ));
-          dataHead = data;
-          
-          for ( modelID = 0; modelID < nProcsModel; modelID++ )
+            break;
+#ifdef HAVE_NETCDF4
+          case FILETYPE_NC:
+          case FILETYPE_NC2:
+          case FILETYPE_NC4:
+#ifdef HAVE_PARALLEL_NC4
+            /* HAVE_PARALLE_NC4 implies having ScalES-PPM and yaxt */
             {
-              if ( modelID != root )
-                {
-                  int tempID;
-                  getBufferGetFromEnd ( __func__, __LINE__, 
-                                        modelID, &tempID, sizeof ( tempID ));
-                  xassert ( tempID == DATATOKEN );
-                  getBufferGetFromEnd ( __func__, __LINE__, 
-                                        modelID, &tempID, sizeof ( tempID ));
-                  xassert ( tempID == streamID );
-                  getBufferGetFromEnd ( __func__, __LINE__, 
-                                        modelID, &tempID, sizeof ( tempID ));
-                  xassert ( tempID == varID );
-                }
-              chunk  = vlistInqVarDecoChunk ( vlistID, varID, modelID );
-              getBufferGetFromEnd ( __func__, __LINE__, 
-                                    modelID, dataHead, chunk * sizeof ( double ));
-              dataHead += chunk;
-              getBufferGetFromEnd ( __func__, __LINE__, 
-                                    modelID, &nmiss   , sizeof ( nmiss ));
-              getBufferGetFromEnd ( __func__, __LINE__, 
-                                    modelID, &tokenID2, sizeof ( tokenID2 ));
-              xassert ( tokenID2 == SEPARATOR );
+              int nvars = streamMap[streamIdx].numVars;
+              int *varMap = streamMap[streamIdx].varMap;
+              int *varIsWritten = xmalloc(sizeof (varIsWritten[0]) * nvars);
+              for (int varID = 0; varID < nvars; ++varID)
+                varIsWritten[varID] = ((varMap[varID] != -1)
+                                       ?myCollRank+1 : 0);
+              xmpi(MPI_Allreduce(MPI_IN_PLACE, varIsWritten, nvars,
+                                 MPI_INT, MPI_BOR, collComm));
+              for (int varID = 0; varID < nvars; ++varID)
+                if (varIsWritten[varID])
+                  {
+                    struct PPM_extent varShape[3];
+                    queryVarBounds(varShape, vlistID, varID);
+                    struct xyzDims collGrid = varDimsCollGridMatch(varShape);
+                    xdebug("writing varID %d with dimensions: "
+                           "x=%d, y=%d, z=%d,\n"
+                           "found distribution with dimensions:"
+                           " x=%d, y=%d, z=%d.", varID,
+                           varShape[0].size, varShape[1].size, varShape[2].size,
+                           collGrid.sizes[0], collGrid.sizes[1],
+                           collGrid.sizes[2]);
+                    struct PPM_extent varChunk[3];
+                    myVarPart(varShape, collGrid, varChunk);
+                    int myChunk[3][2];
+                    for (int i = 0; i < 3; ++i)
+                      {
+                        myChunk[i][0] = PPM_extent_start(varChunk[i]);
+                        myChunk[i][1] = PPM_extent_end(varChunk[i]);
+                      }
+                    xdebug("Writing chunk { { %d, %d }, { %d, %d },"
+                           " { %d, %d } }", myChunk[0][0], myChunk[0][1],
+                           myChunk[1][0], myChunk[1][1], myChunk[2][0],
+                           myChunk[2][1]);
+                    Xt_int varSize[3];
+                    for (int i = 0; i < 3; ++i)
+                      varSize[2 - i] = varShape[i].size;
+                    Xt_idxlist preRedistChunk, preWriteChunk;
+                    /* prepare yaxt descriptor for current data
+                       distribution after collect */
+                    int nmiss;
+                    if (varMap[varID] == -1)
+                      {
+                        preRedistChunk = xt_idxempty_new();
+                        xdebug("%s", "I got none\n");
+                      }
+                    else
+                      {
+                        Xt_int preRedistStart[3] = { 0, 0, 0 };
+                        preRedistChunk
+                          = xt_idxsection_new(0, 3, varSize, varSize,
+                                              preRedistStart);
+                        resizeVarGatherBuf(vlistID, varID, &data,
+                                           &currentDataBufSize);
+                        int headerIdx = varMap[varID];
+                        gatherArray(root, nProcsModel, headerIdx,
+                                    vlistID, data, &nmiss);
+                        xdebug("%s", "I got all\n");
+                      }
+                    MPI_Bcast(&nmiss, 1, MPI_INT, varIsWritten[varID] - 1,
+                              collComm);
+                    /* prepare yaxt descriptor for write chunk */
+                    {
+                      Xt_int preWriteChunkStart[3], preWriteChunkSize[3];
+                      for (int i = 0; i < 3; ++i)
+                        {
+                          preWriteChunkStart[2 - i] = varChunk[i].first;
+                          preWriteChunkSize[2 - i] = varChunk[i].size;
+                        }
+                      preWriteChunk = xt_idxsection_new(0, 3, varSize,
+                                                        preWriteChunkSize,
+                                                        preWriteChunkStart);
+                    }
+                    /* prepare redistribution */
+                    {
+                      Xt_xmap xmap = xt_xmap_all2all_new(preRedistChunk,
+                                                         preWriteChunk,
+                                                         collComm);
+                      Xt_redist redist = xt_redist_p2p_new(xmap, MPI_DOUBLE);
+                      xt_idxlist_delete(preRedistChunk);
+                      xt_idxlist_delete(preWriteChunk);
+                      xt_xmap_delete(xmap);
+                      writeBuf = xrealloc(writeBuf,
+                                          sizeof (double)
+                                          * PPM_extents_size(3, varChunk));
+                      xt_redist_s_exchange1(redist, data, writeBuf);
+                      xt_redist_delete(redist);
+                    }
+                    /* write chunk */
+                    streamWriteVarChunk(streamID, varID,
+                                        (const int (*)[2])myChunk, writeBuf,
+                                        nmiss);
+                  }
             }
-          
-          streamWriteVar ( streamID, varID, data, nmiss );
-          
-          if ( ddebug > 2 )
+#else
+            /* determine process which has stream open (writer) and
+             * which has data for which variable (var owner)
+             * three cases need to be distinguished */
             {
-              sprintf ( text, "streamID=%d, var[%d], size=%d", streamID, varID, size );
-              xprintArray ( text, data, size, DATATYPE_FLT );
+              int nvars = streamMap[streamIdx].numVars;
+              int *varMap = streamMap[streamIdx].varMap;
+              int *varIsWritten = xmalloc(sizeof (varIsWritten[0]) * nvars);
+              for (int varID = 0; varID < nvars; ++varID)
+                varIsWritten[varID] = ((varMap[varID] != -1)
+                                       ?myCollRank+1 : 0);
+              xmpi(MPI_Allreduce(MPI_IN_PLACE, varIsWritten, nvars,
+                                 MPI_INT, MPI_BOR, collComm));
+              int writerRank;
+              if ((writerRank = cdiPioSerialOpenFileMap(streamID))
+                  == myCollRank)
+                {
+                  for (int varID = 0; varID < nvars; ++varID)
+                    if (varIsWritten[varID])
+                      {
+                        int nmiss;
+                        int size = vlistInqVarSize(vlistID, varID);
+                        resizeVarGatherBuf(vlistID, varID, &data,
+                                           &currentDataBufSize);
+                        int headerIdx = varMap[varID];
+                        if (varIsWritten[varID] == myCollRank + 1)
+                          {
+                            /* this process has the full array and will
+                             * write it */
+                            xdebug("gathering varID=%d for direct writing",
+                                   varID);
+                            gatherArray(root, nProcsModel, headerIdx,
+                                        vlistID, data, &nmiss);
+                          }
+                        else
+                          {
+                            /* another process has the array and will
+                             * send it over */
+                            MPI_Status stat;
+                            xdebug("receiving varID=%d for writing from"
+                                   " process %d",
+                                   varID, varIsWritten[varID] - 1);
+                            xmpiStat(MPI_Recv(&nmiss, 1, MPI_INT,
+                                              varIsWritten[varID] - 1,
+                                              COLLBUFNMISS,
+                                              collComm, &stat), &stat);
+                            xmpiStat(MPI_Recv(data, size, MPI_DOUBLE,
+                                              varIsWritten[varID] - 1,
+                                              COLLBUFTX,
+                                              collComm, &stat), &stat);
+                          }
+                        streamWriteVar(streamID, varID, data, nmiss);
+                      }
+                }
+              else
+                for (int varID = 0; varID < nvars; ++varID)
+                  if (varIsWritten[varID] == myCollRank + 1)
+                    {
+                      /* this process has the full array and another
+                       * will write it */
+                      int nmiss;
+                      int size = vlistInqVarSize(vlistID, varID);
+                      resizeVarGatherBuf(vlistID, varID, &data,
+                                         &currentDataBufSize);
+                      int headerIdx = varMap[varID];
+                      gatherArray(root, nProcsModel, headerIdx,
+                                  vlistID, data, &nmiss);
+                      MPI_Request req;
+                      MPI_Status stat;
+                      xdebug("sending varID=%d for writing to"
+                             " process %d",
+                             varID, writerRank);
+                      xmpi(MPI_Isend(&nmiss, 1, MPI_INT,
+                                     writerRank, COLLBUFNMISS,
+                                     collComm, &req));
+                      xmpi(MPI_Send(data, size, MPI_DOUBLE,
+                                    writerRank, COLLBUFTX,
+                                    collComm));
+                      xmpiStat(MPI_Wait(&req, &stat), &stat);
+                    }
             }
-          
-          free ( data );
-          break;
-        case FUNCCALL:
-          readFuncCall ();
-          break;
-        default:
-          xabort ( "BUFFER NOT READABLE!" );           
-        }
-      getBufferGetFromEnd ( __func__, __LINE__, 
-                            root, &tokenID, sizeof ( tokenID ));
-    }
+#endif
+            break;
+#endif
+          default:
+            xabort("unhandled filetype in parallel I/O.");
+          }
+      }
+    free(streamMap);
+    free(data);
+  }
   xdebug("%s", "RETURN");
 } 
 
 /************************************************************************/
 
 
-static 
-  void getFlushBuffer ( int modelID )
+static
+void clearModelWinBuffer(int modelID)
 {
   int nProcsModel = commInqNProcsModel ();
 
@@ -336,7 +805,6 @@ static
             rxWin[modelID].size > 0 &&
             rxWin[modelID].size <= MAXWINBUFFERSIZE );
   memset(rxWin[modelID].buffer, 0, rxWin[modelID].size);
-  rxWin[modelID].head = rxWin[modelID].buffer;
 }
 
 
@@ -344,28 +812,28 @@ static
 
 
 static
-void getData ( int tsID, int vdate, int vtime )
+void getTimeStepData()
 {
   int modelID;
   char text[1024];
   int nProcsModel = commInqNProcsModel ();
   void *getWinBaseAddr;
   int attrFound;
-          
+
   xdebug("%s", "START");
 
   // todo put in correct lbs and ubs
-  xassert ( tsID >= 0 && vdate >= 0 && vtime >= 0 );
   xmpi(MPI_Win_start(groupModel, 0, getWin));
   xmpi(MPI_Win_get_attr(getWin, MPI_WIN_BASE, &getWinBaseAddr, &attrFound));
   xassert(attrFound);
   for ( modelID = 0; modelID < nProcsModel; modelID++ )
     {
-      getFlushBuffer ( modelID );
+      clearModelWinBuffer(modelID);
       xdebug("modelID=%d, nProcsModel=%d, rxWin[%d].size=%zu,"
              " getWin=%p, sizeof(int)=%u",
              modelID, nProcsModel, modelID, rxWin[modelID].size,
              getWinBaseAddr, (unsigned)sizeof(int));
+      /* FIXME: this needs to use MPI_PACK for portability */
       xmpi(MPI_Get(rxWin[modelID].buffer, rxWin[modelID].size,
                    MPI_UNSIGNED_CHAR, modelID, 0,
                    rxWin[modelID].size, MPI_UNSIGNED_CHAR, getWin));
@@ -381,13 +849,81 @@ void getData ( int tsID, int vdate, int vtime )
                     rxWin[modelID].size / sizeof (double),
                     DATATYPE_FLT);
       }
-  readGetBuffers ( tsID, vdate, vtime );
-          
+  readGetBuffers();
+
   xdebug("%s", "RETURN");
 }
 
 /************************************************************************/
 
+#if defined (HAVE_LIBNETCDF) && ! defined (HAVE_PARALLEL_NC4)
+static int
+cdiPioStreamCDFOpenWrap(const char *filename, const char *filemode,
+                        int filetype, stream_t *streamptr,
+                        int recordBufIsToBeCreated)
+{
+  switch (filetype)
+    {
+    case FILETYPE_NC4:
+    case FILETYPE_NC4C:
+      {
+        int rank, fileID;
+        int ioMode = commInqIOMode();
+        if (ioMode == PIO_NONE
+            || commInqRankColl() == (rank = cdiPioNextOpenRank()))
+          fileID = cdiStreamOpenDefaultDelegate(filename, filemode, filetype,
+                                                streamptr,
+                                                recordBufIsToBeCreated);
+        if (ioMode != PIO_NONE)
+          xmpi(MPI_Bcast(&fileID, 1, MPI_INT, rank, commInqCommColl()));
+        streamptr->ownerRank = rank;
+        return fileID;
+      }
+    default:
+      return cdiStreamOpenDefaultDelegate(filename, filemode, filetype,
+                                          streamptr, recordBufIsToBeCreated);
+    }
+}
+
+static void
+cdiPioStreamCDFCloseWrap(stream_t *streamptr, int recordBufIsToBeDeleted)
+{
+  int fileID   = streamptr->fileID;
+  int filetype = streamptr->filetype;
+  if ( fileID == CDI_UNDEFID )
+    Warning("File %s not open!", streamptr->filename);
+  else
+    switch (filetype)
+      {
+      case FILETYPE_NC:
+      case FILETYPE_NC2:
+      case FILETYPE_NC4:
+      case FILETYPE_NC4C:
+        {
+          int rank, rankOpen;
+          if (commInqIOMode() == PIO_NONE
+              || ((rank = commInqRankColl())
+                  == (rankOpen = cdiPioSerialOpenFileMap(streamptr->self))))
+            cdiStreamCloseDefaultDelegate(streamptr, recordBufIsToBeDeleted);
+          break;
+        }
+      default:
+        cdiStreamCloseDefaultDelegate(streamptr, recordBufIsToBeDeleted);
+      }
+}
+
+static void
+cdiPioCdfDefTimestep(stream_t *streamptr, int tsID)
+{
+  int rank, rankOpen, streamID = streamptr->self;
+  if (commInqIOMode() == PIO_NONE
+      || ((rank = commInqRankColl())
+          == (rankOpen = cdiPioSerialOpenFileMap(streamID))))
+    cdfDefTimestep(streamptr, tsID);
+}
+
+#endif
+
 /**
   @brief is encapsulated in CDI library and run on I/O PEs.
 
@@ -398,7 +934,7 @@ void getData ( int tsID, int vdate, int vtime )
 
 void IOServer ()
 {
-  int source, tag, *iBuffer, size, nProcsModel=commInqNProcsModel();
+  int source, tag, size, nProcsModel=commInqNProcsModel();
   static int nfinished = 0;
   char * buffer;
   MPI_Comm commCalc;
@@ -410,6 +946,24 @@ void IOServer ()
   if ( commInqRankNode () == commInqSpecialRankNode ()) 
     backendFinalize ();
   commCalc = commInqCommCalc ();
+#ifdef HAVE_PARALLEL_NC4
+  cdiPioEnableNetCDFParAccess();
+  numPioPrimes = PPM_prime_factorization_32((uint32_t)commInqSizeColl(),
+                                            &pioPrimes);
+#elif defined (HAVE_LIBNETCDF)
+  cdiSerialOpenFileCount = xcalloc(sizeof (cdiSerialOpenFileCount[0]),
+                                   commInqSizeColl());
+  namespaceSwitchSet(NSSWITCH_STREAM_OPEN_BACKEND,
+                     NSSW_FUNC(cdiPioStreamCDFOpenWrap));
+  namespaceSwitchSet(NSSWITCH_STREAM_CLOSE_BACKEND,
+                     NSSW_FUNC(cdiPioStreamCDFCloseWrap));
+  namespaceSwitchSet(NSSWITCH_CDF_DEF_TIMESTEP,
+                     NSSW_FUNC(cdiPioCdfDefTimestep));
+  namespaceSwitchSet(NSSWITCH_CDF_STREAM_SETUP,
+                     NSSW_FUNC(cdiPioServerCdfDefVars));
+#endif
+  namespaceSwitchSet(NSSWITCH_FILE_WRITE,
+                     NSSW_FUNC(cdiPioFileWrite));
 
   for ( ;; )
     {
@@ -459,31 +1013,41 @@ void IOServer ()
 	case RESOURCES:
 	  xdebugMsg (  tag, source, nfinished );
 	  xmpi ( MPI_Get_count ( &status, MPI_CHAR, &size ));
-	  buffer = xmalloc ( size * sizeof ( char ));
+	  buffer = xmalloc(size);
 	  xmpi ( MPI_Recv ( buffer, size, MPI_PACKED, source,
                             tag, commCalc, &status ));
           xdebug("%s", "RECEIVED MESSAGE WITH TAG \"RESOURCES\"");
-	  rpcUnpackResources ( buffer, size, commCalc );
+	  reshUnpackResources(buffer, size, &commCalc);
           xdebug("%s", "");
 	  free ( buffer );
-          if ( ddebug > 0 && commInqRankGlob () == nProcsModel ) 
-            reshListPrint ( "reshListIOServer" );
-	  serverWinCreate ();
+          {
+            int rankGlob = commInqRankGlob();
+            if ( ddebug > 0 && rankGlob == nProcsModel)
+              {
+                static const char baseName[] = "reshListIOServer.",
+                  suffix[] = ".txt";
+                /* 9 digits for rank at most */
+                char buf[sizeof (baseName) + 9 + sizeof (suffix) + 1];
+                snprintf(buf, sizeof (buf), "%s%d%s", baseName, rankGlob,
+                         suffix);
+                FILE *fp = fopen(buf, "w");
+                xassert(fp);
+                reshListPrint(fp);
+                fclose(fp);
+              }
+          }
+          serverWinCreate ();
 	  break;
 
 	case WRITETS:
-	  xdebugMsg (  tag, source, nfinished );
-          xmpi ( MPI_Get_count ( &status, MPI_INTEGER, &size ));     
-          xassert ( size == timestepSize );
-          iBuffer = xmalloc ( size * sizeof ( int ));
-          xmpi ( MPI_Recv ( iBuffer, size, MPI_INTEGER, source,
-                            tag, commCalc, &status ));
-          xdebug ( "RECEIVED MESSAGE WITH TAG \"WRITETS\": "
-                   "tsID=%d, vdate=%d, vtime=%d, source=%d", 
-                   iBuffer[0], iBuffer[1], iBuffer[2], source );
-          
-          getData ( iBuffer[0], iBuffer[1], iBuffer[2] );                
-          free ( iBuffer );
+          {
+            xdebugMsg(tag, source, nfinished);
+            xmpi(MPI_Recv(NULL, 0, MPI_INT, source,
+                          tag, commCalc, &status));
+            xdebug("RECEIVED MESSAGE WITH TAG \"WRITETS\": source=%d",
+                   source);
+            getTimeStepData();
+          }
 	  break;
 
 	default:
diff --git a/libcdi/src/pio_util.c b/libcdi/src/pio_util.c
index 3947e9d..394765a 100644
--- a/libcdi/src/pio_util.c
+++ b/libcdi/src/pio_util.c
@@ -11,89 +11,38 @@
 #include "pio_util.h"
 #include "cdi.h"
 
+#ifdef USE_MPI
 static
 char commands[][13] = { "FINALIZE\0",
                         "RESOURCES\0",
                         "WINCREATE\0",
                         "WRITETS\0"};
-
-
-void pcdiAssert(bool assumption,
-                const char * filename, const char * functionname, int line )
-{
-  if ( !assumption )
-    {
-#ifdef USE_MPI
-      int rank = -1, init_flag = 0;
-      if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag)
-        MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-      fprintf ( stderr, "ERROR, FALSE ASSUMPTION: PE%d in %s, %s, line %d\n",
-                rank, functionname, filename, line );
-      fflush ( stderr );
-      if (init_flag)
-        MPI_Abort ( MPI_COMM_WORLD, 1 );
-      else
-        abort();
-#else
-      fprintf ( stderr, "ERROR, FALSE ASSUMPTION, %s, %s, line %d\n",
-                functionname, filename, line );
-      fflush ( stderr );
-      abort();
 #endif
-    }
-}
 
-/****************************************************/
 
-void pcdiAbortC(const char * caller, const char * filename, const char *functionname, int line,
-                const char * errorString, ... )
-{
-  va_list ap;
-  va_start(ap, errorString);
+/*****************************************************************************/
 #ifdef USE_MPI
-  {
-    int rank;
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-    fprintf(stderr, "ERROR, pe%d in %s, %s, line %d, called from %s\nerrorString: \"",
-            rank, functionname, filename, line, caller);
-  }
-  vfprintf(stderr, errorString, ap);
-  fputs("\"\n", stderr);
-  MPI_Abort ( MPI_COMM_WORLD, 1 );
-#else
-  fprintf(stderr, "ERROR, %s, %s, line %d, called from %s\nerrorString: \"",
-          functionname, filename, line, caller);
-  vfprintf(stderr, errorString, ap);
-  fputs("\"\n", stderr);
-#endif
-  exit ( EXIT_FAILURE );
-  va_end(ap);
-}
-
-void pcdiAbort(const char * filename, const char *functionname, int line,
-               const char * errorString, ... )
+void
+cdiAbortC_MPI(const char *caller, const char *filename,
+              const char *functionname, int line,
+              const char *errorString, va_list ap)
 {
-  va_list ap;
-  va_start(ap, errorString);
-#ifdef USE_MPI
   {
-    int rank;
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-    fprintf(stderr, "ERROR, pe%d in %s, %s, line %d, errorString: \"",
-            rank, functionname, filename, line);
+    int rank = getMPICommWorldRank();
+    fprintf(stderr, "ERROR, pe%d in %s, %s, line %d%s"
+            "%s\nerrorString: \"", rank, functionname, filename, line,
+            caller?", called from ":"", caller?caller:"");
   }
   vfprintf(stderr, errorString, ap);
   fputs("\"\n", stderr);
-  MPI_Abort ( MPI_COMM_WORLD, 1 );
-#else
-  fprintf(stderr, "ERROR, %s, %s, line %d, errorString: \"",
-          functionname, filename, line);
-  vfprintf(stderr, errorString, ap);
-  fputs("\"\n", stderr);
-#endif
-  exit ( EXIT_FAILURE );
+  if (callsToMPIAreAllowed())
+    MPI_Abort(MPI_COMM_WORLD, 1);
+  else
+    abort();
+  exit(EXIT_FAILURE);
   va_end(ap);
 }
+#endif
 
 /*****************************************************************************/
 
@@ -101,11 +50,9 @@ void * pcdiXmalloc ( size_t size, const char *filename, const char *functionname
 		     int line )
 {
   void * value = calloc (1, size );
-
   if ( value == NULL )
-    pcdiAbort (filename, functionname, line, "malloc failed: %s",
-               strerror(errno));
-
+    cdiAbort(filename, functionname, line, "malloc failed: %s",
+             strerror(errno));
   return value;
 }
 
@@ -113,11 +60,9 @@ void * pcdiXcalloc ( size_t nmemb, size_t size, const char *filename,
 		     const char *functionname, int line )
 {
   void * value = calloc ( nmemb, size );
-
   if ( value == NULL )
-    pcdiAbort (filename, functionname, line, "calloc failed: %s",
-               strerror(errno) );
-
+    cdiAbort(filename, functionname, line, "calloc failed: %s",
+             strerror(errno) );
   return value;
 }
 
@@ -125,40 +70,30 @@ void * pcdiXrealloc ( void *p, size_t size, const char *functionname,
 		      const char *filename, int line )
 {
   void * value = realloc ( p, size );
-
   if ( value == NULL )
-    pcdiAbort(filename, functionname, line, "realloc failed: %s",
-              strerror(errno));
-
+    cdiAbort(filename, functionname, line, "realloc failed: %s",
+             strerror(errno));
   return value;
 }
 
 /***************************************************************/
 
 #ifdef USE_MPI
-void pcdiXMPI ( int iret, const char *filename, int line )
+void pcdiXMPI(int iret, const char *filename, int line)
 {
   char errorString[2][MPI_MAX_ERROR_STRING + 1];
-  int len, errorClass, rank;
-
-  if ( iret != MPI_SUCCESS )
-    {
-      MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-
-      MPI_Error_class ( iret, &errorClass );
-      MPI_Error_string ( errorClass, errorString[0], &len );
-      errorString[0][len] = '\0';
-      MPI_Error_string ( iret, errorString[1], &len);
-      errorString[1][len] = '\0';
-
-      fprintf ( stderr, "MPI ERROR, pe%d, %s, line %d,"
-                "errorClass: \"%s\""
-                "errorString: \"%s\"\n",
-                rank, filename, line,
-                errorString[0], errorString[1]);
-
-      MPI_Abort ( MPI_COMM_WORLD, iret );
-    }
+  int len, errorClass, rank = getMPICommWorldRank();
+  MPI_Error_class(iret, &errorClass);
+  MPI_Error_string(errorClass, errorString[0], &len);
+  errorString[0][len] = '\0';
+  MPI_Error_string(iret, errorString[1], &len);
+  errorString[1][len] = '\0';
+  fprintf(stderr, "MPI ERROR, pe%d, %s, line %d,"
+          "errorClass: \"%s\""
+          "errorString: \"%s\"\n",
+          rank, filename, line,
+          errorString[0], errorString[1]);
+  MPI_Abort(MPI_COMM_WORLD, iret);
 }
 
 /*****************************************************************************/
@@ -166,9 +101,7 @@ void pcdiXMPI ( int iret, const char *filename, int line )
 void pcdiXMPIStat ( int iret, const char *filename, int line, MPI_Status *status )
 {
   char errorString[MPI_MAX_ERROR_STRING + 1];
-  int len, rank;
-
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
+  int len, rank = getMPICommWorldRank();
 
   if ( iret == MPI_ERR_IN_STATUS )
     {
@@ -202,15 +135,22 @@ void pcdiXMPIStat ( int iret, const char *filename, int line, MPI_Status *status
 #ifdef USE_MPI
 void pcdiDebugComm ( const char *filename, const char *functionname, int line, MPI_Comm *comm )
 {
-  int rank, size, len, rankGlob;
+  int rank = -1, size, len, rankGlob = -1;
   char *name;
 
   name = ( char * ) xmalloc ( MPI_MAX_OBJECT_NAME );
   memset ( name, 0, ( MPI_MAX_OBJECT_NAME ) * sizeof ( char ));
   MPI_Comm_get_name ( * comm, name, &len );
   MPI_Comm_size ( * comm, &size );
-  MPI_Comm_rank ( * comm, &rank );
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rankGlob );
+  {
+    int init_flag = 0, finished_flag = 0;
+    if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag
+        && MPI_Finalized(&finished_flag) == MPI_SUCCESS && !finished_flag)
+      {
+        MPI_Comm_rank(*comm, &rank);
+        MPI_Comm_rank(MPI_COMM_WORLD, &rankGlob);
+      }
+  }
   fprintf ( stdout,
             "pe%d in %s, %s, line %d: comm: name=%s, size=%d, rank=%d\n",
             rankGlob, functionname, filename, line,
@@ -227,9 +167,7 @@ void pcdiDebugMsg ( const char * cdiPioDebugString, const char *filename,
                     const char *functionname, int line, int tag, int source,
                     int nfinished )
 {
-  int rank;
-
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
+  int rank = getMPICommWorldRank();
 
   fprintf ( stdout,
             "%s pe%d in %s, %s, line %d: command %s, source %d, finalized=%d\n",
@@ -243,9 +181,7 @@ void pcdiDebugMsg ( const char * cdiPioDebugString, const char *filename,
 void pcdiDebugMsg2 ( const char *filename, const char *functionname, int line,
                    int tag, int source, char * text )
 {
-  int rank;
-
-  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
+  int rank = getMPICommWorldRank();
 
   fprintf ( stdout,
             "pe%d in %s, %s, line %d: command %s, source %d, %s\n",
@@ -301,20 +237,16 @@ double xchecksum ( int type, int count, void * buffer )
 void printArray ( const char * cdiPioDebugString, char * ps, const void * array, int n,
                   int datatype, const char * funname, const char * filename, int line )
 {
-  int i, rank;
+  int i;
   int * iArray;
   double * dArray;
 
 #ifdef USE_MPI
   {
-    int init_flag;
-    if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag)
-      MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
-    else
-      rank = -1;
+    int rank = getMPICommWorldRank();
+    fprintf ( stdout, "%s pe%d in %s, %s, line %d: %s = ",
+              cdiPioDebugString, rank, funname, filename, line, ps );
   }
-  fprintf ( stdout, "%s pe%d in %s, %s, line %d: %s = ",
-	    cdiPioDebugString, rank, funname, filename, line, ps );
 #else
   fprintf ( stdout, "%s %s, %s, line %d: %s = ",
 	    cdiPioDebugString, funname, filename, line, ps );
@@ -341,6 +273,36 @@ void printArray ( const char * cdiPioDebugString, char * ps, const void * array,
   return;
 }
 
+int
+cdiPioQueryVarDims(int varShape[3], int vlistID, int varID)
+{
+  int gridID = vlistInqVarGrid(vlistID, varID);
+  int zaxisID = vlistInqVarZaxis(vlistID, varID);
+  int gridType = gridInqType(gridID);
+  switch (gridType)
+    {
+    case GRID_LONLAT:
+    case GRID_GAUSSIAN:
+      varShape[0] = gridInqXsize(gridID);
+      varShape[1] = gridInqYsize(gridID);
+      break;
+    case GRID_SPECTRAL:
+      varShape[0] = 2;
+      varShape[1] = gridInqSize(gridID) / 2;
+      break;
+    case GRID_GENERIC:
+    case GRID_LCC:
+    case GRID_GME:
+    case GRID_CURVILINEAR:
+    case GRID_UNSTRUCTURED:
+      xabort("unimplemented grid type: %d", gridType);
+      break;
+    }
+  varShape[2] = zaxisInqSize(zaxisID);
+  /* FIXME: other grids have different dimensionality */
+  return (varShape[2] == 1)?2:3;
+}
+
 /****************************************************/
 /*
  * Local Variables:
diff --git a/libcdi/src/pio_util.h b/libcdi/src/pio_util.h
index 0b3ee91..5c74227 100644
--- a/libcdi/src/pio_util.h
+++ b/libcdi/src/pio_util.h
@@ -1,10 +1,6 @@
 #ifndef PIO_UTIL_
 #define PIO_UTIL_
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -14,56 +10,47 @@
 #include "mpi.h"
 #endif
 
+#ifndef _ERROR_H
+#include "error.h"
+#endif
 
-#define MAXSTRLNNETCDF    32
-#define MAXBUFFERSIZE     32
-#define MAXVALUE          10
 #define MAXDEBUG           3
-#define MAXLEVELINFOS     10
-#define MAXVARS           10
-
-#define MAXLEVEL          10
-#define MAXLEVELIDX       10
-#define MAXRECORDS        10
-#define MAXRECIDS         10
-#define MAXVARS           10
-#define MAXTSTEPS         10
-#define MAXFNAMES         10
-#define MAXGHBUFFERSIZE_0 10
-#define MAXGHBUFFERSIZE_1 10
-
-#define MAXSTRING        256
-#define MINFILETYPE        1
-#define MAXFILETYPE        9
 
 #define ddebug             0
 
 #define debugString "#####"
 
-/* If we're not using GNU C, elide __attribute__ */
-#ifndef __GNUC__
-#  define  __attribute__(x)  /*NOTHING*/
+#ifdef USE_MPI
+void
+cdiAbortC_MPI(const char * caller, const char * filename,
+              const char *functionname, int line,
+              const char * errorString, va_list ap)
+  __attribute__((noreturn));
 #endif
 
-void pcdiAssert( bool, const char *, const char *, int );
-#define xassert(arg) do {                               \
-    if ((arg)) {                                        \
-    } else {                                            \
-      pcdiAssert(0, __FILE__, __func__, __LINE__ );     \
-    }                                                   \
-  } while(0)
+#ifdef USE_MPI
+static inline int
+callsToMPIAreAllowed()
+{
+  int init_flag = 0, finished_flag = 0;
+  return MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag
+    && MPI_Finalized(&finished_flag) == MPI_SUCCESS && !finished_flag;
+}
+
+static inline int
+getMPICommWorldRank()
+{
+  int rank = -1;
+  if (callsToMPIAreAllowed())
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  return rank;
+}
+#endif
 
 #ifdef USE_MPI
 #define xdebug(fmt, ...)                                                \
   if ( ddebug ){                                                        \
-    int rank;                                                           \
-    {                                                                   \
-      int init_flag;                                                    \
-      if (MPI_Initialized(&init_flag) == MPI_SUCCESS && init_flag)      \
-        MPI_Comm_rank ( MPI_COMM_WORLD, &rank );                        \
-      else                                                              \
-        rank = -1;                                                      \
-    }                                                                   \
+    int rank = getMPICommWorldRank();                                   \
     fprintf ( stderr, "%s pe%d in %s, %s, line %d: " fmt "\n",          \
               debugString, rank,  __func__, __FILE__,  __LINE__,        \
               __VA_ARGS__ );                                            \
@@ -80,13 +67,12 @@ void pcdiAssert( bool, const char *, const char *, int );
 
 
 #ifdef USE_MPI
-#define xdebug3(fmt, ...)					\
-  if ( ddebug == MAXDEBUG ){                                    \
-    int rank;                                                   \
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );                    \
-    fprintf ( stderr, "pe%d in %s, %s, line %d: " fmt "\n",     \
-              rank,  __func__, __FILE__,  __LINE__,             \
-              __VA_ARGS__ );                                    \
+#define xdebug3(fmt, ...)                                               \
+  if ( ddebug == MAXDEBUG ){                                            \
+    int rank = getMPICommWorldRank();                                   \
+    fprintf ( stderr, "pe%d in %s, %s, line %d: " fmt "\n",             \
+              rank,  __func__, __FILE__,  __LINE__,                     \
+              __VA_ARGS__ );                                            \
   }
 
 #else
@@ -97,25 +83,11 @@ void pcdiAssert( bool, const char *, const char *, int );
               __VA_ARGS__ );                                 \
   }
 #endif
-/*
-#ifdef USE_MPI
-char * outTextComm ( MPI_Comm * );
-
-#define xdebugComm(comm,fmt, ...)				\
-  if ( ddebug ){						\
-    fprintf ( stderr, "%s%s, %s, line %d%s: " fmt "\n",		\
-	      outTextRank (),  __func__, __FILE__,  __LINE__,	\
-	      outTextComm ( comm ),				\
-	      ## __VA_ARGS__  );				\
-    }
-#endif
-*/
 
 #ifdef USE_MPI
 #define xwarning(fmt, ...)						\
   if ( ddebug ){							\
-    int rank;								\
-    MPI_Comm_rank ( MPI_COMM_WORLD, &rank );				\
+    int rank = getMPICommWorldRank();                                   \
     fprintf ( stderr, "WARNING: pe%d in %s, %s, line %d: " fmt "\n",	\
               rank,  __func__, __FILE__,  __LINE__,			\
               __VA_ARGS__ );						\
@@ -129,14 +101,6 @@ char * outTextComm ( MPI_Comm * );
   }
 #endif
 
-void pcdiAbortC(const char *, const char *, const char *, int, const char *, ... )
-  __attribute__((noreturn));
-#define xabortC(caller, ...) pcdiAbortC(caller, __FILE__, __func__, __LINE__, __VA_ARGS__ )
-
-void pcdiAbort (const char *, const char *, int, const char *, ... )
-  __attribute__((noreturn));
-#define xabort(...) pcdiAbort(__FILE__, __func__, __LINE__, __VA_ARGS__ )
-
 void * pcdiXmalloc ( size_t, const char *, const char *, int );
 #define xmalloc(size) pcdiXmalloc ( size, __FILE__, __func__,  __LINE__ )
 
@@ -148,8 +112,12 @@ void * pcdiXrealloc ( void *, size_t, const char *, const char *, int );
 #define xrealloc(p,size) pcdiXrealloc(p, size,            \
                                       __FILE__, __func__, __LINE__)
 
-void pcdiXMPI ( int, const char *, int );
-#define xmpi(ret) pcdiXMPI ( ret, __FILE__, __LINE__ )
+void pcdiXMPI(int iret, const char *, int);
+#define xmpi(ret) do {                                  \
+    int tmpIRet = (ret);                                   \
+    if (tmpIRet != MPI_SUCCESS)                            \
+      pcdiXMPI(tmpIRet, __FILE__, __LINE__ );              \
+  } while(0)
 
 #ifdef USE_MPI
 void pcdiXMPIStat ( int, const char *, int, MPI_Status * );
@@ -187,8 +155,11 @@ void printArray ( const char *, char *, const void *, int, int, const char *, co
   if ( ddebug == MAXDEBUG )                                                         \
       printArray ( debugString, ps, array, n, datatype,  __func__, __FILE__, __LINE__ )
 
-
-void reshListPrint ( char * );
+/**
+ * @return number of dimensions
+ */
+int
+cdiPioQueryVarDims(int varShape[3], int vlistID, int varID);
 
 #endif
 /*
diff --git a/libcdi/src/resource_handle.c b/libcdi/src/resource_handle.c
index 6797886..0b68864 100644
--- a/libcdi/src/resource_handle.c
+++ b/libcdi/src/resource_handle.c
@@ -12,20 +12,14 @@
 #include "resource_handle.h"
 #include "pio_util.h"
 #include "namespace.h"
+#include "serialize.h"
 #include "cdi.h"
 #include "error.h"
 #include "file.h"
-
-#ifdef USE_MPI
-#include "pio_comm.h"
-#include "pio_rpc.h"
-#endif
-
+#include "resource_unpack.h"
 
 enum { MIN_LIST_SIZE = 128 };
 
-static int *listSizeAllocated;
-
 static void listInitialize(void);
 
 // ATTENTION: not thread safe yet, namespaces are set in model!
@@ -59,106 +53,103 @@ static int listInit = 0;
 
 typedef struct listElem {
   cdiResH       resH;//idx
-  struct listElem * next;
+  int next;
   resOps      * ops;
   void        * val;//ptr
   int           status;
 } listElem_t;
 
+static struct
+{
+  int size, freeHead;
+  listElem_t *resources;
+} *resHList;
 
-static listElem_t **listResources;
-static listElem_t **freeListHead;
+static int resHListSize = 0;
 
 /**************************************************************/
 
-static
-void listNew ( void )
+static void
+listInitResources(int nsp)
 {
-  int nnsp, i;
-
-  nnsp = namespaceGetNumber ();
-
-  listSizeAllocated = xcalloc ( nnsp, sizeof( listSizeAllocated[0]));
-  listResources     = xcalloc ( nnsp, sizeof( listResources[0]));
-  freeListHead      = xcalloc ( nnsp, sizeof( freeListHead[0]));
+  xassert(nsp < resHListSize && nsp >= 0);
+  int size = resHList[nsp].size = MIN_LIST_SIZE;
+  xassert(resHList[nsp].resources == NULL);
+  resHList[nsp].resources = xcalloc(MIN_LIST_SIZE, sizeof (listElem_t));
+  listElem_t *p = resHList[nsp].resources;
 
-  for ( i = 0; i < nnsp; i++ )
+  for (int i = 0; i < size; i++ )
     {
-      listSizeAllocated[i] = MIN_LIST_SIZE;
+      p[i].resH   = namespaceIdxEncode2(nsp, i);
+      p[i].next   = i + 1;
+      p[i].ops    = NULL;
+      p[i].val    = NULL;
+      p[i].status = RESH_UNDEFID;
+    }
 
-      xassert ( listResources[i] == NULL);
+  p[resHList[nsp].size-1].next = -1;
+  resHList[nsp].freeHead = 0;
+}
 
-      listResources[i] = xcalloc ( listSizeAllocated[i], sizeof ( listElem_t ));
+static inline void
+reshListClearEntry(int i)
+{
+  resHList[i].size = 0;
+  resHList[i].resources = NULL;
+  resHList[i].freeHead = -1;
+}
+
+void
+reshListCreate(int namespaceID)
+{
+  LIST_LOCK();
+  if (resHListSize <= namespaceID)
+    {
+      resHList = xrealloc(resHList, (namespaceID + 1) * sizeof (resHList[0]));
+      for (int i = resHListSize; i <= namespaceID; ++i)
+        reshListClearEntry(i);
+      resHListSize = namespaceID + 1;
     }
+  listInitResources(namespaceID);
+  LIST_UNLOCK();
 }
 
+
 /**************************************************************/
 
-static
-void listInitPointer ( void )
+void
+reshListDestruct(int namespaceID)
 {
-  int nnsp, i, j;
-
-  nnsp = namespaceGetNumber ();
-
-  for ( i = 0; i < nnsp; i++ )
+  LIST_LOCK();
+  xassert(resHList && namespaceID >= 0 && namespaceID < resHListSize);
+  int callerNamespaceID = namespaceGetActive();
+  pioNamespaceSetActive(namespaceID);
+  if (resHList[namespaceID].resources)
     {
-      for ( j = 0; j < listSizeAllocated[i]; j++ )
+      for ( int j = 0; j < resHList[namespaceID].size; j++ )
         {
-          listResources[i][j].resH   = namespaceIdxEncode2 ( i, j );
-          listResources[i][j].next   = listResources[i] + j + 1;
-          listResources[i][j].ops    = NULL;
-          listResources[i][j].val    = NULL;
-          listResources[i][j].status = RESH_UNDEFID;
+          listElem_t *listElem = resHList[namespaceID].resources + j;
+          if (listElem->val)
+            listElem->ops->valDestroy(listElem->val);
         }
-
-      listResources[i][listSizeAllocated[i]-1].next = NULL;
-
-      freeListHead[i] = listResources[i];
+      free(resHList[namespaceID].resources);
+      reshListClearEntry(namespaceID);
     }
+  if (resHList[callerNamespaceID].resources)
+    pioNamespaceSetActive(callerNamespaceID);
+  LIST_UNLOCK();
 }
 
-/**************************************************************/
 
-static
-void listDestroy ( void )
+static void listDestroy ( void )
 {
-  listElem_t * listElem;
-  int i, j, nnsp;
-
-  if ( listResources )
-    {
-      nnsp = namespaceGetNumber ();
-      for ( i = 0; i < nnsp; i++ )
-	{
-	  pioNamespaceSetActive ( i );
-          if ( listResources[i] )
-            {
-              if ( listSizeAllocated )
-                for ( j = 0; j < listSizeAllocated[i]; j++ )
-                  {
-                    listElem = listResources[i] + j;
-                    if  ( listElem->val )
-                      listElem->ops->valDestroy ( listElem->val );
-                  }
-              free ( listResources[i] );
-              listResources[i] = NULL;
-            }
-	}
-      free ( listResources );
-      listResources = NULL;
-    }
-
-  if ( freeListHead )
-    {
-      free ( freeListHead );
-      freeListHead = NULL;
-    }
-  if ( listSizeAllocated )
-    {
-      free ( listSizeAllocated );
-      listSizeAllocated = NULL;
-    }
+  LIST_LOCK();
+  for (int i = 0; i < resHListSize; ++i)
+    if (resHList[i].resources)
+      namespaceDelete(i);
+  free(resHList);
+  resHList = NULL;
+  LIST_UNLOCK();
 }
 
 /**************************************************************/
@@ -174,24 +165,18 @@ void listInitialize ( void )
   pthread_mutex_init ( &listMutex, &ma);
   pthread_mutexattr_destroy(&ma);
 #endif
-
-  listNew ();
+  // create default namespace
+  reshListCreate(0);
   /* file is special and has its own table, which needs to be
    * created, before we register the listDestroy exit handler */
   {
     int null_id;
-    null_id = fileOpen("/dev/null", "r");
+    null_id = fileOpen_serial("/dev/null", "r");
     if (null_id != -1)
-      fileClose(null_id);
+      fileClose_serial(null_id);
   }
   atexit ( listDestroy );
 
-  LIST_LOCK();
-
-  listInitPointer ();
-
-  LIST_UNLOCK();
-
 }
 
 /**************************************************************/
@@ -199,28 +184,26 @@ void listInitialize ( void )
 static
 void listSizeExtend()
 {
-  int newListSize;
-  int i, nsp;
-
-  nsp = namespaceGetActive ();
-
-  newListSize = listSizeAllocated[nsp] + MIN_LIST_SIZE;
+  int nsp = namespaceGetActive ();
+  int oldSize = resHList[nsp].size;
+  int newListSize = oldSize + MIN_LIST_SIZE;
 
-  listResources[nsp] =
-    xrealloc(listResources[nsp], newListSize * sizeof (listResources[0][0]));
+  resHList[nsp].resources =
+    xrealloc(resHList[nsp].resources,
+             newListSize * sizeof (resHList[0].resources[0]));
 
-  for ( i = listSizeAllocated[nsp]; i < newListSize; ++i )
+  for (int i = oldSize; i < newListSize; ++i)
     {
-      listResources[nsp][i].resH   = namespaceIdxEncode2 ( nsp, i );
-      listResources[nsp][i].next   = listResources[nsp] + i + 1;
-      listResources[nsp][i].ops    = NULL;
-      listResources[nsp][i].val    = NULL;
-      listResources[nsp][i].status = RESH_UNDEFID;
+      resHList[nsp].resources[i].resH   = namespaceIdxEncode2 ( nsp, i );
+      resHList[nsp].resources[i].next   = i + 1;
+      resHList[nsp].resources[i].ops    = NULL;
+      resHList[nsp].resources[i].val    = NULL;
+      resHList[nsp].resources[i].status = RESH_UNDEFID;
     }
 
-  listResources[nsp][newListSize-1].next = freeListHead[nsp];
-  freeListHead[nsp] = listResources[nsp] + listSizeAllocated[nsp];
-  listSizeAllocated[nsp] = newListSize;
+  resHList[nsp].resources[newListSize-1].next = resHList[nsp].freeHead;
+  resHList[nsp].freeHead = oldSize;
+  resHList[nsp].size = newListSize;
 }
 
 /**************************************************************/
@@ -238,10 +221,10 @@ int reshPut ( void *p, resOps *ops )
 
   nsp = namespaceGetActive ();
 
-  if ( !freeListHead[nsp] ) listSizeExtend();
-  newListElem               = freeListHead[nsp];
-  freeListHead[nsp]         = freeListHead[nsp]->next;
-  newListElem->next         = NULL;
+  if ( resHList[nsp].freeHead == -1) listSizeExtend();
+  newListElem               = resHList[nsp].resources + resHList[nsp].freeHead;
+  resHList[nsp].freeHead    = newListElem->next;
+  newListElem->next         = -1;
   resH                      = newListElem->resH;
   newListElem->val          = p;
   newListElem->ops          = ops;
@@ -269,27 +252,27 @@ void reshRemove ( cdiResH resH, resOps * ops )
 
   xassert ( nspT.nsp == nsp &&
             nspT.idx >= 0 &&
-            nspT.idx < listSizeAllocated[nsp] &&
-            listResources[nsp][nspT.idx].ops &&
-            listResources[nsp][nspT.idx].ops == ops );
+            nspT.idx < resHList[nsp].size &&
+            resHList[nsp].resources[nspT.idx].ops &&
+            resHList[nsp].resources[nspT.idx].ops == ops );
 
-  listResources[nsp][nspT.idx].next   = freeListHead[nsp];
-  listResources[nsp][nspT.idx].ops    = NULL;
-  listResources[nsp][nspT.idx].val    = NULL;
-  listResources[nsp][nspT.idx].status = RESH_UNDEFID;
-  freeListHead[nsp]                   = listResources[nsp] + nspT.idx;
+  resHList[nsp].resources[nspT.idx].next   = resHList[nsp].freeHead;
+  resHList[nsp].resources[nspT.idx].ops    = NULL;
+  resHList[nsp].resources[nspT.idx].val    = NULL;
+  resHList[nsp].resources[nspT.idx].status = RESH_UNDEFID;
+  resHList[nsp].freeHead                   = nspT.idx;
 
   LIST_UNLOCK();
 }
 
 /**************************************************************/
 
-void *reshGetValue(const char * caller, cdiResH resH, resOps * ops)
+static listElem_t *
+reshGetElem(const char *caller, cdiResH resH, resOps *ops)
 {
+  listElem_t *listElem;
   int nsp;
   namespaceTuple_t nspT;
-  listElem_t * listElem;
-
   xassert ( ops );
 
   LIST_INIT();
@@ -300,22 +283,30 @@ void *reshGetValue(const char * caller, cdiResH resH, resOps * ops)
 
   nspT = namespaceResHDecode ( resH );
 
-  if ( nspT.nsp == nsp &&
-       nspT.idx >= 0 && nspT.idx < listSizeAllocated[nsp] )
+  if (nspT.nsp == nsp &&
+      nspT.idx >= 0 &&
+      nspT.idx < resHList[nsp].size)
     {
-      listElem = listResources[nsp] + nspT.idx;
+      listElem = resHList[nsp].resources + nspT.idx;
       LIST_UNLOCK();
     }
   else
     {
       LIST_UNLOCK();
-      xabortC(caller, "Invalid namespace %d or index %d for resource handle %d!", nspT.nsp, nspT.idx, (int)resH);
+      xabortC(caller, "Invalid namespace %d or index %d for resource handle %d when using namespace %d of size %d!",
+              nspT.nsp, nspT.idx, (int)resH, nsp, resHList[nsp].size);
     }
 
   if ( !(listElem && listElem->ops == ops) )
-    xabortC(caller, "Invalid resource handle %d, list element not found!", (int)resH);
+    xabortC(caller, "Invalid resource handle %d, list element not found!",
+            (int)resH);
+  return listElem;
+}
 
-  return listElem->val;
+
+void *reshGetValue(const char * caller, cdiResH resH, resOps * ops)
+{
+  return reshGetElem(caller, resH, ops)->val;
 }
 
 /**************************************************************/
@@ -332,9 +323,9 @@ void reshGetResHListOfType ( int c, int * resHs, resOps * ops )
 
   nsp = namespaceGetActive ();
 
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val && listResources[nsp][i].ops )
-      if ( listResources[nsp][i].ops == ops )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val && resHList[nsp].resources[i].ops )
+      if ( resHList[nsp].resources[i].ops == ops )
         {
           resHs[j++] = namespaceIdxEncode2 ( nsp, i );
           if ( j == c ) break;
@@ -343,6 +334,52 @@ void reshGetResHListOfType ( int c, int * resHs, resOps * ops )
   LIST_UNLOCK();
 }
 
+enum cdiApplyRet
+cdiResHApply(enum cdiApplyRet (*func)(int id, void *res, const resOps *p,
+                                      void *data), void *data)
+{
+  xassert(func);
+
+  LIST_INIT();
+
+  LIST_LOCK();
+
+  int nsp = namespaceGetActive ();
+  enum cdiApplyRet ret = CDI_APPLY_GO_ON;
+  for (int i = 0; i < resHList[nsp].size && ret > 0; ++i)
+    if (resHList[nsp].resources[i].val && resHList[nsp].resources[i].ops)
+      ret = func(namespaceIdxEncode2(nsp, i), resHList[nsp].resources[i].val,
+                 resHList[nsp].resources[i].ops, data);
+  LIST_UNLOCK();
+  return ret;
+}
+
+
+enum cdiApplyRet
+cdiResHFilterApply(const resOps *p,
+                   enum cdiApplyRet (*func)(int id, void *res, void *data),
+                   void *data)
+{
+  xassert(p && func);
+
+  LIST_INIT();
+
+  LIST_LOCK();
+
+  int nsp = namespaceGetActive ();
+  enum cdiApplyRet ret = CDI_APPLY_GO_ON;
+  for (int i = 0; i < resHList[nsp].size && ret > 0; ++i)
+    if (resHList[nsp].resources[i].val && resHList[nsp].resources[i].ops
+        && resHList[nsp].resources[i].ops == p)
+      ret = func(namespaceIdxEncode2(nsp, i), resHList[nsp].resources[i].val,
+                 data);
+  LIST_UNLOCK();
+  return ret;
+}
+
+
+
+
 /**************************************************************/
 
 int reshCountType ( resOps * ops )
@@ -357,9 +394,9 @@ int reshCountType ( resOps * ops )
 
   nsp = namespaceGetActive ();
 
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val )
-      if ( listResources[nsp][i].ops == ops )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val )
+      if ( resHList[nsp].resources[i].ops == ops )
         countType++;
 
   LIST_UNLOCK();
@@ -369,32 +406,43 @@ int reshCountType ( resOps * ops )
 
 /**************************************************************/
 
-#ifdef USE_MPI
-static
-int  getPackBufferSize ( MPI_Comm comm )
+int
+reshResourceGetPackSize(int resH, resOps *ops, void *context)
+{
+  listElem_t *curr = reshGetElem(__func__, resH, ops);
+  return curr->ops->valGetPackSize(curr->val, context);
+}
+
+void
+reshPackResource(int resH, resOps *ops,
+                 void *buf, int buf_size, int *position, void *context)
+{
+  listElem_t *curr = reshGetElem(__func__, resH, ops);
+  curr->ops->valPack(curr->val, buf, buf_size, position, context);
+}
+
+
+static int getPackBufferSize(void *context)
 {
   int nsp, i;
-  int packBufferSize = 0;
-  int intpacksize;
+  int intpacksize, packBufferSize = 0;
   listElem_t * curr;
 
   nsp = namespaceGetActive ();
 
-  xmpi ( MPI_Pack_size ( 1, MPI_INT, comm, &intpacksize ));
-
   /* pack start marker, namespace and sererator marker */
-  packBufferSize += 3 * intpacksize;
+  packBufferSize += (intpacksize = serializeGetSize(3, DATATYPE_INT, context));
 
   /* pack resources, type marker and seperator marker */
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val )
-      if ( listResources[nsp][i].status == ASSIGNED )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val )
+      if ( resHList[nsp].resources[i].status == ASSIGNED )
         {
-          curr = listResources[nsp] + i;
+          curr = resHList[nsp].resources + i;
           xassert ( curr->ops );
 
           /* message plus frame of 2 ints */
-          packBufferSize += curr->ops->valGetPackSize ( curr->val, comm )
+          packBufferSize += curr->ops->valGetPackSize(curr->val, context)
             + 2 * intpacksize;
         }
 
@@ -413,9 +461,9 @@ void reshPackBufferDestroy ( char ** buffer )
 
 /**************************************************************/
 
-void reshPackBufferCreate ( char ** packBuffer, int * packBufferSize, MPI_Comm comm )
+void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
 {
-  int i, nsp, packBufferPos = 0;
+  int i, packBufferPos = 0;
   int start = START, end = END, sep = SEPARATOR, type;
   listElem_t * curr;
 
@@ -423,54 +471,42 @@ void reshPackBufferCreate ( char ** packBuffer, int * packBufferSize, MPI_Comm c
 
   LIST_LOCK();
 
-  nsp = namespaceGetActive ();
-
-  * packBufferSize = getPackBufferSize ( comm );
-  * packBuffer = xcalloc ( 1, * packBufferSize );
-
-  xmpi ( MPI_Pack ( &start, 1,  MPI_INT,
-		    * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  int nsp = namespaceGetActive ();
 
-  xmpi ( MPI_Pack ( &nsp, 1,  MPI_INT,
-		    * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  int pBSize = *packBufferSize = getPackBufferSize(context);
+  char *pB = *packBuffer = xcalloc(1, *packBufferSize);
 
-  xmpi ( MPI_Pack ( &sep, 1,  MPI_INT,
-		    * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  {
+    int header[3] = { start, nsp, sep };
+    serializePack(header, 3,  DATATYPE_INT, pB, pBSize, &packBufferPos, context);
+  }
 
-  for ( i = 0; i < listSizeAllocated[nsp]; i++ )
-    if ( listResources[nsp][i].val )
-      if ( listResources[nsp][i].status == ASSIGNED )
+  for ( i = 0; i < resHList[nsp].size; i++ )
+    if ( resHList[nsp].resources[i].val )
+      if ( resHList[nsp].resources[i].status == ASSIGNED )
         {
-          curr = listResources[nsp] + i;
+          curr = resHList[nsp].resources + i;
           xassert ( curr->ops );
 
           type = curr->ops->valTxCode ();
 
           if ( ! type ) continue;
 
-          xmpi ( MPI_Pack ( &type, 1, MPI_INT, * packBuffer,
-			    * packBufferSize, &packBufferPos, comm ));
+          serializePack( &type, 1, DATATYPE_INT, * packBuffer,
+			    * packBufferSize, &packBufferPos, context);
 
-          curr->ops->valPack ( curr->val,
-                               * packBuffer ,
-                               * packBufferSize,
-                               &packBufferPos,
-                               comm );
+          curr->ops->valPack(curr->val, pB, pBSize, &packBufferPos, context);
 
-          xmpi ( MPI_Pack ( &sep, 1,  MPI_INT, * packBuffer,
-			    * packBufferSize, &packBufferPos, comm ));
+          serializePack(&sep, 1, DATATYPE_INT, pB, pBSize, &packBufferPos, context);
 
           curr->status = CLOSED;
         }
 
   LIST_UNLOCK();
 
-  xmpi ( MPI_Pack ( &end, 1,  MPI_INT,
-                  * packBuffer, * packBufferSize, &packBufferPos, comm ));
+  serializePack(&end, 1,  DATATYPE_INT, pB, pBSize, &packBufferPos, context);
 }
 
-#endif
-
 /**************************************************************/
 
 /* for thread safety this feature would have to be integrated in reshPut */
@@ -493,9 +529,9 @@ void reshSetStatus ( cdiResH resH, resOps * ops, int status )
 
   xassert ( nspT.nsp == nsp &&
             nspT.idx >= 0 &&
-            nspT.idx < listSizeAllocated[nsp] );
+            nspT.idx < resHList[nsp].size );
 
-  listElem = listResources[nsp] + nspT.idx;
+  listElem = resHList[nsp].resources + nspT.idx;
 
   xassert ( listElem &&
             listElem->ops == ops );
@@ -525,9 +561,9 @@ int reshGetStatus ( cdiResH resH, resOps * ops )
 
   xassert ( nspT.nsp == nsp &&
             nspT.idx >= 0 &&
-            nspT.idx < listSizeAllocated[nsp] );
+            nspT.idx < resHList[nsp].size );
 
-  listElem = listResources[nsp] + nspT.idx;
+  listElem = resHList[nsp].resources + nspT.idx;
 
   LIST_UNLOCK();
 
@@ -555,99 +591,80 @@ void reshUnlock ()
 
 int reshListCompare ( int nsp0, int nsp1 )
 {
-  const int equal  = 0;
-#ifdef USE_MPI
-  const int differ = -1;
-  int i, valCompare;
-  listElem_t * listElem0, * listElem1;
+  int valCompare = 0;
+  int i;
 
 
   LIST_INIT();
+  LIST_LOCK();
 
-  xassert(namespaceGetNumber () > xmaxInt ( nsp0, nsp1 ) &&
+  xassert(resHListSize > xmaxInt ( nsp0, nsp1 ) &&
           xminInt ( nsp0, nsp1 ) >= 0 );
 
-  for ( i = 0; i < listSizeAllocated[nsp0]; i++ )
+  for ( i = 0; i < resHList[nsp0].size; i++ )
     {
-      listElem0 = listResources[nsp0] + i;
+      listElem_t *listElem0 = resHList[nsp0].resources + i,
+        *listElem1 = resHList[nsp1].resources + i;
       if ( listElem0->val )
 	{
-	  if ( i >= listSizeAllocated[nsp1] )
+	  if ( i >= resHList[nsp1].size )
 	    {
-	      xdebug("%s", "");
-	      return differ;
+              valCompare = 1;
+	      xdebug("%s %d", "namespace active length mismatch at resource",
+                     i);
+	      break;
 	    }
 
-	  listElem1 = listResources[nsp1] + i;
 	  if ( !listElem1->val )
 	    {
-	      xdebug("%s", "");
-	      return differ;
+              valCompare = 1;
+	      xdebug("%s %d", "namespace occupation mismatch at resource", i);
+              break;
 	    }
 
-	  xassert ( listElem0->ops && listElem1->ops );
-	  if ( listElem0->ops != listElem1->ops )
+	  if ( listElem0->ops != listElem1->ops || listElem0->ops == NULL )
 	    {
-	      xdebug("%s", "");
-	      return differ;
+              valCompare = 1;
+	      xdebug("%s %d", "resource type mismatch at resource", i);
+              break;
 	    }
 
-	  valCompare =  listElem0->ops->valCompare ( listElem0->val, listElem1->val );
-	  printf ( "type %d, values resH0=%d and resH1=%d %s\n", 
-		   listElem0->ops->valTxCode (), 
-		   listElem0->resH, 
-		   listElem1->resH,
-		   valCompare == equal ? "are equal" : "differ" );
-	  if ( valCompare != equal ) return differ;
+	  valCompare = listElem0->ops->valCompare(listElem0->val,
+                                                  listElem1->val);
+          if (valCompare)
+            break;
 	}
-      else if ( listResources[nsp1][i].val )
-	return differ;
+      else if ( listElem1->val )
+        {
+          valCompare = 1;
+          xdebug("namespace 1 has value at empty place %d of namespace 0",
+                 i);
+          break;
+        }
     }
 
-  for ( ; i < listSizeAllocated[nsp1]; i++ )
-    if ( listResources[nsp1][i].val )
-      {
-	xdebug("%s", "");
-	return differ;
-      }
+  if (!valCompare)
+    {
+      for ( ; i < resHList[nsp1].size; i++ )
+        valCompare = valCompare || resHList[nsp1].resources[i].val != NULL;
+      if (valCompare)
+        xdebug("%s", "extra elements in second namespace");
+    }
 
-#endif
+  LIST_UNLOCK();
 
-  return equal;
+  return valCompare;
 }
 
 /**************************************************************/
 
-void reshListPrint ( char * filename )
+void reshListPrint(FILE *fp)
 {
   int i, j, temp;
   listElem_t * curr;
-  FILE * fp;
 
   LIST_INIT();
 
-#ifdef USE_MPI
-  {
-    int root = 0;
-    if ( commInqIsProcIO () == 0 )
-      {
-        if (  commInqRankModel () != root )  return;
-      }
-    else if ( commInqRankPio () != root ) return;
-  }
-#endif
-
-  if ( filename )
-    {
-      fp = fopen ( filename, "w" );
-      if ( ! fp )
-	{
-	  xdebug("%s", "could not open file" );
-	  fp = stdout;
-	}
-    }
-  else
-    fp = stdout;
 
   temp = namespaceGetActive ();
 
@@ -665,11 +682,11 @@ void reshListPrint ( char * filename )
       fprintf ( fp, "#\n" );
       fprintf ( fp, "##################################\n\n" );
 
-      fprintf ( fp, "listSizeAllocated[%d]=%d\n", i, listSizeAllocated[i] );
+      fprintf ( fp, "resHList[%d].size=%d\n", i, resHList[i].size );
 
-      for ( j = 0; j < listSizeAllocated[i]; j++ )
+      for ( j = 0; j < resHList[i].size; j++ )
         {
-          curr = listResources[i] + j;
+          curr = resHList[i].resources + j;
           if ( curr->ops && curr->val )
             {
               curr->ops->valPrint (( void * ) curr->val, fp );
@@ -680,23 +697,10 @@ void reshListPrint ( char * filename )
   fprintf ( fp, "#\n#  end global resource list" \
             "\n#\n##########################################\n\n" );
 
-  fclose ( fp );;
   pioNamespaceSetActive ( temp );
 }
 
 
-void cdiReset(void)
-{
-  LIST_LOCK();
-
-  listDestroy();
-
-  listNew ();
-
-  listInitPointer ();
-
-  LIST_UNLOCK();
-}
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/resource_handle.h b/libcdi/src/resource_handle.h
index d352966..b93b6c2 100644
--- a/libcdi/src/resource_handle.h
+++ b/libcdi/src/resource_handle.h
@@ -5,10 +5,7 @@
 #include "config.h"
 #endif
 
-#ifdef USE_MPI
-#include <mpi.h>
-#include <stdlib.h>
-#endif
+#include <stdio.h>
 
 /*
  * CDI internal handling of resource handles given to user code
@@ -23,25 +20,23 @@ typedef int cdiResH;
 typedef int    ( * valCompareFunc     )( void *, void * );
 typedef void   ( * valDestroyFunc     )( void * );
 typedef void   ( * valPrintFunc       )( void *, FILE * );
-#ifdef USE_MPI
-typedef int    ( * valGetPackSizeFunc )( void *, MPI_Comm comm );
-typedef void   ( * valPackFunc        )( void *, void *buf, int size, int *pos, MPI_Comm comm );
+typedef int    ( * valGetPackSizeFunc )( void *, void *context );
+typedef void   ( * valPackFunc        )( void *, void *buf, int size, int *pos, void *context );
 typedef int    ( * valTxCodeFunc      )( void );
-#endif
 
 typedef struct {
   valCompareFunc     valCompare;
   valDestroyFunc     valDestroy;
   valPrintFunc       valPrint;
-#ifdef USE_MPI
   valGetPackSizeFunc valGetPackSize;
   valPackFunc        valPack;
   valTxCodeFunc      valTxCode;
-#endif
 }resOps;
 
 enum { RESH_UNDEFID, ASSIGNED, SUSPENDED, CLOSED };
 
+void   reshListCreate(int namespaceID);
+void   reshListDestruct(int namespaceID);
 int    reshPut ( void *, resOps * );
 void   reshRemove ( cdiResH, resOps * );
 
@@ -52,16 +47,32 @@ void * reshGetValue(const char *, cdiResH, resOps * );
 
 void   reshGetResHListOfType ( int, int *, resOps * );
 
-#ifdef USE_MPI
-void   reshPackBufferCreate ( char **, int *, MPI_Comm );
-void   reshPackBufferDestroy ( char ** );
-#endif
+enum cdiApplyRet {
+  CDI_APPLY_ERROR = -1,
+  CDI_APPLY_STOP,
+  CDI_APPLY_GO_ON,
+};
+enum cdiApplyRet
+cdiResHApply(enum cdiApplyRet (*func)(int id, void *res, const resOps *p,
+                                      void *data), void *data);
+enum cdiApplyRet
+cdiResHFilterApply(const resOps *p,
+                   enum cdiApplyRet (*func)(int id, void *res,
+                                            void *data),
+                   void *data);
 
+void   reshPackBufferCreate ( char **, int *, void *context );
+void   reshPackBufferDestroy ( char ** );
+int    reshResourceGetPackSize(int resh, resOps *ops, void *context);
+void   reshPackResource(int resh, resOps *ops,
+                        void *buf, int buf_size, int *position, void *context);
 void   reshSetStatus ( cdiResH, resOps *, int );
 int    reshGetStatus ( cdiResH, resOps * );
 
 void   reshLock   ( void );
 void   reshUnlock ( void );
+int reshListCompare(int nsp0, int nsp1);
+void reshListPrint(FILE *fp);
 
 #endif
 /*
diff --git a/libcdi/src/resource_unpack.c b/libcdi/src/resource_unpack.c
new file mode 100644
index 0000000..1e44ece
--- /dev/null
+++ b/libcdi/src/resource_unpack.c
@@ -0,0 +1,108 @@
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "cdi.h"
+#include "pio_util.h"
+#include "institution.h"
+#include "model.h"
+#include "cdi_int.h"
+#include "vlist.h"
+#include "namespace.h"
+#include "serialize.h"
+#include "resource_unpack.h"
+#include "taxis.h"
+
+extern void   gridUnpack ( char *, int, int *, int, void *context);
+extern void  zaxisUnpack ( char *, int, int *, int, void *context);
+extern int streamNint;
+
+
+/*****************************************************************************/
+
+
+
+void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
+                         void *context)
+{
+  int token1, token2, nspTarget;
+  int unpackBufferPos = 0;
+  int numAssociations = 0, sizeAssociations = 16;
+  struct streamAssoc *associations
+    = xmalloc(sizeof (associations[0]) * sizeAssociations);
+
+  while ( unpackBufferPos < unpackBufferSize )
+    {
+      serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      &token1, 1, DATATYPE_INT, context);
+
+      if (token1 == END)
+        break;
+      switch (token1)
+	{
+	case START:
+	  serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                          &nspTarget, 1, DATATYPE_INT, context);
+	  break;
+	case GRID:
+	  gridUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                     nspTarget, context );
+	  break;
+	case ZAXIS:
+	  zaxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context);
+	  break;
+	case TAXIS:
+	  taxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context, 1);
+	  break;
+	case INSTITUTE:
+          instituteUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                          nspTarget, context);
+	  break;
+	case MODEL:
+          modelUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context);
+	  break;
+	case STREAM:
+          if (sizeAssociations == numAssociations)
+            associations
+              = xrealloc(associations,
+                         sizeof (associations[0]) * (sizeAssociations *= 2));
+	  associations[numAssociations]
+            = streamUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                           nspTarget, context);
+          ++numAssociations;
+	  break;
+	case VLIST:
+          vlistUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                      nspTarget, context);
+	  break;
+	default:
+	  xabort ( "TOKEN MAPS NO VALID DATATYPE" );
+	}
+
+      serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+                       &token2, 1, DATATYPE_INT, context);
+      xassert ( token2 == SEPARATOR );
+    }
+  for (int i = 0; i < numAssociations; ++i)
+    {
+      cdiStreamSetupVlist(stream_to_pointer(associations[i].streamID),
+                          namespaceAdaptKey(associations[i].vlistID,
+                                            nspTarget),
+                          namespaceAdaptKey(associations[i].vlistIDorig,
+                                            nspTarget));
+    }
+  free(associations);
+}
+
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
diff --git a/libcdi/src/resource_unpack.h b/libcdi/src/resource_unpack.h
new file mode 100644
index 0000000..87ddb59
--- /dev/null
+++ b/libcdi/src/resource_unpack.h
@@ -0,0 +1,26 @@
+#ifndef RESOURCE_UNPACK_H
+#define RESOURCE_UNPACK_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+enum
+{ GRID      = 1,
+  ZAXIS     = 2,
+  TAXIS     = 3,
+  INSTITUTE = 4,
+  MODEL     = 5,
+  STREAM    = 6,
+  VLIST     = 7,
+  START     = 55555555,
+  SEPARATOR = 66666666,
+  DATATOKEN = 77777777,
+  FUNCCALL  = 88888888,
+  END       = 99999999
+};
+
+void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
+                         void *context);
+
+#endif
diff --git a/libcdi/src/serialize.c b/libcdi/src/serialize.c
new file mode 100644
index 0000000..f1125df
--- /dev/null
+++ b/libcdi/src/serialize.c
@@ -0,0 +1,88 @@
+#include <inttypes.h>
+#include <limits.h>
+
+#include "cdi.h"
+#include "serialize.h"
+#include "namespace.h"
+#include "pio_util.h"
+
+int
+serializeGetSize(int count, int datatype, void *context)
+{
+  int (*serialize_get_size_p)(int count, int datatype, void *context)
+    = (int (*)(int, int, void *))
+    namespaceSwitchGet(NSSWITCH_SERIALIZE_GET_SIZE).func;
+  return serialize_get_size_p(count, datatype, context);
+}
+
+void serializePack(void *data, int count, int datatype,
+                    void *buf, int buf_size, int *position, void *context)
+{
+  void (*serialize_pack_p)(void *data, int count, int datatype,
+                           void *buf, int buf_size, int *position, void *context)
+    = (void (*)(void *, int, int, void *, int, int *, void *))
+    namespaceSwitchGet(NSSWITCH_SERIALIZE_PACK).func;
+  serialize_pack_p(data, count, datatype, buf, buf_size, position, context);
+}
+
+void serializeUnpack(void *buf, int buf_size, int *position,
+                      void *data, int count, int datatype, void *context)
+{
+  void (*serialize_unpack_p)(void *buf, int buf_size, int *position,
+                             void *data, int count, int datatype, void *context)
+    = (void (*)(void *, int, int *, void *, int, int, void *))
+    namespaceSwitchGet(NSSWITCH_SERIALIZE_UNPACK).func;
+  serialize_unpack_p(buf, buf_size, position, data, count, datatype, context);
+}
+
+
+
+int
+serializeGetSizeInCore(int count, int datatype, void *context)
+{
+  int elemSize;
+  switch (datatype)
+  {
+  case DATATYPE_INT8:
+    elemSize = sizeof (int8_t);
+    break;
+  case DATATYPE_INT16:
+    elemSize = sizeof (int16_t);
+    break;
+  case DATATYPE_INT:
+    elemSize = sizeof (int);
+    break;
+  case DATATYPE_FLT64:
+    elemSize = sizeof (double);
+    break;
+  case DATATYPE_TXT:
+  case DATATYPE_UCHAR:
+    elemSize = 1;
+    break;
+  default:
+    xabort("Unexpected datatype");
+  }
+  return count * elemSize;
+}
+
+void serializePackInCore(void *data, int count, int datatype,
+                          void *buf, int buf_size, int *position, void *context)
+{
+  int size = serializeGetSize(count, datatype, context);
+  int pos = *position;
+  xassert(INT_MAX - pos >= size);
+  memcpy((unsigned char *)buf + pos, data, (size_t)size);
+  pos += size;
+  *position = pos;
+}
+
+void serializeUnpackInCore(void *buf, int buf_size, int *position,
+                            void *data, int count, int datatype, void *context)
+{
+  int size = serializeGetSize(count, datatype, context);
+  int pos = *position;
+  xassert(INT_MAX - pos >= size);
+  memcpy(data, (unsigned char *)buf + pos, (size_t)size);
+  pos += size;
+  *position = pos;
+}
diff --git a/libcdi/src/serialize.h b/libcdi/src/serialize.h
new file mode 100644
index 0000000..b7fcb64
--- /dev/null
+++ b/libcdi/src/serialize.h
@@ -0,0 +1,32 @@
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifndef SERIALIZE_H
+#define SERIALIZE_H
+
+#include "cdi.h"
+
+/*
+ * Generic interfaces for (de-)marshalling
+ */
+int serializeGetSize(int count, int datatype, void *context);
+void serializePack(void *data, int count, int datatype,
+                   void *buf, int buf_size, int *position, void *context);
+void serializeUnpack(void *buf, int buf_size, int *position,
+                     void *data, int count, int datatype, void *context);
+
+/*
+ * top-level de-marshalling function
+ */
+
+/*
+ * Interfaces for marshalling within a single memory domain
+ */
+int serializeGetSizeInCore(int count, int datatype, void *context);
+void serializePackInCore(void *data, int count, int datatype,
+                          void *buf, int buf_size, int *position, void *context);
+void serializeUnpackInCore(void *buf, int buf_size, int *position,
+                            void *data, int count, int datatype, void *context);
+
+#endif
diff --git a/libcdi/src/stream.c b/libcdi/src/stream.c
index c75ad98..e014244 100644
--- a/libcdi/src/stream.c
+++ b/libcdi/src/stream.c
@@ -39,7 +39,8 @@ extern resOps streamOps;
 FILE *popen(const char *command, const char *type);
 int pclose(FILE *stream);
 
-void cdiPrintDefaults(void)
+static void
+cdiPrintDefaults(void)
 {
   fprintf (stderr, "default instID     :  %d\n", cdiDefaultInstID);
   fprintf (stderr, "default modelID    :  %d\n", cdiDefaultModelID);
@@ -524,7 +525,7 @@ int streamInqByteorder(int streamID)
 
 char *streamFilesuffix(int filetype)
 {
-  static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc2", ".nc4", ".nc4", ".srv", ".ext", ".ieg", ".h5"};
+  static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc", ".nc4", ".nc4", ".srv", ".ext", ".ieg"};
   int size = (int) (sizeof(fileSuffix)/sizeof(char *));
 
   if ( filetype > 0 && filetype < size )
@@ -644,132 +645,129 @@ int cdiInqContents(stream_t * streamptr)
   return (status);
 }
 
-
-int streamOpen(const char *filename, const char *filemode, int filetype)
+int cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
+                                 int filetype, stream_t *streamptr,
+                                 int recordBufIsToBeCreated)
 {
-  int fileID = CDI_UNDEFID;
-  int streamID = CDI_ESYSTEM;
-  int status;
-  Record *record = NULL;
-  stream_t *streamptr = NULL;
-  int hasLocalFile = namespaceHasLocalFile ( namespaceGetActive ());
-
-  if ( CDI_Debug )
-    Message("Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
-
-  if ( ! filename || ! filemode || filetype < 0 ) return (CDI_EINVAL);
-
-  xdebug("START, filename = %s, filemode = %s, filetype = %d, "
-         "namespaceHasLocalFile(%d)=%s",
-         filename, filemode, filetype, namespaceGetActive(),
-	 namespaceHasLocalFile ( namespaceGetActive ()) ? "true":"false");
-
-  if ( hasLocalFile )
+  int fileID;
+  switch (filetype)
     {
-      switch (filetype)
-	{
 #if  defined  (HAVE_LIBGRIB)
-	case FILETYPE_GRB:
-	case FILETYPE_GRB2:
-	  {
-	    fileID = gribOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-            xdebug("%s OPENED, fileID=%d", filename, fileID);
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    break;
-	  }
+    case FILETYPE_GRB:
+    case FILETYPE_GRB2:
+      {
+        fileID = gribOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBSERVICE)
-	case FILETYPE_SRV:
-	  {
-	    fileID = fileOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    record->srvp   = srvNew();
-	    break;
-	  }
+    case FILETYPE_SRV:
+      {
+        fileID = fileOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+            streamptr->record->srvp   = srvNew();
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBEXTRA)
-	case FILETYPE_EXT:
-	  {
-	    fileID = fileOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    record->extp   = extNew();
-	    break;
-	  }
+    case FILETYPE_EXT:
+      {
+        fileID = fileOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+            streamptr->record->extp   = extNew();
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBIEG)
-	case FILETYPE_IEG:
-	  {
-	    fileID = fileOpen(filename, filemode);
-            if ( fileID < 0 ) fileID = CDI_ESYSTEM;
-	    record = (Record *) malloc(sizeof(Record));
-	    record->buffer = NULL;
-	    record->iegp   = iegNew();
-	    break;
-	  }
+    case FILETYPE_IEG:
+      {
+        fileID = fileOpen(filename, filemode);
+        if ( fileID < 0 ) fileID = CDI_ESYSTEM;
+        if (recordBufIsToBeCreated)
+          {
+            streamptr->record = (Record *) malloc(sizeof(Record));
+            streamptr->record->buffer = NULL;
+            streamptr->record->iegp   = iegNew();
+          }
+        break;
+      }
 #endif
 #if  defined  (HAVE_LIBNETCDF)
-	case FILETYPE_NC:
-	  {
-	    fileID = cdfOpen(filename, filemode);
-	    break;
-	  }
-	case FILETYPE_NC2:
-	  {
-	    fileID = cdfOpen64(filename, filemode);
-	    break;
-	  }
-	case FILETYPE_NC4:
-	case FILETYPE_NC4C:
-	  {
-	    fileID = cdf4Open(filename, filemode, &filetype);
-	    break;
-	  }
-#endif
-	default:
-	  {
-	    if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
-	    return (CDI_ELIBNAVAIL);
-	  }
-	}
-    }
-#ifdef USE_MPI
-  else if ( tolower ( * filemode ) == 'w' )
-    {
-      statusCode nspStatus = namespaceInqResStatus ();
-      switch ( nspStatus )
-        {
-        case STAGE_DEFINITION:
-          break;
-        case STAGE_TIMELOOP:
-          pioBufferFuncCall(STREAMOPEN, 2, filename, filetype);
-          break;
-        case STAGE_CLEANUP:
-          xabort ( "TRANSITION TO IO PROCESSES ALREADY FINISHED." );
+    case FILETYPE_NC:
+      {
+        fileID = cdfOpen(filename, filemode);
         break;
-        default:
-          xabort ( "INTERNAL ERROR" );
-        }
-    }
+      }
+    case FILETYPE_NC2:
+      {
+        fileID = cdfOpen64(filename, filemode);
+        break;
+      }
+    case FILETYPE_NC4:
+    case FILETYPE_NC4C:
+      {
+        fileID = cdf4Open(filename, filemode, &filetype);
+        break;
+      }
 #endif
+    default:
+      {
+        if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
+        return (CDI_ELIBNAVAIL);
+      }
+    }
+  return fileID;
+}
+
+
+int streamOpen(const char *filename, const char *filemode, int filetype)
+{
+  int fileID = CDI_UNDEFID;
+  int streamID = CDI_ESYSTEM;
+  int status;
+  stream_t *streamptr = stream_new_entry();
 
-  if ( fileID < 0 && hasLocalFile )
+  if ( CDI_Debug )
+    Message("Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
+
+  if ( ! filename || ! filemode || filetype < 0 ) return (CDI_EINVAL);
+
+  {
+    int (*streamOpenDelegate)(const char *filename, const char *filemode,
+                              int filetype, stream_t *streamptr)
+      = (int (*)(const char *, const char *, int, stream_t *))
+      namespaceSwitchGet(NSSWITCH_STREAM_OPEN_BACKEND).func;
+    fileID = streamOpenDelegate(filename, filemode, filetype, streamptr);
+  }
+
+  if (fileID < 0)
     {
+      free(streamptr->record);
+      stream_delete_entry(streamptr);
       streamID = fileID;
     }
   else
     {
-      streamptr = stream_new_entry();
       streamID  = streamptr->self;
 
       if ( streamID < 0 ) return (CDI_ELIMIT);
 
-      streamptr->record   = record;
       streamptr->filetype = filetype;
       streamptr->filemode = tolower(*filemode);
       streamptr->filename = strdupx(filename);
@@ -795,87 +793,29 @@ int streamOpen(const char *filename, const char *filemode, int filetype)
 }
 
 
-int streamOpenA(const char *filename, const char *filemode, int filetype)
+static int streamOpenA(const char *filename, const char *filemode, int filetype)
 {
   int fileID = CDI_UNDEFID;
   int streamID = CDI_ESYSTEM;
   int status;
   Record *record = NULL;
-  stream_t *streamptr = NULL;
+  stream_t *streamptr = stream_new_entry();
 
   if ( CDI_Debug )
     Message("Open %s mode %c file %s", strfiletype(filetype), (int) *filemode, filename);
 
   if ( ! filename || ! filemode || filetype < 0 ) return (CDI_EINVAL);
 
-  switch (filetype)
-    {
-#if  defined  (HAVE_LIBGRIB)
-    case FILETYPE_GRB:
-    case FILETYPE_GRB2:
-      {
-        fileID = gribOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBSERVICE)
-    case FILETYPE_SRV:
-      {
-        fileID = fileOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	record->srvp   = srvNew();
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBEXTRA)
-    case FILETYPE_EXT:
-      {
-        fileID = fileOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	record->extp   = extNew();
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBIEG)
-    case FILETYPE_IEG:
-      {
-        fileID = fileOpen(filename, "r");
-	record = (Record *) malloc(sizeof(Record));
-	record->buffer = NULL;
-	record->iegp   = iegNew();
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBNETCDF)
-    case FILETYPE_NC:
-      {
-	fileID = cdfOpen(filename, "r");
-	break;
-      }
-    case FILETYPE_NC2:
-      {
-	fileID = cdfOpen64(filename, "r");
-	break;
-      }
-    case FILETYPE_NC4:
-    case FILETYPE_NC4C:
-      {
-	fileID = cdf4Open(filename, "r", &filetype);
-	break;
-      }
-#endif
-    default:
-      {
-	if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
-	return (CDI_ELIBNAVAIL);
-      }
-    }
+  {
+    int (*streamOpenDelegate)(const char *filename, const char *filemode,
+                              int filetype, stream_t *streamptr)
+      = (int (*)(const char *, const char *, int, stream_t *))
+      namespaceSwitchGet(NSSWITCH_STREAM_OPEN_BACKEND).func;
+    fileID = streamOpenDelegate(filename, "r", filetype, streamptr);
+  }
 
-  if ( fileID == CDI_UNDEFID || fileID == CDI_ELIBNAVAIL )
+  if (fileID == CDI_UNDEFID || fileID == CDI_ELIBNAVAIL
+      || fileID == CDI_ESYSTEM )
     {
       streamID = fileID;
       return (streamID);
@@ -883,7 +823,6 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
   else
     {
       vlist_t *vlistptr;
-      streamptr = stream_new_entry();
       streamID = streamptr->self;
 
       streamptr->record   = record;
@@ -900,53 +839,12 @@ int streamOpenA(const char *filename, const char *filemode, int filetype)
       vlistptr->ntsteps = cdiInqTimeSize(streamID);
     }
 
-  switch (filetype)
-    {
-#if  defined  (HAVE_LIBGRIB)
-    case FILETYPE_GRB:
-    case FILETYPE_GRB2:
-      {
-	gribClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBSERVICE)
-    case FILETYPE_SRV:
-      {
-	fileClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBEXTRA)
-    case FILETYPE_EXT:
-      {
-	fileClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBIEG)
-    case FILETYPE_IEG:
-      {
-	fileClose(fileID);
-	break;
-      }
-#endif
-#if  defined  (HAVE_LIBNETCDF)
-    case FILETYPE_NC:
-    case FILETYPE_NC2:
-    case FILETYPE_NC4:
-    case FILETYPE_NC4C:
-      {
-	cdfClose(fileID);
-	break;
-      }
-#endif
-    default:
-      {
-	if ( CDI_Debug ) Message("%s support not compiled in!", strfiletype(filetype));
-	return (CDI_ELIBNAVAIL);
-      }
-    }
+  {
+    void (*streamCloseDelegate)(stream_t *streamptr, int recordBufIsToBeDeleted)
+      = (void (*)(stream_t *, int))
+      namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func;
+    streamCloseDelegate(streamptr, 0);
+  }
 
   switch (filetype)
     {
@@ -1171,6 +1069,72 @@ int streamOpenWrite(const char *filename, int filetype)
   return (streamOpen(filename, "w", filetype));
 }
 
+void
+cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted)
+{
+  int fileID   = streamptr->fileID;
+  int filetype = streamptr->filetype;
+  if ( fileID == CDI_UNDEFID )
+    Warning("File %s not open!", streamptr->filename);
+  else
+    switch (filetype)
+      {
+#if  defined  (HAVE_LIBGRIB)
+      case FILETYPE_GRB:
+      case FILETYPE_GRB2:
+        {
+          gribClose(fileID);
+          if (recordBufIsToBeDeleted)
+            gribContainersDelete(streamptr);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBSERVICE)
+      case FILETYPE_SRV:
+        {
+          fileClose(fileID);
+          if (recordBufIsToBeDeleted)
+            srvDelete(streamptr->record->srvp);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBEXTRA)
+      case FILETYPE_EXT:
+        {
+          fileClose(fileID);
+          if (recordBufIsToBeDeleted)
+            extDelete(streamptr->record->extp);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBIEG)
+      case FILETYPE_IEG:
+        {
+          fileClose(fileID);
+          if (recordBufIsToBeDeleted)
+            iegDelete(streamptr->record->iegp);
+          break;
+        }
+#endif
+#if  defined  (HAVE_LIBNETCDF)
+      case FILETYPE_NC:
+      case FILETYPE_NC2:
+      case FILETYPE_NC4:
+      case FILETYPE_NC4C:
+        {
+          cdfClose(fileID);
+          break;
+        }
+#endif
+      default:
+        {
+          Error("%s support not compiled in!", strfiletype(filetype));
+          break;
+        }
+      }
+}
+
+
 /*
 @Function  streamClose
 @Title     Close an open dataset
@@ -1186,8 +1150,6 @@ The function @func{streamClose} closes an open dataset.
 */
 void streamClose(int streamID)
 {
-  int filetype;
-  int fileID;
   int index;
   int vlistID;
   stream_t *streamptr;
@@ -1197,87 +1159,15 @@ void streamClose(int streamID)
   stream_check_ptr(__func__, streamptr);
 
   if ( CDI_Debug )
-    Message("fileID = %d filename = %s", streamID, streamptr->filename);
+    Message("streamID = %d filename = %s", streamID, streamptr->filename);
 
-  fileID   = streamptr->fileID;
-  filetype = streamptr->filetype;
   vlistID  = streamptr->vlistID;
 
-  if ( namespaceHasLocalFile ( namespaceGetActive ()))
-    {
-      if ( fileID == CDI_UNDEFID )
-        Warning("File %s not open!", streamptr->filename);
-      else
-	switch (filetype)
-	  {
-#if  defined  (HAVE_LIBGRIB)
-	  case FILETYPE_GRB:
-	  case FILETYPE_GRB2:
-	    {
-	      gribClose(fileID);
-	      gribContainersDelete(streamptr);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBSERVICE)
-	  case FILETYPE_SRV:
-	    {
-	      fileClose(fileID);
-	      srvDelete(streamptr->record->srvp);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBEXTRA)
-	  case FILETYPE_EXT:
-	    {
-	      fileClose(fileID);
-	      extDelete(streamptr->record->extp);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBIEG)
-	  case FILETYPE_IEG:
-	    {
-	      fileClose(fileID);
-	      iegDelete(streamptr->record->iegp);
-	      break;
-	    }
-#endif
-#if  defined  (HAVE_LIBNETCDF)
-	  case FILETYPE_NC:
-	  case FILETYPE_NC2:
-	  case FILETYPE_NC4:
-	  case FILETYPE_NC4C:
-	    {
-	      cdfClose(fileID);
-	      break;
-	    }
-#endif
-	  default:
-	    {
-	      Error("%s support not compiled in!", strfiletype(filetype));
-	      break;
-	    }
-	  }
-    }
-#ifdef USE_MPI
-  else
-    {
-      statusCode nspStatus = namespaceInqResStatus ();
-      switch ( nspStatus )
-        {
-        case STAGE_DEFINITION:
-          break;
-        case STAGE_TIMELOOP:
-          pioBufferFuncCall(STREAMCLOSE, 1, streamID);
-          break;
-        case STAGE_CLEANUP:
-        break;
-        default:
-          xabort ( "INTERNAL ERROR" );
-        }
-    }
-#endif
+  void (*streamCloseDelegate)(stream_t *streamptr, int recordBufIsToBeDeleted)
+    = (void (*)(stream_t *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func;
+
+  streamCloseDelegate(streamptr, 1);
 
   if ( streamptr->record )
       {
@@ -1331,37 +1221,12 @@ void streamClose(int streamID)
   stream_delete_entry(streamptr);
 }
 
-/*
- at Function  streamSync
- at Title     Synchronize an Open Dataset to Disk
-
- at Prototype  void streamSync(int streamID)
- at Parameter
-    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
-
- at Description
-The function @func{streamSync} offers a way to synchronize the disk copy of a dataset with in-memory buffers.
-
- at EndFunction
-*/
-void streamSync(int streamID)
+void cdiStreamSync_(stream_t *streamptr)
 {
-  int filetype;
-  int fileID;
-  int vlistID;
-  int nvars;
-  stream_t *streamptr;
-
-  if ( !namespaceHasLocalFile ( namespaceGetActive ())) return;
-
-  streamptr = stream_to_pointer(streamID);
-
-  stream_check_ptr(__func__, streamptr);
-
-  fileID   = streamptr->fileID;
-  filetype = streamptr->filetype;
-  vlistID  = streamptr->vlistID;
-  nvars    = vlistNvars(vlistID);
+  int fileID   = streamptr->fileID;
+  int filetype = streamptr->filetype;
+  int vlistID  = streamptr->vlistID;
+  int nvars    = vlistNvars(vlistID);
 
   if ( fileID == CDI_UNDEFID )
     Warning("File %s not open!", streamptr->filename);
@@ -1397,36 +1262,43 @@ void streamSync(int streamID)
 }
 
 /*
- at Function  streamDefTimestep
- at Title     Define time step
+ at Function  streamSync
+ at Title     Synchronize an Open Dataset to Disk
 
- at Prototype int streamDefTimestep(int streamID, int tsID)
+ at Prototype  void streamSync(int streamID)
 @Parameter
     @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
-    @Item  tsID      Timestep identifier.
 
 @Description
-The function @func{streamDefTimestep} defines the time step of a stream.
-
- at Result
- at func{streamDefTimestep} returns the number of records of the time step.
+The function @func{streamSync} offers a way to synchronize the disk copy of a dataset with in-memory buffers.
 
 @EndFunction
 */
-int streamDefTimestep(int streamID, int tsID)
+void streamSync(int streamID)
+{
+  stream_t *streamptr;
+
+  streamptr = stream_to_pointer(streamID);
+
+  stream_check_ptr(__func__, streamptr);
+
+  void (*myStreamSync_)(stream_t *streamptr)
+    = (void (*)(stream_t *))namespaceSwitchGet(NSSWITCH_STREAM_SYNC).func;
+  myStreamSync_(streamptr);
+}
+
+
+int cdiStreamDefTimestep_(stream_t *streamptr, int tsID)
 {
   int newtsID;
   int taxisID;
   int vlistID;
   int time_is_varying;
-  stream_t *streamptr;
   taxis_t *taxisptr1;
   taxis_t *taxisptr2;
 
-  streamptr = stream_to_pointer(streamID);
-
   if ( CDI_Debug )
-    Message("streamID = %d  tsID = %d", streamID, tsID);
+    Message("streamID = %d  tsID = %d", streamptr->self, tsID);
 
   stream_check_ptr(__func__, streamptr);
 
@@ -1439,7 +1311,7 @@ int streamDefTimestep(int streamID, int tsID)
       taxisID = vlistInqTaxis(vlistID);
       if ( taxisID == CDI_UNDEFID )
         {
-          Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamID);
+          Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamptr->self);
           taxisID = taxisCreate(TAXIS_ABSOLUTE);
           vlistDefTaxis(vlistID, taxisID);
         }
@@ -1466,13 +1338,19 @@ int streamDefTimestep(int streamID, int tsID)
 
   streamptr->ntsteps = tsID + 1;
 
-  if ( namespaceHasLocalFile(namespaceGetActive())
-       && (streamptr->filetype == FILETYPE_NC  ||
-           streamptr->filetype == FILETYPE_NC2 ||
-           streamptr->filetype == FILETYPE_NC4 ||
-           streamptr->filetype == FILETYPE_NC4C)
-       && time_is_varying )
-    cdfDefTimestep(streamptr, tsID);
+#ifdef HAVE_LIBNETCDF
+  if ((streamptr->filetype == FILETYPE_NC  ||
+       streamptr->filetype == FILETYPE_NC2 ||
+       streamptr->filetype == FILETYPE_NC4 ||
+       streamptr->filetype == FILETYPE_NC4C)
+      && vlistHasTime(vlistID))
+    {
+      void (*myCdfDefTimestep)(stream_t *streamptr, int tsID)
+        = (void (*)(stream_t *, int))
+        namespaceSwitchGet(NSSWITCH_CDF_DEF_TIMESTEP).func;
+      myCdfDefTimestep(streamptr, tsID);
+    }
+#endif
 
   cdi_create_records(streamptr, tsID);
 
@@ -1480,6 +1358,32 @@ int streamDefTimestep(int streamID, int tsID)
 }
 
 /*
+ at Function  streamDefTimestep
+ at Title     Define time step
+
+ at Prototype int streamDefTimestep(int streamID, int tsID)
+ at Parameter
+    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
+    @Item  tsID      Timestep identifier.
+
+ at Description
+The function @func{streamDefTimestep} defines the time step of a stream.
+
+ at Result
+ at func{streamDefTimestep} returns the number of records of the time step.
+
+ at EndFunction
+*/
+int streamDefTimestep(int streamID, int tsID)
+{
+  stream_t *streamptr = stream_to_pointer(streamID);
+  int (*myStreamDefTimestep_)(stream_t *streamptr, int tsID)
+    = (int (*)(stream_t *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_DEF_TIMESTEP_).func;
+  return myStreamDefTimestep_(streamptr, tsID);
+}
+
+/*
 @Function  streamInqTimestep
 @Title     Get time step
 
@@ -1674,8 +1578,36 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
     }
 }
 
-static
-void stream_write_var(int streamID, int varID, int memtype, const void *data, int nmiss)
+
+/*
+ at Function  streamWriteVar
+ at Title     Write a variable
+
+ at Prototype void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
+ at Parameter
+    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
+    @Item  varID     Variable identifier.
+    @Item  data      Pointer to a block of double precision floating point data values to be written.
+    @Item  nmiss     Number of missing values.
+
+ at Description
+The function streamWriteVar writes the values of one time step of a variable to an open dataset.
+The values are converted to the external data type of the variable, if necessary.
+ at EndFunction
+*/
+void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
+{
+  void (*myCdiStreamWriteVar_)(int streamID, int varID, int memtype,
+                               const void *data, int nmiss)
+    = (void (*)(int, int, int, const void *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_).func;
+  myCdiStreamWriteVar_(streamID, varID, MEMTYPE_DOUBLE, data, nmiss);
+}
+
+/* the single image implementation */
+void
+cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
+                   int nmiss)
 {
   int filetype;
   stream_t *streamptr;
@@ -1684,29 +1616,6 @@ void stream_write_var(int streamID, int varID, int memtype, const void *data, in
 
   check_parg(data);
 
-  /* begin deike */
-#ifdef USE_MPI
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    {
-      statusCode nspStatus = namespaceInqResStatus ();
-      switch ( nspStatus )
-        {
-        case STAGE_DEFINITION:
-          xabort ( "DEFINITION STAGE: PARALLEL WRITING NOT POSSIBLE." );
-          break;
-        case STAGE_TIMELOOP:
-          pioBufferData ( streamID, varID, data, nmiss );
-          return;
-        case STAGE_CLEANUP:
-          xabort ( "CLEANUP STAGE: PARALLEL WRITING NOT POSSIBLE." );
-          break;
-        default:
-          xabort ( "INTERNAL ERROR" );
-        }
-    }
-#endif
-  /* end deike */
-
   streamptr = stream_to_pointer(streamID);
 
   stream_check_ptr(__func__, streamptr);
@@ -1769,27 +1678,6 @@ void stream_write_var(int streamID, int varID, int memtype, const void *data, in
 }
 
 /*
- at Function  streamWriteVar
- at Title     Write a variable
-
- at Prototype void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
- at Parameter
-    @Item  streamID  Stream ID, from a previous call to @fref{streamOpenWrite}.
-    @Item  varID     Variable identifier.
-    @Item  data      Pointer to a block of double precision floating point data values to be written.
-    @Item  nmiss     Number of missing values.
-
- at Description
-The function streamWriteVar writes the values of one time step of a variable to an open dataset.
-The values are converted to the external data type of the variable, if necessary.
- at EndFunction
-*/
-void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
-{
-  stream_write_var(streamID, varID, MEMTYPE_DOUBLE, data, nmiss);
-}
-
-/*
 @Function  streamWriteVarF
 @Title     Write a variable
 
@@ -1808,7 +1696,11 @@ Only support for netCDF was implemented in this function.
 */
 void streamWriteVarF(int streamID, int varID, const float *data, int nmiss)
 {
-  stream_write_var(streamID, varID, MEMTYPE_FLOAT, data, nmiss);
+  void (*myCdiStreamWriteVar_)(int streamID, int varID, int memtype,
+                               const void *data, int nmiss)
+    = (void (*)(int, int, int, const void *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_).func;
+  myCdiStreamWriteVar_(streamID, varID, MEMTYPE_FLOAT, data, nmiss);
 }
 
 /*
@@ -2013,6 +1905,72 @@ void streamWriteVarSliceF(int streamID, int varID, int levelID, const float *dat
 }
 
 
+void
+streamWriteVarChunk(int streamID, int varID,
+                    const int rect[][2], const double *data, int nmiss)
+{
+  void (*myCdiStreamWriteVarChunk_)(int streamID, int varID, int memtype,
+                                    const int rect[][2], const void *data,
+                                    int nmiss)
+    = (void (*)(int, int, int, const int [][2], const void *, int))
+    namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_).func;
+  myCdiStreamWriteVarChunk_(streamID, varID, MEMTYPE_DOUBLE, rect, data, nmiss);
+}
+
+/* single image implementation */
+void
+cdiStreamwriteVarChunk_(int streamID, int varID, int memtype,
+                        const int rect[][2], const void *data, int nmiss)
+{
+  int filetype;
+  stream_t *streamptr;
+
+  if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
+
+  streamptr = stream_to_pointer(streamID);
+
+  stream_check_ptr(__func__, streamptr);
+
+  // streamDefineTaxis(streamID);
+
+  filetype = streamptr->filetype;
+
+  switch (filetype)
+    {
+#if defined (HAVE_LIBGRIB)
+    case FILETYPE_GRB:
+    case FILETYPE_GRB2:
+#endif
+#if defined (HAVE_LIBSERVICE)
+    case FILETYPE_SRV:
+#endif
+#if defined (HAVE_LIBEXTRA)
+    case FILETYPE_EXT:
+#endif
+#if defined (HAVE_LIBIEG)
+    case FILETYPE_IEG:
+#endif
+#if  defined (HAVE_LIBGRIB) || defined (HAVE_LIBSERVICE)      \
+  || defined (HAVE_LIBEXTRA) || defined (HAVE_LIBIEG)
+      xabort("streamWriteVarChunk not implemented for filetype %s!",
+             strfiletype(filetype));
+      break;
+#endif
+#if  defined  (HAVE_LIBNETCDF)
+    case FILETYPE_NC:
+    case FILETYPE_NC2:
+    case FILETYPE_NC4:
+    case FILETYPE_NC4C:
+      if ( streamptr->accessmode == 0 ) cdfEndDef(streamptr);
+      cdf_write_var_chunk(streamptr, varID, memtype, rect, data, nmiss);
+      break;
+#endif
+    default:
+      Error("%s support not compiled in!", strfiletype(filetype));
+      break;
+    }
+}
+
 void streamWriteContents(int streamID, char *cname)
 {
   FILE *cnp;
@@ -2205,69 +2163,23 @@ The function @func{streamDefVlist} defines the variable list of a stream.
 */
 void streamDefVlist(int streamID, int vlistID)
 {
-  int nvars, varID;
-  int gridID, zaxisID;
-  stream_t *streamptr;
+  void (*myStreamDefVlist)(int streamID, int vlistID)
+    = (void (*)(int, int))namespaceSwitchGet(NSSWITCH_STREAM_DEF_VLIST_).func;
+  myStreamDefVlist(streamID, vlistID);
+}
 
-  streamptr = stream_to_pointer(streamID);
+/* the single image implementation of streamDefVlist */
+void
+cdiStreamDefVlist_(int streamID, int vlistID)
+{
+  stream_t *streamptr = stream_to_pointer(streamID);
 
   stream_check_ptr(__func__, streamptr);
-#ifdef USE_MPI
-  if (!namespaceHasLocalFile(namespaceGetActive()))
-  {
-    statusCode nspStatus = namespaceInqResStatus ();
-    switch ( nspStatus )
-      {
-      case STAGE_DEFINITION:
-        break;
-      case STAGE_TIMELOOP:
-        pioBufferFuncCall(STREAMDEFVLIST, 2, streamID, vlistID);
-        break;
-      case STAGE_CLEANUP:
-        xabort ( "TRANSITION TO IO PROCESSES ALREADY FINISHED." );
-        break;
-      default:
-        xabort ( "INTERNAL ERROR" );
-      }
-  }
-
-#endif
 
   if ( streamptr->vlistID == CDI_UNDEFID )
-    {
-      streamptr->vlistID = vlistDuplicate(vlistID);
-      streamptr->vlistIDorig = vlistID ;
-
-      nvars = vlistNvars(vlistID);
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID  = vlistInqVarGrid(vlistID, varID);
-	  zaxisID = vlistInqVarZaxis(vlistID, varID);
-	  stream_new_var(streamptr, gridID, zaxisID);
-	  if ( streamptr->have_missval )
-	    vlistDefVarMissval(streamptr->vlistID, varID, vlistInqVarMissval(vlistID, varID));
-	}
-
-      if ( namespaceHasLocalFile(namespaceGetActive()) && streamptr->filemode == 'w' )
-	{
-	  if ( streamptr->filetype == FILETYPE_NC  ||
-	       streamptr->filetype == FILETYPE_NC2 ||
-	       streamptr->filetype == FILETYPE_NC4 ||
-	       streamptr->filetype == FILETYPE_NC4C )
-	    {
-	      cdfDefVars(streamptr);
-	    }
-	  else if ( streamptr->filetype == FILETYPE_GRB  ||
-		    streamptr->filetype == FILETYPE_GRB2 )
-	    {
-	      gribContainersNew(streamptr);
-	    }
-	}
-    }
+    cdiStreamSetupVlist(streamptr, vlistDuplicate(vlistID), vlistID);
   else
-    {
-      Warning("vlist already defined for %s!", streamptr->filename);
-    }
+    Warning("vlist already defined for %s!", streamptr->filename);
 }
 
 /*
diff --git a/libcdi/src/stream_cdf.c b/libcdi/src/stream_cdf.c
index c49fe97..73f74ee 100644
--- a/libcdi/src/stream_cdf.c
+++ b/libcdi/src/stream_cdf.c
@@ -10,6 +10,11 @@
 #include <math.h>
 #include <float.h>
 
+#if  defined  (HAVE_LIBNETCDF)
+#  include <netcdf.h>
+#endif
+
+
 #include "dmemory.h"
 
 #include "cdi.h"
@@ -21,11 +26,6 @@
 #include "varscan.h"
 #include "vlist.h"
 
-
-#if  defined  (HAVE_LIBNETCDF)
-#  include "netcdf.h"
-#endif
-
 //#define PROJECTION_TEST
 
 #undef  UNDEFID
@@ -41,6 +41,9 @@ void cdfDefLocalAtts(stream_t *streamptr);
 #define  Z_AXIS  3
 #define  T_AXIS  4
 
+#define  POSITIVE_UP    1
+#define  POSITIVE_DOWN  2
+
 typedef struct {
   int     ncvarid;
   int     dimtype;
@@ -62,6 +65,7 @@ typedef struct {
   int      param;
   int      code;
   int      tabnum;
+  int      climatology;
   int      bounds;
   int      gridID;
   int      zaxisID;
@@ -80,6 +84,7 @@ typedef struct {
   int      calendar;
   int      tableID;
   int      truncation;
+  int      position;
   int      defmissval;
   int      deffillval;
   int      xtype;
@@ -372,6 +377,14 @@ void cdfGetAttText(int fileID, int ncvarid, char *attname, int attlen, char *att
 }
 
 static
+int xtypeIsFloat(int xtype)
+{
+  int isFloat = FALSE;
+  if ( xtype == NC_FLOAT || xtype == NC_DOUBLE ) isFloat = TRUE;
+  return isFloat;
+}
+
+static
 int cdfInqDatatype(int xtype, int lunsigned)
 {
   int datatype = -1;
@@ -836,13 +849,26 @@ void cdfDefTime(stream_t *streamptr)
       if ( nc_inq_dimid(fileID, "nb2", &dims[1]) != NC_NOERR )
 	cdf_def_dim(fileID, "nb2", 2, &dims[1]);
 
-      strcpy(tmpstr, taxis_name);
-      strcat(tmpstr, "_bnds");
-      cdf_def_var(fileID, tmpstr, NC_DOUBLE, 2, dims, &time_bndsid);
+      if ( taxis->climatology )
+        {
+          strcpy(tmpstr, "climatology");
+          strcat(tmpstr, "_bnds");
+          cdf_def_var(fileID, tmpstr, NC_DOUBLE, 2, dims, &time_bndsid);
+
+          streamptr->basetime.ncvarboundsid = time_bndsid;
 
-      streamptr->basetime.ncvarboundsid = time_bndsid;
+          cdf_put_att_text(fileID, time_varid, "climatology", strlen(tmpstr), tmpstr);
+        }
+      else
+        {
+          strcpy(tmpstr, taxis_name);
+          strcat(tmpstr, "_bnds");
+          cdf_def_var(fileID, tmpstr, NC_DOUBLE, 2, dims, &time_bndsid);
 
-      cdf_put_att_text(fileID, time_varid, "bounds", strlen(tmpstr), tmpstr);
+          streamptr->basetime.ncvarboundsid = time_bndsid;
+
+          cdf_put_att_text(fileID, time_varid, "bounds", strlen(tmpstr), tmpstr);
+        }
     }
 
   unitstr[0] = 0;
@@ -884,11 +910,12 @@ void cdfDefTime(stream_t *streamptr)
 
   len = strlen(unitstr);
   if ( len )
-    cdf_put_att_text(fileID, time_varid, "units", len, unitstr);
+    {
+      cdf_put_att_text(fileID, time_varid, "units", len, unitstr);
 
-  if ( taxis->has_bounds )
-    if ( len )
-      cdf_put_att_text(fileID, time_bndsid, "units", len, unitstr);
+      if ( taxis->has_bounds )
+        cdf_put_att_text(fileID, time_bndsid, "units", len, unitstr);
+    }
 
   if ( taxis->calendar != -1 )
     {
@@ -1887,6 +1914,47 @@ void cdfDefGdim(stream_t *streamptr, int gridID)
 
 #if  defined  (HAVE_LIBNETCDF)
 static
+void cdfDefGridReference(stream_t *streamptr, int gridID)
+{
+  int fileID  = streamptr->fileID;
+  int number = gridInqNumber(gridID);
+
+  if ( number > 0 )
+    {
+      cdf_put_att_int(fileID, NC_GLOBAL, "number_of_grid_used", NC_INT, 1, &number);
+    }
+
+  if ( gridInqReference(gridID, NULL) )
+    {
+      char gridfile[8912];
+      gridInqReference(gridID, gridfile);
+
+      if ( gridfile[0] != 0 )
+        cdf_put_att_text(fileID, NC_GLOBAL, "grid_file_uri", strlen(gridfile), gridfile);
+    }
+}
+
+static
+void cdfDefGridUUID(stream_t *streamptr, int gridID)
+{
+  char uuidOfHGrid[17];
+
+  gridInqUUID(gridID, uuidOfHGrid);
+  if ( uuidOfHGrid[0] != 0 )
+    {
+      char uuidOfHGridStr[37];
+      uuid2str(uuidOfHGrid, uuidOfHGridStr);
+      if ( uuidOfHGridStr[0] != 0 && strlen(uuidOfHGridStr) == 36 )
+        {
+          int fileID  = streamptr->fileID;
+          //if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
+          cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfHGrid", 36, uuidOfHGridStr);
+          //if ( streamptr->ncmode == 2 ) cdf_enddef(fileID);
+        }
+    }
+}
+
+static
 void cdfDefUnstructured(stream_t *streamptr, int gridID)
 {
   char xunits[CDI_MAX_NAME];
@@ -1970,6 +2038,10 @@ void cdfDefUnstructured(stream_t *streamptr, int gridID)
       nvertex = gridInqNvertex(gridID);
       if ( nvertex > 0 ) cdf_def_dim(fileID, vertname, nvertex, &nvdimID);
 
+      cdfDefGridReference(streamptr, gridID);
+
+      cdfDefGridUUID(streamptr, gridID);
+
       if ( gridInqXvalsPtr(gridID) )
         {
           cdf_def_var(fileID, xaxisname, (nc_type) xtype, 1, &dimID, &ncxvarid);
@@ -2180,14 +2252,19 @@ void cdfDefZaxis(stream_t *streamptr, int zaxisID)
   dimlen = zaxisInqSize(zaxisID);
   type   = zaxisInqType(zaxisID);
 
-  if ( dimlen == 1 && type == ZAXIS_SURFACE       ) return;
-  if ( dimlen == 1 && type == ZAXIS_CLOUD_BASE    ) return;
-  if ( dimlen == 1 && type == ZAXIS_CLOUD_TOP     ) return;
-  if ( dimlen == 1 && type == ZAXIS_ISOTHERM_ZERO ) return;
-  if ( dimlen == 1 && type == ZAXIS_TOA           ) return;
-  if ( dimlen == 1 && type == ZAXIS_SEA_BOTTOM    ) return;
-  if ( dimlen == 1 && type == ZAXIS_ATMOSPHERE    ) return;
-  if ( dimlen == 1 && type == ZAXIS_MEANSEA       ) return;
+  if ( dimlen == 1 && type == ZAXIS_SURFACE            ) return;
+  if ( dimlen == 1 && type == ZAXIS_CLOUD_BASE         ) return;
+  if ( dimlen == 1 && type == ZAXIS_CLOUD_TOP          ) return;
+  if ( dimlen == 1 && type == ZAXIS_ISOTHERM_ZERO      ) return;
+  if ( dimlen == 1 && type == ZAXIS_TOA                ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEA_BOTTOM         ) return;
+  if ( dimlen == 1 && type == ZAXIS_ATMOSPHERE         ) return;
+  if ( dimlen == 1 && type == ZAXIS_MEANSEA            ) return;
+  if ( dimlen == 1 && type == ZAXIS_LAKE_BOTTOM        ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEDIMENT_BOTTOM    ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEDIMENT_BOTTOM_TA ) return;
+  if ( dimlen == 1 && type == ZAXIS_SEDIMENT_BOTTOM_TW ) return;
+  if ( dimlen == 1 && type == ZAXIS_MIX_LAYER          ) return;
 
   zaxisInqName(zaxisID, axisname);
   /*
@@ -2334,12 +2411,12 @@ void cdfDefZaxis(stream_t *streamptr, int zaxisID)
             cdf_put_att_text(fileID, ncvarid, "units", len, units);
 
 	  positive = zaxisInqPositive(zaxisID);
-	  if ( positive == 1 )
+	  if ( positive == POSITIVE_UP )
 	    {
 	      strcpy(tmpname, "up");
 	      cdf_put_att_text(fileID, ncvarid, "positive", strlen(tmpname), tmpname);
 	    }
-	  else if ( positive == 2 )
+	  else if ( positive == POSITIVE_DOWN )
 	    {
 	      strcpy(tmpname, "down");
 	      cdf_put_att_text(fileID, ncvarid, "positive", strlen(tmpname), tmpname);
@@ -2524,26 +2601,6 @@ void cdfDefMapping(stream_t *streamptr, int gridID)
 
 #if  defined  (HAVE_LIBNETCDF)
 static
-void cdfDefGridUUID(stream_t *streamptr, int gridID)
-{
-  char uuidOfHGrid[17];
-
-  gridInqUUID(gridID, uuidOfHGrid);
-  if ( uuidOfHGrid[0] != 0 )
-    {
-      char uuidOfHGridStr[37];
-      uuid2str(uuidOfHGrid, uuidOfHGridStr);
-      if ( uuidOfHGridStr[0] != 0 && strlen(uuidOfHGridStr) == 36 )
-        {
-          int fileID  = streamptr->fileID;
-          if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
-          cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfHGrid", 36, uuidOfHGridStr);
-          if ( streamptr->ncmode == 2 ) cdf_enddef(fileID);
-        }
-    }
-}
-
-static
 void cdfDefGrid(stream_t *streamptr, int gridID)
 {
   int gridtype, size;
@@ -2640,8 +2697,6 @@ void cdfDefGrid(stream_t *streamptr, int gridID)
     {
       Error("Unsupported grid type: %s", gridNamePtr(gridtype));
     }
-
-  cdfDefGridUUID(streamptr, gridID);
 }
 #endif
 
@@ -3017,6 +3072,13 @@ int cdfDefVar(stream_t *streamptr, int varID)
           len = strlen(cellarea);
           cdf_put_att_text(fileID, ncvarid, "cell_measures", len, cellarea);
         }
+
+      if ( gridtype == GRID_UNSTRUCTURED )
+        {
+          int position = gridInqPosition(gridID);
+          if ( position > 0 )
+            cdf_put_att_int(fileID, ncvarid, "number_of_grid_in_reference", NC_INT, 1, &position);
+        }
     }
   else if ( gridtype == GRID_SPECTRAL || gridtype == GRID_FOURIER )
     {
@@ -3068,11 +3130,16 @@ int cdfDefVar(stream_t *streamptr, int varID)
 
   if ( zid == -1 )
     {
-      if ( zaxisInqType(zaxisID) == ZAXIS_CLOUD_BASE    ||
-           zaxisInqType(zaxisID) == ZAXIS_CLOUD_TOP     ||
-           zaxisInqType(zaxisID) == ZAXIS_ISOTHERM_ZERO ||
-           zaxisInqType(zaxisID) == ZAXIS_TOA           ||
-           zaxisInqType(zaxisID) == ZAXIS_SEA_BOTTOM    ||
+      if ( zaxisInqType(zaxisID) == ZAXIS_CLOUD_BASE          ||
+           zaxisInqType(zaxisID) == ZAXIS_CLOUD_TOP           ||
+           zaxisInqType(zaxisID) == ZAXIS_ISOTHERM_ZERO       ||
+           zaxisInqType(zaxisID) == ZAXIS_TOA                 ||
+           zaxisInqType(zaxisID) == ZAXIS_SEA_BOTTOM          ||
+           zaxisInqType(zaxisID) == ZAXIS_LAKE_BOTTOM         ||
+           zaxisInqType(zaxisID) == ZAXIS_SEDIMENT_BOTTOM     ||
+           zaxisInqType(zaxisID) == ZAXIS_SEDIMENT_BOTTOM_TA  ||
+           zaxisInqType(zaxisID) == ZAXIS_SEDIMENT_BOTTOM_TW  ||
+           zaxisInqType(zaxisID) == ZAXIS_MIX_LAYER           ||
            zaxisInqType(zaxisID) == ZAXIS_ATMOSPHERE )
         {
           zaxisInqName(zaxisID, varname);
@@ -3435,9 +3502,9 @@ int cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarid, int dtyp
 }
 #endif
 
+#if  defined  (HAVE_LIBNETCDF)
 void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data, int nmiss)
 {
-#if  defined  (HAVE_LIBNETCDF)
   int fileID;
   int gridID;
   int zaxisID;
@@ -3534,8 +3601,120 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
 
   cdf_write_var_data(fileID, vlistID, varID, ncvarid, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss);
 
+}
 #endif
+
+#if  defined  (HAVE_LIBNETCDF)
+void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
+                         const int rect[][2], const void *data, int nmiss)
+{
+  int fileID;
+  int gridID;
+  int zaxisID;
+  int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID;
+  int ncvarid;
+  int ntsteps;
+  size_t xsize = 0, ysize = 0;
+  size_t start[4];
+  size_t count[4];
+  long nvals;
+  int swapxy = FALSE;
+  int ndims = 0;
+  int idim;
+  int tsteptype;
+  int gridindex, zaxisindex;
+  int dtype;
+  int vlistID;
+  int streamID = streamptr->self;
+
+  if ( CDI_Debug )
+    Message("streamID = %d  varID = %d", streamID, varID);
+
+  vlistID = streamInqVlist(streamID);
+  fileID  = streamInqFileID(streamID);
+
+  ntsteps = streamptr->ntsteps;
+  if ( CDI_Debug )
+    Message("ntsteps = %d", ntsteps);
+
+  if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
+
+  ncvarid = cdfDefVar(streamptr, varID);
+
+  gridID    = vlistInqVarGrid(vlistID, varID);
+  zaxisID   = vlistInqVarZaxis(vlistID, varID);
+  tsteptype = vlistInqVarTsteptype(vlistID, varID);
+
+  gridindex = vlistGridIndex(vlistID, gridID);
+  if ( gridInqType(gridID) == GRID_TRAJECTORY )
+    {
+      cdfWriteGridTraj(streamptr, gridID);
+    }
+  else
+    {
+      xid = streamptr->xdimID[gridindex];
+      yid = streamptr->ydimID[gridindex];
+    }
+
+  zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
+  zid = streamptr->zaxisID[zaxisindex];
+
+  if ( tsteptype != TSTEP_CONSTANT )
+    {
+      start[ndims] = ntsteps - 1;
+      count[ndims] = 1;
+      ndims++;
+    }
+  if ( zid != UNDEFID )
+    {
+      int size = zaxisInqSize(zaxisID);
+      xassert(rect[2][0] >= 0 && rect[2][0] <= rect[2][1]
+              && rect[2][1] <= size);
+      start[ndims] = rect[2][0];
+      count[ndims] = rect[2][1] - rect[2][0] + 1;
+      ndims++;
+    }
+  if ( yid != UNDEFID )
+    {
+      size_t size;
+      cdf_inq_dimlen(fileID, yid, &size);
+      xassert(rect[1][0] >= 0 && rect[1][0] <= rect[1][1]
+              && rect[1][1] <= size);
+      start[ndims] = rect[1][0];
+      count[ndims] = rect[1][1] - rect[1][0] + 1;
+      ndims++;
+    }
+  if ( xid != UNDEFID )
+    {
+      size_t size;
+      cdf_inq_dimlen(fileID, xid, &size);
+      xassert(rect[0][0] >= 0 && rect[0][0] <= rect[0][1]
+              && rect[0][1] <= size);
+      start[ndims] = rect[0][0];
+      count[ndims] = rect[0][1] - rect[0][0] + 1;
+      ndims++;
+    }
+
+  if ( CDI_Debug )
+    for (idim = 0; idim < ndims; idim++)
+      Message("dim = %d  start = %d  count = %d", idim, start[idim], count[idim]);
+
+  if ( streamptr->ncmode == 1 )
+    {
+      cdf_enddef(fileID);
+      streamptr->ncmode = 2;
+    }
+
+  dtype = vlistInqVarDatatype(vlistID, varID);
+
+  if ( nmiss > 0 ) cdfDefVarMissval(streamptr, varID, dtype, 1);
+
+  nvals = gridInqSize(gridID)*zaxisInqSize(zaxisID);
+
+  cdf_write_var_data(fileID, vlistID, varID, ncvarid, dtype, nvals,
+                     xsize, ysize, swapxy, start, count, memtype, data, nmiss);
 }
+#endif
 
 
 int cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, int *nmiss)
@@ -3856,10 +4035,10 @@ int cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype
   return (0);
 }
 
+#if  defined  (HAVE_LIBNETCDF)
 static
 void cdfCreateRecords(stream_t *streamptr, int tsID)
 {
-#if  defined  (HAVE_LIBNETCDF)
   int varID, levelID, recID, vrecID, zaxisID;
   int nvars, nlev, nrecs, nvrecs;
   record_t *records = NULL;
@@ -3976,8 +4155,8 @@ void cdfCreateRecords(stream_t *streamptr, int tsID)
              streamptr->tsteps[1].recIDs,
              nvrecs*sizeof(int));
     }
-#endif
 }
+#endif
 
 #if  defined  (HAVE_LIBNETCDF)
 static
@@ -4067,6 +4246,7 @@ void init_ncvars(long nvars, ncvar_t *ncvars)
       ncvars[ncvarid].code            = UNDEFID;
       ncvars[ncvarid].tabnum          = 0;
       ncvars[ncvarid].calendar        = FALSE;
+      ncvars[ncvarid].climatology     = FALSE;
       ncvars[ncvarid].bounds          = UNDEFID;
       ncvars[ncvarid].gridID          = UNDEFID;
       ncvars[ncvarid].zaxisID         = UNDEFID;
@@ -4092,6 +4272,7 @@ void init_ncvars(long nvars, ncvar_t *ncvars)
       ncvars[ncvarid].vlen            = 0;
       ncvars[ncvarid].vdata           = NULL;
       ncvars[ncvarid].truncation      = 0;
+      ncvars[ncvarid].position        = 0;
       ncvars[ncvarid].positive        = 0;
       ncvars[ncvarid].chunked         = 0;
       ncvars[ncvarid].chunktype       = UNDEFID;
@@ -4121,18 +4302,23 @@ static
 int isLonAxis(const char *units, const char *stdname)
 {
   int status = FALSE;
+  char degree_units[16];
 
-  if ( memcmp(units, "degrees_east", 12) == 0 ||
-       memcmp(units, "degree_east", 11)  == 0 ||
-       memcmp(units, "degree_E", 8)      == 0 ||
-       memcmp(units, "degrees_E", 9)     == 0 ||
-       memcmp(units, "degreeE", 7)       == 0 ||
-       memcmp(units, "degreesE", 8)      == 0 ||
-       memcmp(stdname, "longitude", 9)   == 0 ||
-       (memcmp(units, "degree", 6)            == 0 &&
-        memcmp(stdname, "grid_longitude", 14) == 0) ||
-       (memcmp(units, "radian", 6)            == 0 &&
-        memcmp(stdname, "grid_longitude", 14) == 0) )
+  memcpy(degree_units, units, 16);
+  degree_units[15] = 0;
+  strtolower(degree_units);
+
+  if ( memcmp(degree_units, "degree", 6) == 0 )
+    {
+      int ioff = 6;
+      if ( degree_units[ioff] == 's' ) ioff++;
+      if ( degree_units[ioff] == '_' ) ioff++;
+      if ( degree_units[ioff] == 'e' ) status = TRUE;
+    }
+
+  if ( status == TRUE ||
+       ((memcmp(units, "degree", 6) == 0 ||memcmp(units, "radian", 6) == 0) &&
+        (memcmp(stdname, "grid_longitude", 14) == 0 || memcmp(stdname, "longitude", 9) == 0)) )
     {
       status = TRUE;
     }
@@ -4144,18 +4330,23 @@ static
 int isLatAxis(const char *units, const char *stdname)
 {
   int status = FALSE;
+  char degree_units[16];
 
-  if ( memcmp(units, "degrees_north", 13) == 0 ||
-       memcmp(units, "degree_north", 12)  == 0 ||
-       memcmp(units, "degree_N", 8)       == 0 ||
-       memcmp(units, "degrees_N", 9)      == 0 ||
-       memcmp(units, "degreeN", 7)        == 0 ||
-       memcmp(units, "degreesN", 8)       == 0 ||
-       memcmp(stdname, "latitude", 8)     == 0 ||
-       (memcmp(units, "degree", 6)           == 0 &&
-        memcmp(stdname, "grid_latitude", 13) == 0) ||
-       (memcmp(units, "radian", 6)           == 0 &&
-        memcmp(stdname, "grid_latitude", 13) == 0) )
+  memcpy(degree_units, units, 16);
+  degree_units[15] = 0;
+  strtolower(degree_units);
+
+  if ( memcmp(degree_units, "degree", 6) == 0 )
+    {
+      int ioff = 6;
+      if ( degree_units[ioff] == 's' ) ioff++;
+      if ( degree_units[ioff] == '_' ) ioff++;
+      if ( degree_units[ioff] == 'n' ) status = TRUE;
+    }
+
+  if ( status == TRUE ||
+       ((memcmp(units, "degree", 6) == 0 || memcmp(units, "radian", 6) == 0) &&
+        (memcmp(stdname, "grid_latitude", 13) == 0 || memcmp(stdname, "latitude", 8) == 0)) )
     {
       status = TRUE;
     }
@@ -4572,6 +4763,16 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 ncvars[ncvarid].zaxistype = ZAXIS_ISOTHERM_ZERO;
               else if ( strcmp(attstring, "seabottom") == 0 )
                 ncvars[ncvarid].zaxistype = ZAXIS_SEA_BOTTOM;
+              else if ( strcmp(attstring, "lakebottom") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_LAKE_BOTTOM;
+              else if ( strcmp(attstring, "sedimentbottom") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_SEDIMENT_BOTTOM;
+              else if ( strcmp(attstring, "sedimentbottomta") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;
+              else if ( strcmp(attstring, "sedimentbottomtw") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;
+              else if ( strcmp(attstring, "mixlayer") == 0 )
+                ncvars[ncvarid].zaxistype = ZAXIS_MIX_LAYER;
               else if ( strcmp(attstring, "atmosphere") == 0 )
                 ncvars[ncvarid].zaxistype = ZAXIS_ATMOSPHERE;
               else
@@ -4594,6 +4795,10 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
             {
               cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvars[ncvarid].truncation);
             }
+          else if ( strcmp(attname, "number_of_grid_in_reference") == 0 && atttype != NC_CHAR )
+            {
+              cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvars[ncvarid].position);
+            }
           else if ( strcmp(attname, "add_offset") == 0 && atttype != NC_CHAR )
             {
 	      cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvars[ncvarid].addoffset);
@@ -4614,6 +4819,24 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
 	      */
 	      /* (also used for lon/lat) cdfSetVar(ncvars, ncvarid, TRUE); */
             }
+          else if ( strcmp(attname, "climatology") == 0 && atttype == NC_CHAR )
+            {
+              int status, ncboundsid;
+
+              cdfGetAttText(ncid, ncvarid, attname, attstringlen-1, attstring);
+
+              status = nc_inq_varid(ncid, attstring, &ncboundsid);
+
+              if ( status == NC_NOERR )
+                {
+                  ncvars[ncvarid].climatology = TRUE;
+                  ncvars[ncvarid].bounds = ncboundsid;
+                  cdfSetVar(ncvars, ncvars[ncvarid].bounds, FALSE);
+                  cdfSetVar(ncvars, ncvarid, FALSE);
+                }
+              else
+                Warning("%s - %s", nc_strerror(status), attstring);
+            }
           else if ( strcmp(attname, "bounds") == 0 && atttype == NC_CHAR )
             {
               int status, ncboundsid;
@@ -4758,8 +4981,8 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
               cdfGetAttText(ncid, ncvarid, attname, attstringlen-1, attstring);
               strtolower(attstring);
 
-              if    ( memcmp(attstring, "down", 4) == 0 ) ncvars[ncvarid].positive = -1;
-              else if ( memcmp(attstring, "up", 2) == 0 ) ncvars[ncvarid].positive = 1;
+              if    ( memcmp(attstring, "down", 4) == 0 ) ncvars[ncvarid].positive = POSITIVE_DOWN;
+              else if ( memcmp(attstring, "up", 2) == 0 ) ncvars[ncvarid].positive = POSITIVE_UP;
 
               if ( ncvars[ncvarid].ndims == 1 )
                 {
@@ -4786,7 +5009,7 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 {
                   extern int cdiIgnoreValidRange;
                   int lignore = FALSE;
-                  if ( (atttype == NC_FLOAT || atttype == NC_DOUBLE) && xtype != NC_FLOAT && xtype != NC_DOUBLE ) lignore = TRUE;
+                  if ( xtypeIsFloat(atttype) != xtypeIsFloat(xtype) ) lignore = TRUE;
                   if ( cdiIgnoreValidRange == FALSE && lignore == FALSE )
                     {
                       cdfGetAttDouble(ncid, ncvarid, attname, 2, ncvars[ncvarid].validrange);
@@ -4807,7 +5030,7 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 {
                   extern int cdiIgnoreValidRange;
                   int lignore = FALSE;
-                  if ( (atttype == NC_FLOAT || atttype == NC_DOUBLE) && xtype != NC_FLOAT && xtype != NC_DOUBLE ) lignore = TRUE;
+                  if ( xtypeIsFloat(atttype) != xtypeIsFloat(xtype) ) lignore = TRUE;
                   if ( cdiIgnoreValidRange == FALSE && lignore == FALSE )
                     {
                       cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvars[ncvarid].validrange)[0]);
@@ -4825,7 +5048,7 @@ void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
                 {
                   extern int cdiIgnoreValidRange;
                   int lignore = FALSE;
-                  if ( (atttype == NC_FLOAT || atttype == NC_DOUBLE) && xtype != NC_FLOAT && xtype != NC_DOUBLE ) lignore = TRUE;
+                  if ( xtypeIsFloat(atttype) != xtypeIsFloat(xtype) ) lignore = TRUE;
                   if ( cdiIgnoreValidRange == FALSE && lignore == FALSE )
                     {
                       cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvars[ncvarid].validrange)[1]);
@@ -5115,11 +5338,11 @@ void verify_coordinate_vars_1(int ndims, ncdim_t *ncdims, ncvar_t *ncvars, int t
 		{
 		  if      ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer midpoints") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
 		  else if ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer interfaces") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
 		  else if ( strcmp(ncvars[ncvarid].units, "level") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_GENERIC;
@@ -5194,11 +5417,11 @@ void verify_coordinate_vars_2(int nvars, ncvar_t *ncvars)
 		{
 		  if      ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer midpoints") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at midpoints", 25) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID;
 		  else if ( strcmp(ncvars[ncvarid].longname, "hybrid level at layer interfaces") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
-		  else if ( memcmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
+		  else if ( strncmp(ncvars[ncvarid].longname, "hybrid level at interfaces", 26) == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_HYBRID_HALF;
 		  else if ( strcmp(ncvars[ncvarid].units, "level") == 0 )
 		    ncvars[ncvarid].zaxistype = ZAXIS_GENERIC;
@@ -5222,6 +5445,7 @@ void verify_coordinate_vars_2(int nvars, ncvar_t *ncvars)
     }
 }
 
+#if defined (PROJECTION_TEST)
 static
 void copy_numeric_projatts(int gridID, int ncvarID, int ncfileID)
 {
@@ -5242,10 +5466,11 @@ void copy_numeric_projatts(int gridID, int ncvarID, int ncfileID)
     }
 
 }
+#endif
 
 /* define all input grids */
 static
-void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvars, ncvar_t *ncvars, int timedimid, char *uuidOfHGrid, int number_of_grid_used)
+void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvars, ncvar_t *ncvars, int timedimid, char *uuidOfHGrid, char *gridfile, int number_of_grid_used)
 {
   int ncvarid, ncvarid2;
   int ndims;
@@ -5676,12 +5901,11 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 		}
 	    }
 
-	  if ( number_of_grid_used != UNDEFID &&
-               (grid.type == UNDEFID || grid.type == GRID_GENERIC) )
-	    {
-	      grid.type   = GRID_REFERENCE;
-	      grid.number = number_of_grid_used;
-	    }
+	  if ( number_of_grid_used != UNDEFID && (grid.type == UNDEFID || grid.type == GRID_GENERIC) )
+            grid.type   = GRID_UNSTRUCTURED;
+
+	  if ( number_of_grid_used != UNDEFID && grid.type == GRID_UNSTRUCTURED )
+            grid.number = number_of_grid_used;
 
 	  if ( ncvars[ncvarid].gmapid >= 0 && ncvars[ncvarid].gridtype != GRID_CURVILINEAR )
 	    {
@@ -5799,9 +6023,14 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 #endif
 	    ncvars[ncvarid].gridID = varDefGrid(vlistID, grid, 1);
 
-          if ( uuidOfHGrid[0] != 0 && 
-	       (grid.type == GRID_UNSTRUCTURED || grid.type == GRID_REFERENCE) )
-            gridDefUUID(ncvars[ncvarid].gridID, uuidOfHGrid);
+          if ( grid.type == GRID_UNSTRUCTURED )
+            {
+              if ( ncvars[ncvarid].position > 0 ) gridDefPosition(ncvars[ncvarid].gridID, ncvars[ncvarid].position);
+
+              if ( gridfile[0] != 0 ) gridDefReference(ncvars[ncvarid].gridID, gridfile);
+
+              if ( uuidOfHGrid[0] != 0 ) gridDefUUID(ncvars[ncvarid].gridID, uuidOfHGrid);
+            }
 
           if ( ncvars[ncvarid].chunked )
             {
@@ -5864,6 +6093,8 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 		    if ( ncvars[ncvarid].xvarid != ncvars[ncvarid2].xvarid ) same_grid = FALSE;
 		    if ( ncvars[ncvarid].yvarid != ncvars[ncvarid2].yvarid ) same_grid = FALSE;
 
+		    if ( ncvars[ncvarid].position != ncvars[ncvarid2].position ) same_grid = FALSE;
+
 		    if ( same_grid )
 		      {
 			if ( CDI_Debug )
@@ -5888,6 +6119,7 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
   int zaxisindex;
   int zprec;
   int nbdims, nvertex, nlevel;
+  int positive = 0;
   char *pname, *plongname, *punits;
 
   for ( ncvarid = 0; ncvarid < nvars; ncvarid++ )
@@ -5903,6 +6135,8 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 	  double *ubounds = NULL;
 	  int zaxisType;
 
+          positive = 0;
+
 	  ndims = ncvars[ncvarid].ndims;
 	  for ( i = 0; i < ndims; i++ )
 	    {
@@ -5930,6 +6164,7 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 
 	  if ( zvarid != UNDEFID )
 	    {
+	      positive  = ncvars[zvarid].positive;
 	      pname     = ncvars[zvarid].name;
 	      plongname = ncvars[zvarid].longname;
 	      punits    = ncvars[zvarid].units;
@@ -5996,6 +6231,9 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
 
       	  ncvars[ncvarid].zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, with_bounds, lbounds, ubounds,
 						vctsize, vct, pname, plongname, punits, zprec, 1, 0);
+
+          if ( positive > 0 ) zaxisDefPositive(ncvars[ncvarid].zaxisID, positive);
+
 	  free(zvar);
 	  free(lbounds);
 	  free(ubounds);
@@ -6332,8 +6570,8 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
 }
 
 static
-void scan_global_attributtes(int fileID, int vlistID, stream_t *streamptr, int ngatts,
-                             int *instID, int *modelID, int *ucla_les, char *uuidOfHGrid, int *number_of_grid_used)
+void scan_global_attributes(int fileID, int vlistID, stream_t *streamptr, int ngatts,
+                            int *instID, int *modelID, int *ucla_les, char *uuidOfHGrid, char *gridfile, int *number_of_grid_used)
 {
   nc_type xtype;
   size_t attlen;
@@ -6385,6 +6623,10 @@ void scan_global_attributtes(int fileID, int vlistID, stream_t *streamptr, int n
 	      else if ( strcmp(attname, "CDO") == 0 )
 		{
 		}
+	      else if ( strcmp(attname, "grid_file_uri") == 0 )
+		{
+                  memcpy(gridfile, attstring, attlen+1);
+		}
 	      else if ( strcmp(attname, "uuidOfHGrid") == 0 && attlen == 36 )
 		{
                   attstring[36] = 0;
@@ -6393,6 +6635,11 @@ void scan_global_attributtes(int fileID, int vlistID, stream_t *streamptr, int n
 		}
 	      else
 		{
+                  if ( strcmp(attname, "ICON_grid_file_uri") == 0 && gridfile[0] == 0 )
+                    {
+                      memcpy(gridfile, attstring, attlen+1);
+                    }
+
 		  vlistDefAttTxt(vlistID, CDI_GLOBAL, attname, (int)attlen, attstring);
 		}
 	    }
@@ -6443,8 +6690,9 @@ int cdfInqContents(stream_t *streamptr)
   int *varids;
   int nvarids;
   const int attstringlen = 8192; char attstring[8192];
-  int timehasunits = FALSE;
+  int time_has_units = FALSE;
   int time_has_bounds = FALSE;
+  int time_climatology = FALSE;
   size_t len;
   int nvars_data;
   int nvcth_id = UNDEFID, vcta_id = UNDEFID, vctb_id = UNDEFID;
@@ -6462,9 +6710,11 @@ int cdfInqContents(stream_t *streamptr)
   int format = 0;
   int ucla_les = FALSE;
   char uuidOfHGrid[17];
+  char gridfile[8912];
   int number_of_grid_used = UNDEFID;
 
   uuidOfHGrid[0] = 0;
+  gridfile[0] = 0;
 
   vlistID = streamptr->vlistID;
   fileID  = streamptr->fileID;
@@ -6533,8 +6783,8 @@ int cdfInqContents(stream_t *streamptr)
       return (CDI_EUFSTRUCT);
     }
 
-  /* scan global attributtes */
-  scan_global_attributtes(fileID, vlistID, streamptr, ngatts, &instID, &modelID, &ucla_les, uuidOfHGrid, &number_of_grid_used);
+  /* scan global attributes */
+  scan_global_attributes(fileID, vlistID, streamptr, ngatts, &instID, &modelID, &ucla_les, uuidOfHGrid, gridfile, &number_of_grid_used);
 
   /* find time dim */
   if ( unlimdimid >= 0 )
@@ -6653,7 +6903,7 @@ int cdfInqContents(stream_t *streamptr)
       else if ( streamptr->basetime.lwrf == FALSE )
 	{
 	  if ( ncvars[ncvarid].units[0] != 0 )
-	    timehasunits = TRUE;
+	    time_has_units = TRUE;
 
 	  if ( ncvars[ncvarid].bounds != UNDEFID )
 	    {
@@ -6663,8 +6913,10 @@ int cdfInqContents(stream_t *streamptr)
 		  len = ncdims[ncvars[ncvars[ncvarid].bounds].dimids[nbdims-1]].len;
 		  if ( (int)len == 2 && timedimid == ncvars[ncvars[ncvarid].bounds].dimids[0] )
 		    {
+
 		      time_has_bounds = TRUE;
 		      streamptr->basetime.ncvarboundsid = ncvars[ncvarid].bounds;
+                      if ( ncvars[ncvarid].climatology ) time_climatology = TRUE;
 		    }
 		}
 	    }
@@ -6835,7 +7087,7 @@ int cdfInqContents(stream_t *streamptr)
 
 
   /* define all grids */
-  define_all_grids(streamptr, vlistID, ncdims, nvars, ncvars, timedimid, uuidOfHGrid, number_of_grid_used);
+  define_all_grids(streamptr, vlistID, ncdims, nvars, ncvars, timedimid, uuidOfHGrid, gridfile, number_of_grid_used);
 
 
   /* read VCT */
@@ -6885,7 +7137,7 @@ int cdfInqContents(stream_t *streamptr)
   /* time varID */
   ncvarid = streamptr->basetime.ncvarid;
 
-  if ( timehasunits )
+  if ( time_has_units )
     {
       taxis_t *taxis;
       taxis = &streamptr->tsteps[0].taxis;
@@ -6896,7 +7148,10 @@ int cdfInqContents(stream_t *streamptr)
     }
 
   if ( time_has_bounds )
-    streamptr->tsteps[0].taxis.has_bounds = TRUE;
+    {
+      streamptr->tsteps[0].taxis.has_bounds = TRUE;
+      if ( time_climatology ) streamptr->tsteps[0].taxis.climatology = TRUE;
+    }
 
   if ( ncvarid != -1 )
     {
@@ -6938,7 +7193,7 @@ int cdfInqContents(stream_t *streamptr)
   else
     {
       taxisID = taxisCreate(TAXIS_ABSOLUTE);
-      if ( !timehasunits )
+      if ( !time_has_units )
 	{
 	  taxisDefTunit(taxisID, TUNIT_DAY);
 	  streamptr->tsteps[0].taxis.unit = TUNIT_DAY;
diff --git a/libcdi/src/stream_cdf.h b/libcdi/src/stream_cdf.h
index efe47ef..166aecd 100644
--- a/libcdi/src/stream_cdf.h
+++ b/libcdi/src/stream_cdf.h
@@ -23,6 +23,9 @@ void   cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *da
 int    cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, int *nmiss);
 int    cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, int nmiss);
 
+void   cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
+                           const int rect[][2], const void *data, int nmiss);
+
 #endif
 /*
  * Local Variables:
diff --git a/libcdi/src/stream_cgribex.c b/libcdi/src/stream_cgribex.c
index c96e9b5..b11a01d 100644
--- a/libcdi/src/stream_cgribex.c
+++ b/libcdi/src/stream_cgribex.c
@@ -173,8 +173,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid, i
     case GRID_GAUSSIAN:
       {
 	if ( ISEC4_NumValues != ISEC2_NumLon*ISEC2_NumLat )
-	  Error("numberOfPoints (%d) and gridSize (%d) differ!",
-		ISEC4_NumValues, ISEC2_NumLon*ISEC2_NumLat);
+	  Error("numberOfPoints (%d) and gridSize (%d) differ!", ISEC4_NumValues, ISEC2_NumLon*ISEC2_NumLat);
 	grid->size  = ISEC4_NumValues;
 	grid->xsize = ISEC2_NumLon;
 	grid->ysize = ISEC2_NumLat;
@@ -1918,14 +1917,14 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
       }
     case ZAXIS_CLOUD_BASE:
       {
-	ISEC1_LevelType = GRIB1_LTYPE_CLOUDBASE;
+	ISEC1_LevelType = GRIB1_LTYPE_CLOUD_BASE;
 	ISEC1_Level1    = 0;
 	ISEC1_Level2    = 0;
 	break;
       }
     case ZAXIS_CLOUD_TOP:
       {
-	ISEC1_LevelType = GRIB1_LTYPE_CLOUDTOP;
+	ISEC1_LevelType = GRIB1_LTYPE_CLOUD_TOP;
 	ISEC1_Level1    = 0;
 	ISEC1_Level2    = 0;
 	break;
diff --git a/libcdi/src/stream_ext.c b/libcdi/src/stream_ext.c
index d6a57e6..289aa44 100644
--- a/libcdi/src/stream_ext.c
+++ b/libcdi/src/stream_ext.c
@@ -878,7 +878,7 @@ void extReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data,
   extRead(fileID, extp);
   extInqHeader(extp, header);
   extInqDataDP(extp, data);
- 
+
   fileSetPos(fileID, currentfilepos, SEEK_SET);
 
   *nmiss = 0;
diff --git a/libcdi/src/stream_grb.c b/libcdi/src/stream_grb.c
index 8b7b899..873859a 100644
--- a/libcdi/src/stream_grb.c
+++ b/libcdi/src/stream_grb.c
@@ -13,11 +13,7 @@
 #include "file.h"
 #include "cgribex.h"  /* gribZip gribGetZip gribGinfo */
 #include "gribapi.h"
-
-#ifdef USE_MPI
-#include "pio.h"
-#include "pio_comm.h"
-#endif
+#include "namespace.h"
 
 
 int grib1ltypeToZaxisType(int grib_ltype)
@@ -26,26 +22,31 @@ int grib1ltypeToZaxisType(int grib_ltype)
 
   switch ( grib_ltype )
     {
-    case GRIB1_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;           break; }
-    case GRIB1_LTYPE_CLOUDBASE:          { zaxistype = ZAXIS_CLOUD_BASE;        break; }
-    case GRIB1_LTYPE_CLOUDTOP:           { zaxistype = ZAXIS_CLOUD_TOP;         break; }
-    case GRIB1_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;     break; }
-    case GRIB1_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;               break; }
-    case GRIB1_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;        break; }
-    case GRIB1_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;        break; }
-    case GRIB1_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;           break; }
+    case GRIB1_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;                break; }
+    case GRIB1_LTYPE_CLOUD_BASE:         { zaxistype = ZAXIS_CLOUD_BASE;             break; }
+    case GRIB1_LTYPE_CLOUD_TOP:          { zaxistype = ZAXIS_CLOUD_TOP;              break; }
+    case GRIB1_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;          break; }
+    case GRIB1_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;                    break; }
+    case GRIB1_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;             break; }
+    case GRIB1_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;             break; }
+    case GRIB1_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;                break; }
     case GRIB1_LTYPE_99:
-    case GRIB1_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;          break; }
-    case GRIB1_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;            break; }
-    case GRIB1_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;	        break; }
+    case GRIB1_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;               break; }
+    case GRIB1_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;                 break; }
+    case GRIB1_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;	             break; }
     case GRIB1_LTYPE_SIGMA:
-    case GRIB1_LTYPE_SIGMA_LAYER:        { zaxistype = ZAXIS_SIGMA;	        break; }
+    case GRIB1_LTYPE_SIGMA_LAYER:        { zaxistype = ZAXIS_SIGMA;	             break; }
     case GRIB1_LTYPE_HYBRID:
-    case GRIB1_LTYPE_HYBRID_LAYER:       { zaxistype = ZAXIS_HYBRID;	        break; }
+    case GRIB1_LTYPE_HYBRID_LAYER:       { zaxistype = ZAXIS_HYBRID;	             break; }
     case GRIB1_LTYPE_LANDDEPTH:
-    case GRIB1_LTYPE_LANDDEPTH_LAYER:    { zaxistype = ZAXIS_DEPTH_BELOW_LAND;  break; }
-    case GRIB1_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;	break; }
-    case GRIB1_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;   break; }
+    case GRIB1_LTYPE_LANDDEPTH_LAYER:    { zaxistype = ZAXIS_DEPTH_BELOW_LAND;       break; }
+    case GRIB1_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;             break; }
+    case GRIB1_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;        break; }
+    case GRIB1_LTYPE_LAKE_BOTTOM:        { zaxistype = ZAXIS_LAKE_BOTTOM;            break; }
+    case GRIB1_LTYPE_SEDIMENT_BOTTOM:    { zaxistype = ZAXIS_SEDIMENT_BOTTOM;        break; }
+    case GRIB1_LTYPE_SEDIMENT_BOTTOM_TA: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;     break; }
+    case GRIB1_LTYPE_SEDIMENT_BOTTOM_TW: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;     break; }
+    case GRIB1_LTYPE_MIX_LAYER:          { zaxistype = ZAXIS_MIX_LAYER;              break; }
     }
 
   return (zaxistype);
@@ -58,31 +59,97 @@ int grib2ltypeToZaxisType(int grib_ltype)
 
   switch ( grib_ltype )
     {
-    case GRIB2_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;           break; }
-    case GRIB2_LTYPE_CLOUDBASE:          { zaxistype = ZAXIS_CLOUD_BASE;        break; }
-    case GRIB2_LTYPE_CLOUDTOP:           { zaxistype = ZAXIS_CLOUD_TOP;         break; }
-    case GRIB2_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;     break; }
-    case GRIB2_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;               break; }
-    case GRIB2_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;        break; }
-    case GRIB2_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;        break; }
-    case GRIB2_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;           break; }
-    case GRIB2_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;          break; }
-    case GRIB2_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;            break; }
-    case GRIB2_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;          break; }
-    case GRIB2_LTYPE_SIGMA:              { zaxistype = ZAXIS_SIGMA;             break; }
+    case GRIB2_LTYPE_SURFACE:            { zaxistype = ZAXIS_SURFACE;                break; }
+    case GRIB2_LTYPE_CLOUD_BASE:         { zaxistype = ZAXIS_CLOUD_BASE;             break; }
+    case GRIB2_LTYPE_CLOUD_TOP:          { zaxistype = ZAXIS_CLOUD_TOP;              break; }
+    case GRIB2_LTYPE_ISOTHERM0:          { zaxistype = ZAXIS_ISOTHERM_ZERO;          break; }
+    case GRIB2_LTYPE_TOA:                { zaxistype = ZAXIS_TOA;                    break; }
+    case GRIB2_LTYPE_SEA_BOTTOM:         { zaxistype = ZAXIS_SEA_BOTTOM;             break; }
+    case GRIB2_LTYPE_ATMOSPHERE:         { zaxistype = ZAXIS_ATMOSPHERE;             break; }
+    case GRIB2_LTYPE_MEANSEA:            { zaxistype = ZAXIS_MEANSEA;                break; }
+    case GRIB2_LTYPE_ISOBARIC:           { zaxistype = ZAXIS_PRESSURE;               break; }
+    case GRIB2_LTYPE_HEIGHT:             { zaxistype = ZAXIS_HEIGHT;                 break; }
+    case GRIB2_LTYPE_ALTITUDE:           { zaxistype = ZAXIS_ALTITUDE;               break; }
+    case GRIB2_LTYPE_SIGMA:              { zaxistype = ZAXIS_SIGMA;                  break; }
     case GRIB2_LTYPE_HYBRID:
- /* case GRIB2_LTYPE_HYBRID_LAYER: */    { zaxistype = ZAXIS_HYBRID;            break; }
+ /* case GRIB2_LTYPE_HYBRID_LAYER: */    { zaxistype = ZAXIS_HYBRID;                 break; }
     case GRIB2_LTYPE_LANDDEPTH:
- /* case GRIB2_LTYPE_LANDDEPTH_LAYER: */ { zaxistype = ZAXIS_DEPTH_BELOW_LAND;  break; }
-    case GRIB2_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;        break; }
-    case GRIB2_LTYPE_SNOW:               { zaxistype = ZAXIS_SNOW;              break; }
-    case GRIB2_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;   break; }
+ /* case GRIB2_LTYPE_LANDDEPTH_LAYER: */ { zaxistype = ZAXIS_DEPTH_BELOW_LAND;       break; }
+    case GRIB2_LTYPE_ISENTROPIC:         { zaxistype = ZAXIS_ISENTROPIC;             break; }
+    case GRIB2_LTYPE_SNOW:               { zaxistype = ZAXIS_SNOW;                   break; }
+    case GRIB2_LTYPE_SEADEPTH:           { zaxistype = ZAXIS_DEPTH_BELOW_SEA;        break; }
+    case GRIB2_LTYPE_LAKE_BOTTOM:        { zaxistype = ZAXIS_LAKE_BOTTOM;            break; }
+    case GRIB2_LTYPE_SEDIMENT_BOTTOM:    { zaxistype = ZAXIS_SEDIMENT_BOTTOM;        break; }
+    case GRIB2_LTYPE_SEDIMENT_BOTTOM_TA: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA;     break; }
+    case GRIB2_LTYPE_SEDIMENT_BOTTOM_TW: { zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW;     break; }
+    case GRIB2_LTYPE_MIX_LAYER:          { zaxistype = ZAXIS_MIX_LAYER;              break; }
+    case GRIB2_LTYPE_REFERENCE:          { zaxistype = ZAXIS_REFERENCE;              break; }
     }
 
   return (zaxistype);
 }
 
 
+int zaxisTypeToGrib1ltype(int zaxistype)
+{
+  int grib_ltype = -1;
+
+  switch (zaxistype)
+    {
+    case ZAXIS_SURFACE:               { grib_ltype = GRIB1_LTYPE_SURFACE;            break; }
+    case ZAXIS_MEANSEA:               { grib_ltype = GRIB1_LTYPE_MEANSEA;            break; }
+    case ZAXIS_HEIGHT:                { grib_ltype = GRIB1_LTYPE_HEIGHT;             break; }
+    case ZAXIS_ALTITUDE:              { grib_ltype = GRIB1_LTYPE_ALTITUDE;           break; }
+    case ZAXIS_SIGMA:                 { grib_ltype = GRIB1_LTYPE_SIGMA;              break; }
+    case ZAXIS_DEPTH_BELOW_SEA:       { grib_ltype = GRIB1_LTYPE_SEADEPTH;           break; }
+    case ZAXIS_ISENTROPIC:            { grib_ltype = GRIB1_LTYPE_ISENTROPIC;         break; }
+    case ZAXIS_CLOUD_BASE:            { grib_ltype = GRIB1_LTYPE_CLOUD_BASE;         break; }
+    case ZAXIS_CLOUD_TOP:             { grib_ltype = GRIB1_LTYPE_CLOUD_TOP;          break; }
+    case ZAXIS_ISOTHERM_ZERO:         { grib_ltype = GRIB1_LTYPE_ISOTHERM0;          break; }
+    case ZAXIS_TOA:                   { grib_ltype = GRIB1_LTYPE_TOA;                break; }
+    case ZAXIS_SEA_BOTTOM:            { grib_ltype = GRIB1_LTYPE_SEA_BOTTOM;         break; }
+    case ZAXIS_LAKE_BOTTOM:           { grib_ltype = GRIB1_LTYPE_LAKE_BOTTOM;        break; }
+    case ZAXIS_SEDIMENT_BOTTOM:       { grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM;    break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TA:    { grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TA; break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TW:    { grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TW; break; }
+    case ZAXIS_MIX_LAYER:             { grib_ltype = GRIB1_LTYPE_MIX_LAYER;          break; }
+    case ZAXIS_ATMOSPHERE:            { grib_ltype = GRIB1_LTYPE_ATMOSPHERE;         break; }
+    }
+
+  return (grib_ltype);
+}
+
+
+int zaxisTypeToGrib2ltype(int zaxistype)
+{
+  int grib_ltype = -1;
+
+  switch (zaxistype)
+    {
+    case ZAXIS_SURFACE:               { grib_ltype = GRIB2_LTYPE_SURFACE;            break; }
+    case ZAXIS_MEANSEA:               { grib_ltype = GRIB2_LTYPE_MEANSEA;            break; }
+    case ZAXIS_HEIGHT:                { grib_ltype = GRIB2_LTYPE_HEIGHT;             break; }
+    case ZAXIS_ALTITUDE:              { grib_ltype = GRIB2_LTYPE_ALTITUDE;           break; }
+    case ZAXIS_SIGMA:                 { grib_ltype = GRIB2_LTYPE_SIGMA;              break; }
+    case ZAXIS_DEPTH_BELOW_SEA:       { grib_ltype = GRIB2_LTYPE_SEADEPTH;           break; }
+    case ZAXIS_ISENTROPIC:            { grib_ltype = GRIB2_LTYPE_ISENTROPIC;         break; }
+    case ZAXIS_CLOUD_BASE:            { grib_ltype = GRIB2_LTYPE_CLOUD_BASE;         break; }
+    case ZAXIS_CLOUD_TOP:             { grib_ltype = GRIB2_LTYPE_CLOUD_TOP;          break; }
+    case ZAXIS_ISOTHERM_ZERO:         { grib_ltype = GRIB2_LTYPE_ISOTHERM0;          break; }
+    case ZAXIS_TOA:                   { grib_ltype = GRIB2_LTYPE_TOA;                break; }
+    case ZAXIS_SEA_BOTTOM:            { grib_ltype = GRIB2_LTYPE_SEA_BOTTOM;         break; }
+    case ZAXIS_LAKE_BOTTOM:           { grib_ltype = GRIB2_LTYPE_LAKE_BOTTOM;        break; }
+    case ZAXIS_SEDIMENT_BOTTOM:       { grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM;    break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TA:    { grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TA; break; }
+    case ZAXIS_SEDIMENT_BOTTOM_TW:    { grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TW; break; }
+    case ZAXIS_MIX_LAYER:             { grib_ltype = GRIB2_LTYPE_MIX_LAYER;          break; }
+    case ZAXIS_ATMOSPHERE:            { grib_ltype = GRIB2_LTYPE_ATMOSPHERE;         break; }
+    }
+
+  return (grib_ltype);
+}
+
+
 int grbBitsPerValue(int datatype)
 {
   int bitsPerValue = 16;
@@ -558,14 +625,13 @@ int grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype
   if ( streamptr->comptype == COMPRESS_SZIP )
     nbytes = grbSzip(filetype, gribbuffer, nbytes);
 
-  /* begin deike */
-#ifdef USE_MPI
-  if ( commInqIOMode () != PIO_NONE )
-    nwrite = pioFileWrite ( fileID, tsID, gribbuffer, nbytes );
-  else
-#endif
-  /* end deike */
-    nwrite = fileWrite(fileID, gribbuffer, nbytes);
+  {
+    size_t (*myFileWrite)(int fileID, const void *restrict buffer,
+                          size_t len, int tsID)
+      = (size_t (*)(int, const void *restrict, size_t, int))
+      namespaceSwitchGet(NSSWITCH_FILE_WRITE).func;
+    nwrite = myFileWrite(fileID, gribbuffer, nbytes, tsID);
+  }
 
   if ( nwrite != nbytes ) perror(__func__);
 
diff --git a/libcdi/src/stream_grb.h b/libcdi/src/stream_grb.h
index 1430b68..ba5bd77 100644
--- a/libcdi/src/stream_grb.h
+++ b/libcdi/src/stream_grb.h
@@ -21,6 +21,9 @@ int   grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memty
 int   grib1ltypeToZaxisType(int grib_ltype);
 int   grib2ltypeToZaxisType(int grib_ltype);
 
+int   zaxisTypeToGrib1ltype(int zaxistype);
+int   zaxisTypeToGrib2ltype(int zaxistype);
+
 #endif  /* _STREAM_GRB_H */
 /*
  * Local Variables:
diff --git a/libcdi/src/stream_gribapi.c b/libcdi/src/stream_gribapi.c
index 47439b0..aa0c37d 100644
--- a/libcdi/src/stream_gribapi.c
+++ b/libcdi/src/stream_gribapi.c
@@ -50,21 +50,21 @@ int gribapiGetGridType(grib_handle *gh)
 
       switch (gribgridtype)
 	{
-	case  GRIB2_GTYPE_LATLON:     { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
-	                                if ( lpar == (long) GRIB_MISSING_LONG ) break;
-                                      }
-	case  GRIB2_GTYPE_LATLON_ROT: { gridtype = GRID_LONLAT;    break; }
-	case  GRIB2_GTYPE_LCC:        { gridtype = GRID_LCC;       break; }
-	case  GRIB2_GTYPE_GAUSSIAN:   { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
-	                                if ( lpar == (long) GRIB_MISSING_LONG )
-					  gridtype = GRID_GAUSSIAN_REDUCED;
-					else
-					  gridtype = GRID_GAUSSIAN;
-					break;
-                                      }
-	case  GRIB2_GTYPE_SPECTRAL:   { gridtype = GRID_SPECTRAL;  break; }
-	case  GRIB2_GTYPE_GME:        { gridtype = GRID_GME;       break; }
-	case  GRIB2_GTYPE_NUMBER:     { gridtype = GRID_REFERENCE; break; }
+	case  GRIB2_GTYPE_LATLON:        { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
+	                                   if ( lpar == (long) GRIB_MISSING_LONG ) break;
+                                         }
+	case  GRIB2_GTYPE_LATLON_ROT:    { gridtype = GRID_LONLAT;    break; }
+	case  GRIB2_GTYPE_LCC:           { gridtype = GRID_LCC;       break; }
+	case  GRIB2_GTYPE_GAUSSIAN:      { GRIB_CHECK(grib_get_long(gh, "Ni", &lpar), 0);
+	                                   if ( lpar == (long) GRIB_MISSING_LONG )
+					     gridtype = GRID_GAUSSIAN_REDUCED;
+					   else
+					     gridtype = GRID_GAUSSIAN;
+				  	   break;
+                                         }
+	case  GRIB2_GTYPE_SPECTRAL:      { gridtype = GRID_SPECTRAL;  break; }
+	case  GRIB2_GTYPE_GME:           { gridtype = GRID_GME;       break; }
+	case  GRIB2_GTYPE_UNSTRUCTURED:  { gridtype = GRID_UNSTRUCTURED; break; }
 	}
     }
 
@@ -301,6 +301,10 @@ int gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
     {
       GRIB_CHECK(grib_get_long(gh, "significanceOfReferenceTime", &sigofrtime), 0);
     }
+  else
+    {
+      GRIB_CHECK(grib_get_long(gh, "timeRangeIndicator", &sigofrtime), 0);
+    }
 
   if ( sigofrtime == 3 )
     {
@@ -585,7 +589,7 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
 
 	break;
       }
-    case GRID_REFERENCE:
+    case GRID_UNSTRUCTURED:
       {
         char uuid[17];
     	char reference_link[8192];
@@ -597,11 +601,13 @@ void gribapiGetGrid(grib_handle *gh, grid_t *grid)
           {
             grid->number   = lpar;
             if ( grib_get_long(gh, "numberOfGridInReference", &lpar) == 0 ) grid->position = lpar;
+            /*
             if ( grib_get_string(gh, "gridDescriptionFile", reference_link, &len) == 0 )
               {
                 if ( strncmp(reference_link, "file://", 7) == 0 )
                   grid->reference = strdupx(reference_link);
               }
+            */
             len = (size_t) 16;
             if ( grib_get_bytes(gh, "uuidOfHGrid", (unsigned char *) uuid, &len) == 0)
               {
@@ -742,6 +748,7 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
       if ( status == 0 ) leveltype2 = lpar;
 
       if ( *leveltype != 255 && leveltype2 != 255 && leveltype2 > 0 ) *lbounds = 1;
+      if ( *leveltype == GRIB2_LTYPE_REFERENCE && leveltype2 == 1 ) *lbounds = 0;
 
       if ( *leveltype == GRIB2_LTYPE_LANDDEPTH )
         {
@@ -756,8 +763,13 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
 
       GRIB_CHECK(grib_get_long(gh, "scaleFactorOfFirstFixedSurface", &factor), 0);
       GRIB_CHECK(grib_get_long(gh, "scaledValueOfFirstFixedSurface", &llevel), 0);
-      if ( llevel != GRIB_MISSING_LONG && factor != GRIB_MISSING_LONG )
-        dlevel1 = llevel*grib2ScaleFactor(factor);
+      if ( llevel != GRIB_MISSING_LONG )
+        {
+          if ( factor != GRIB_MISSING_LONG )
+            dlevel1 = llevel*grib2ScaleFactor(factor);
+          else
+            dlevel1 = llevel;
+        }
 
       if ( *level_sf != 0 ) dlevel1 *= (*level_sf);
 
@@ -765,8 +777,13 @@ void grib2GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, i
 	{
           GRIB_CHECK(grib_get_long(gh, "scaleFactorOfSecondFixedSurface", &factor), 0);
           GRIB_CHECK(grib_get_long(gh, "scaledValueOfSecondFixedSurface", &llevel), 0);
-          if ( llevel != GRIB_MISSING_LONG && factor != GRIB_MISSING_LONG )
-            dlevel2 = llevel*grib2ScaleFactor(factor);
+          if ( llevel != GRIB_MISSING_LONG )
+            {
+              if ( factor != GRIB_MISSING_LONG )
+                dlevel2 = llevel*grib2ScaleFactor(factor);
+              else
+                dlevel2 = llevel;
+            }
 
           if ( *level_sf != 0 ) dlevel2 *= (*level_sf);
         }
@@ -860,22 +877,22 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
       {
         size_t len;
         char uuid[17];
-        double dtmp;
-        long nlev, nvgrid;
+        long ltmp;
+        long nhlev, nvgrid;
 
         GRIB_CHECK(grib_get_long(gh, "NV", &lpar), 0);
         if ( lpar != 6 )
           {
             fprintf(stderr, "Warning ...\n");
           }
-        GRIB_CHECK(grib_get_double(gh, "nlev", &dtmp), 0);
-        nlev = (int) NINT(dtmp);
-        GRIB_CHECK(grib_get_double(gh, "numberOfVGridUsed", &dtmp), 0);
-        nvgrid = NINT(dtmp);
+        GRIB_CHECK(grib_get_long(gh, "nlev", &ltmp), 0);
+        nhlev = ltmp;
+        GRIB_CHECK(grib_get_long(gh, "numberOfVGridUsed", &ltmp), 0);
+        nvgrid = ltmp;
         len = (size_t) 16;
         uuid[16] = 0;
         GRIB_CHECK(grib_get_bytes(gh, "uuidOfVGrid", (unsigned char *) uuid, &len), 0);
-        varDefZAxisReference((int) nlev, (int) nvgrid, uuid);
+        varDefZAxisReference((int) nhlev, (int) nvgrid, uuid);
         break;
       }
     }
@@ -908,18 +925,21 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
     Get the ensemble Info from the grib-2 Tables and update the intermediate datastructure.
     Further update to the "vlist" is handled in the same way as for GRIB-1 by "cdi_generate_vars"
   */
-  {
-    int status;
-    status = grib_get_long(gh, "typeOfEnsembleForecast", &ens_forecast_type );
-    if ( status == 0 )
-      {
-        GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", &ens_count ), 0);
-        GRIB_CHECK(grib_get_long(gh, "perturbationNumber", &ens_index ), 0);
-      }
-  }
+  status = grib_get_long(gh, "typeOfEnsembleForecast", &ens_forecast_type );
+  if ( status == 0 )
+    {
+      GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", &ens_count ), 0);
+      GRIB_CHECK(grib_get_long(gh, "perturbationNumber", &ens_index ), 0);
+    }
+
   if ( ens_index > 0 )
     varDefEnsembleInfo(varID, (int)ens_index, (int)ens_count, (int)ens_forecast_type);
 
+  long typeOfGeneratingProcess = 0;
+  status = grib_get_long(gh, "typeOfGeneratingProcess", &typeOfGeneratingProcess);
+  if ( status == 0 )
+    varDefTypeOfGeneratingProcess(varID, (int) typeOfGeneratingProcess);
+
   int    i;
   long   lval;
   double dval;
@@ -1192,7 +1212,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
 
       gribapiGetValidityDateTime(gh, &vdate, &vtime);
       /*
-      printf("%d %d %d.%d.%d %d\n", vdate, vtime, pnum, pcat, pdis, leveltype);
+      printf("%d %d %d\n", vdate, vtime, leveltype);
       */
       if ( lieee )
         {
@@ -1238,9 +1258,22 @@ int gribapiScanTimestep1(stream_t * streamptr)
 	      if ( warn_time )
 		if ( memcmp(&datetime, &datetime0, sizeof(DateTime)) != 0 )
 		  {
-		    Warning("Inconsistent verification time (param=%s level=%d)", paramstr, level1);
-		    warn_time = FALSE;
-		  }
+                    if ( datetime0.date == 10101 && datetime0.time == 0 )
+                      {
+                        datetime0.date = datetime.date;
+                        datetime0.time = datetime.time;
+
+                        gribapiGetDataDateTime(gh, &rdate, &rtime);
+
+                        fcast = gribapiTimeIsFC(gh);
+                        if ( fcast ) tunit = gribapiGetTimeUnits(gh);
+                      }
+                    else
+                      {
+                        Warning("Inconsistent verification time (param=%s level=%d)", paramstr, level1);
+                        warn_time = FALSE;
+                      }
+                  }
 	    }
 	  else
 	    {
@@ -2167,17 +2200,23 @@ int gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, int rdate, int rti
 }
 
 static
-void gribapiDefTime(int editionNumber, grib_handle *gh , int vdate, int vtime, int tsteptype, int numavg, int taxisID, int gcinit)
+void gribapiDefTime(int editionNumber, int typeOfGeneratingProcess, grib_handle *gh , int vdate, int vtime, int tsteptype, int numavg, int taxisID, int gcinit)
 {
   int taxistype = -1;
-  int timeunit;
-  int factor;
 
   if ( taxisID != -1 ) taxistype = taxisInqType(taxisID);
 
-  timeunit = taxisInqTunit(taxisID);
-
-  factor = gribapiDefStepUnits(gh, timeunit, gcinit);
+  if ( typeOfGeneratingProcess == 196 )
+    {
+      vdate = 10101;
+      vtime = 0;
+      taxistype = TAXIS_ABSOLUTE;
+    }
+  /*
+  else if ( typeOfGeneratingProcess == 9 )
+    {
+    }
+  */
 
   if ( taxistype == TAXIS_RELATIVE )
     {
@@ -2185,6 +2224,8 @@ void gribapiDefTime(int editionNumber, grib_handle *gh , int vdate, int vtime, i
       int calendar = taxisInqCalendar(taxisID);
       int rdate    = taxisInqRdate(taxisID);
       int rtime    = taxisInqRtime(taxisID);
+      int timeunit = taxisInqTunit(taxisID);
+      int factor   = gribapiDefStepUnits(gh, timeunit, gcinit);
 
       status = gribapiDefDateTimeRel(editionNumber, gh, rdate, rtime, vdate, vtime,
                                      tsteptype, factor, calendar, gcinit);
@@ -2203,7 +2244,6 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
 {
   int gridtype;
   int status;
-  char uuid[17];
   static short lwarn = TRUE;
   size_t len;
   char *mesg;
@@ -2211,7 +2251,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
   gridtype = gridInqType(gridID);
 
   if ( editionNumber <= 1 )
-    if ( gridtype == GRID_GME || gridtype == GRID_REFERENCE )
+    if ( gridtype == GRID_GME || gridtype == GRID_UNSTRUCTURED )
       gridtype = -1;
 
   if ( gridtype == GRID_GENERIC )
@@ -2532,7 +2572,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
 	GRIB_CHECK(grib_set_long(gh, "Ni", gridInqGMEni(gridID)), 0);
 	GRIB_CHECK(grib_set_long(gh, "n2", gridInqGMEni2(gridID)), 0);
 	GRIB_CHECK(grib_set_long(gh, "n3", gridInqGMEni3(gridID)), 0);
-	GRIB_CHECK(grib_set_long(gh, "latitudeOfThePolePoint", 90000), 0);
+	GRIB_CHECK(grib_set_long(gh, "latitudeOfThePolePoint", 90000000), 0);
 	GRIB_CHECK(grib_set_long(gh, "longitudeOfThePolePoint", 0), 0);
 
 	GRIB_CHECK(grib_set_long(gh, "numberOfDataPoints", gridInqSize(gridID)), 0);
@@ -2540,21 +2580,26 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int ljpeg, i
 
 	break;
       }
-    case GRID_REFERENCE:
+    case GRID_UNSTRUCTURED:
       {
 	static int warning = 1;
-	status = grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_NUMBER);
+	status = grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_UNSTRUCTURED);
 	if ( status != 0 && warning )
 	  {
 	    warning = 0;
 	    Warning("Can't write reference grid!");
 	    Warning("gridDefinitionTemplateNumber %d not found (grib2/template.3.%d.def)!",
-		    GRIB2_GTYPE_NUMBER, GRIB2_GTYPE_NUMBER);
+		    GRIB2_GTYPE_UNSTRUCTURED, GRIB2_GTYPE_UNSTRUCTURED);
 	  }
 	else
 	  {
-	    GRIB_CHECK(grib_set_long(gh, "numberOfGridUsed", gridInqNumber(gridID)), 0);
-	    GRIB_CHECK(grib_set_long(gh, "numberOfGridInReference", gridInqPosition(gridID)), 0);
+            char uuid[17];
+            int position = gridInqPosition(gridID);
+            int number = gridInqNumber(gridID);
+            if ( position < 0 ) position = 0;
+            if ( number < 0 ) number = 0;
+	    GRIB_CHECK(grib_set_long(gh, "numberOfGridUsed", number), 0);
+	    GRIB_CHECK(grib_set_long(gh, "numberOfGridInReference", position), 0);
             len = 16;
 	    if (grib_set_bytes(gh, "uuidOfHGrid", (unsigned char *) gridInqUUID(gridID, uuid), &len) != 0)
 	      Warning("Can't write UUID!");
@@ -2624,7 +2669,6 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
   int lbounds = 0;
   int zaxistype, ltype;
   static int warning = 1;
-  int reference;
   char uuid[17];
   size_t len;
   double scalefactor;
@@ -2658,80 +2702,58 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
   switch (zaxistype)
     {
     case ZAXIS_SURFACE:
+    case ZAXIS_MEANSEA:
+    case ZAXIS_HEIGHT:
+    case ZAXIS_ALTITUDE:
+    case ZAXIS_SIGMA:
+    case ZAXIS_DEPTH_BELOW_SEA:
+    case ZAXIS_ISENTROPIC:
       {
 	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SURFACE);
+          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", zaxisTypeToGrib1ltype(zaxistype));
         else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SURFACE);
+          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
 
         GRIB_CHECK(grib_set_long(gh, "level", level), 0);
 
 	break;
       }
     case ZAXIS_CLOUD_BASE:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_CLOUDBASE);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_CLOUDBASE);
-
-        break;
-      }
     case ZAXIS_CLOUD_TOP:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_CLOUDTOP);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_CLOUDTOP);
-
-        break;
-      }
     case ZAXIS_ISOTHERM_ZERO:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ISOTHERM0);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ISOTHERM0);
-
-        break;
-      }
     case ZAXIS_TOA:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_TOA);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_TOA);
-
-        break;
-      }
     case ZAXIS_SEA_BOTTOM:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SEA_BOTTOM);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SEA_BOTTOM);
-
-        break;
-      }
+    case ZAXIS_LAKE_BOTTOM:
+    case ZAXIS_SEDIMENT_BOTTOM:
+    case ZAXIS_SEDIMENT_BOTTOM_TA:
+    case ZAXIS_SEDIMENT_BOTTOM_TW:
+    case ZAXIS_MIX_LAYER:
     case ZAXIS_ATMOSPHERE:
       {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ATMOSPHERE);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ATMOSPHERE);
+        if ( lbounds )
+          {
+            if ( editionNumber <= 1 )
+              gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", zaxisTypeToGrib1ltype(zaxistype));
+            else
+              {
+                gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
+                gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
+              }
 
-        break;
-      }
-    case ZAXIS_MEANSEA:
-      {
-	if ( editionNumber <= 1 )
-	  gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_MEANSEA);
+            GRIB_CHECK(grib_set_long(gh, "topLevel", (long) dlevel1), 0);
+            GRIB_CHECK(grib_set_long(gh, "bottomLevel", (long) dlevel2), 0);
+          }
         else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_MEANSEA);
+          {
+            if ( editionNumber <= 1 )
+              gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", zaxisTypeToGrib1ltype(zaxistype));
+            else
+              gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", zaxisTypeToGrib2ltype(zaxistype));
 
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+            GRIB_CHECK(grib_set_long(gh, "level", (long) level), 0);
+          }
 
-	break;
+        break;
       }
     case ZAXIS_HYBRID:
     case ZAXIS_HYBRID_HALF:
@@ -2820,39 +2842,6 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
 
 	break;
       }
-    case ZAXIS_HEIGHT:
-      {
-        if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_HEIGHT);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_HEIGHT);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
-    case ZAXIS_ALTITUDE:
-      {
-        if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ALTITUDE);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ALTITUDE);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
-    case ZAXIS_SIGMA:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SIGMA);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SIGMA);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
     case ZAXIS_DEPTH_BELOW_LAND:
       {
 	char units[128];
@@ -2878,50 +2867,57 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
 
             level   *= scalefactor;
             dlevel1 *= scalefactor;
-            dlevel1 *= scalefactor;
+            dlevel2 *= scalefactor;
 
             grib2DefLevel(gh, gcinit, GRIB2_LTYPE_LANDDEPTH, lbounds, level, dlevel1, dlevel2);
 	  }
 
 	break;
       }
-    case ZAXIS_DEPTH_BELOW_SEA:
-      {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_SEADEPTH);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_SEADEPTH);
-
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
-
-	break;
-      }
-    case ZAXIS_ISENTROPIC:
+    case ZAXIS_REFERENCE:
       {
-	if ( editionNumber <= 1 )
-          gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", GRIB1_LTYPE_ISENTROPIC);
-        else
-          gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_ISENTROPIC);
+        int number;
 
-	GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+        if ( !gcinit )
+          {
+            GRIB_CHECK(grib_set_long(gh, "genVertHeightCoords", 1), 0);
+          }
 
-	break;
-      }
-    case ZAXIS_REFERENCE:
-      {
-        if ( editionNumber <= 1 )
-          ; // not available
+        if ( lbounds )
+          {
+            if ( editionNumber <= 1 )
+              ; // not available
+            else
+              {
+                number = zaxisInqNumber(zaxisID);
+                gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
+                gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", GRIB2_LTYPE_REFERENCE);
+                GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
+                GRIB_CHECK(grib_set_long(gh, "nlev", zaxisInqNlevRef(zaxisID)), 0);
+                GRIB_CHECK(grib_set_long(gh, "numberOfVGridUsed", number), 0);
+                len = 16;
+                if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
+                  Warning("Can't write UUID!");
+                GRIB_CHECK(grib_set_long(gh, "topLevel", (long) dlevel1), 0);
+                GRIB_CHECK(grib_set_long(gh, "bottomLevel", (long) dlevel2), 0);
+              }
+          }
         else
           {
-            reference = zaxisInqReference(zaxisID);
-            gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
-            GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
-            GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)), 0);
-            GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
-            len = 16;
-	    if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
-	      Warning("Can't write UUID!");
-            GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+            if ( editionNumber <= 1 )
+              ; // not available
+            else
+              {
+                number = zaxisInqNumber(zaxisID);
+                gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
+                GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
+                GRIB_CHECK(grib_set_long(gh, "nlev", zaxisInqNlevRef(zaxisID)), 0);
+                GRIB_CHECK(grib_set_long(gh, "numberOfVGridUsed", number), 0);
+                len = 16;
+                if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
+                  Warning("Can't write UUID!");
+                GRIB_CHECK(grib_set_double(gh, "level", level), 0);
+              }
           }
 
         break;
@@ -2985,6 +2981,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
   int param;
   int lieee = FALSE;
   int ensID, ensCount, forecast_type; /* Ensemble Data */
+  int typeOfGeneratingProcess;
   long bitsPerValue;
   long editionNumber = 2;
   char name[256];
@@ -2994,6 +2991,8 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
 
   param    = vlistInqVarParam(vlistID, varID);
   datatype = vlistInqVarDatatype(vlistID, varID);
+  typeOfGeneratingProcess = vlistInqVarTypeOfGeneratingProcess(vlistID, varID);
+
   vlistInqVarName(vlistID, varID, name);
 
 #if defined(GRIBAPIENCODETEST)
@@ -3004,6 +3003,9 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
 
   GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
 
+  if ( typeOfGeneratingProcess == -1 ) typeOfGeneratingProcess = 0;
+  if ( ! gc->init ) GRIB_CHECK(grib_set_long(gh, "typeOfGeneratingProcess", typeOfGeneratingProcess), 0);
+
   if ( ! gc->init ) gribapiDefInstitut(gh, vlistID, varID);
   if ( ! gc->init ) gribapiDefModel(gh, vlistID, varID);
 
@@ -3016,7 +3018,8 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
       GRIB_CHECK(grib_set_long(gh, "perturbationNumber", ensID ), 0);
     }
   */
-  gribapiDefTime(editionNumber, gh, vdate, vtime, tsteptype, numavg, vlistInqTaxis(vlistID), gc->init);
+
+  gribapiDefTime(editionNumber, typeOfGeneratingProcess, gh, vdate, vtime, tsteptype, numavg, vlistInqTaxis(vlistID), gc->init);
 
   if ( editionNumber == 2 && (datatype == DATATYPE_FLT32 || datatype == DATATYPE_FLT64) ) lieee = TRUE;
 
diff --git a/libcdi/src/stream_record.c b/libcdi/src/stream_record.c
index 71dc7a6..9424ffb 100644
--- a/libcdi/src/stream_record.c
+++ b/libcdi/src/stream_record.c
@@ -242,6 +242,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
     case FILETYPE_GRB:
     case FILETYPE_GRB2:
       {
+        /* FIXME: return value not inspected */
         status = grbDefRecord(streamptr);
 	break;
       }
@@ -249,6 +250,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
 #if  defined  (HAVE_LIBSERVICE)
     case FILETYPE_SRV:
       {
+        /* FIXME: return value not inspected */
         status = srvDefRecord(streamptr);
 	break;
       }
@@ -256,6 +258,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
 #if  defined  (HAVE_LIBEXTRA)
     case FILETYPE_EXT:
       {
+        /* FIXME: return value not inspected */
         status = extDefRecord(streamptr);
 	break;
       }
@@ -263,6 +266,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
 #if  defined  (HAVE_LIBIEG)
     case FILETYPE_IEG:
       {
+        /* FIXME: return value not inspected */
         status = iegDefRecord(streamptr);
 	break;
       }
@@ -310,6 +314,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
     case FILETYPE_GRB:
     case FILETYPE_GRB2:
       {
+        /* FIXME: return value not inspected */
         status = grbReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -317,6 +322,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
 #if  defined  (HAVE_LIBSERVICE)
     case FILETYPE_SRV:
       {
+        /* FIXME: return value not inspected */
         status = srvReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -324,6 +330,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
 #if  defined  (HAVE_LIBEXTRA)
     case FILETYPE_EXT:
       {
+        /* FIXME: return value not inspected */
         status = extReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -331,6 +338,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
 #if  defined  (HAVE_LIBIEG)
     case FILETYPE_IEG:
       {
+        /* FIXME: return value not inspected */
         status = iegReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -341,6 +349,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
     case FILETYPE_NC4:
     case FILETYPE_NC4C:
       {
+        /* FIXME: return value not inspected */
 	status = cdfReadRecord(streamptr, data, nmiss);
 	break;
       }
@@ -450,6 +459,28 @@ void streamCopyRecord(int streamID2, int streamID1)
 
   if ( filetype1 == filetype2 ) filetype = filetype2;
   else
+    {
+      switch (filetype1)
+        {
+        case FILETYPE_NC:
+        case FILETYPE_NC2:
+        case FILETYPE_NC4:
+        case FILETYPE_NC4C:
+          switch (filetype2)
+            {
+            case FILETYPE_NC:
+            case FILETYPE_NC2:
+            case FILETYPE_NC4:
+            case FILETYPE_NC4C:
+              Warning("Streams have different file types (%s -> %s)!", strfiletype(filetype1), strfiletype(filetype2));
+              filetype = filetype2;
+              break;
+            }
+          break;
+        }
+    }
+
+  if ( filetype == CDI_UNDEFID )
     Error("Streams have different file types (%s -> %s)!", strfiletype(filetype1), strfiletype(filetype2));
 
   switch (filetype)
@@ -458,6 +489,7 @@ void streamCopyRecord(int streamID2, int streamID1)
     case FILETYPE_GRB:
     case FILETYPE_GRB2:
       {
+        /* FIXME: return value not inspected */
 	status = grbCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -465,6 +497,7 @@ void streamCopyRecord(int streamID2, int streamID1)
 #if  defined  (HAVE_LIBSERVICE)
     case FILETYPE_SRV:
       {
+        /* FIXME: return value not inspected */
 	status = srvCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -472,6 +505,7 @@ void streamCopyRecord(int streamID2, int streamID1)
 #if  defined  (HAVE_LIBEXTRA)
     case FILETYPE_EXT:
       {
+        /* FIXME: return value not inspected */
 	status = extCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -479,6 +513,7 @@ void streamCopyRecord(int streamID2, int streamID1)
 #if  defined  (HAVE_LIBIEG)
     case FILETYPE_IEG:
       {
+        /* FIXME: return value not inspected */
 	status = iegCopyRecord(streamptr2, streamptr1);
 	break;
       }
@@ -489,6 +524,7 @@ void streamCopyRecord(int streamID2, int streamID1)
     case FILETYPE_NC4:
     case FILETYPE_NC4C:
       {
+        /* FIXME: return value not inspected */
 	status = cdfCopyRecord(streamptr2, streamptr1);
 	break;
       }
diff --git a/libcdi/src/stream_srv.c b/libcdi/src/stream_srv.c
index 03458de..5132b5e 100644
--- a/libcdi/src/stream_srv.c
+++ b/libcdi/src/stream_srv.c
@@ -820,7 +820,8 @@ void srvReadVarDP(stream_t *streamptr, int varID, double *data, int *nmiss)
       recID = streamptr->vars[varID].level[levID];
       recpos = streamptr->tsteps[tsid].records[recID].position;
       fileSetPos(fileID, recpos, SEEK_SET);
-      srvRead(fileID, srvp);
+      if (srvRead(fileID, srvp) < 0)
+        abort();
       srvInqHeader(srvp, header);
       srvInqDataDP(srvp, &data[levID*gridsize]);
     }
@@ -866,7 +867,8 @@ void srvReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data,
   recID = streamptr->vars[varID].level[levID];
   recpos = streamptr->tsteps[tsid].records[recID].position;
   fileSetPos(fileID, recpos, SEEK_SET);
-  srvRead(fileID, srvp);
+  if (srvRead(fileID, srvp) < 0)
+    abort();
   srvInqHeader(srvp, header);
   srvInqDataDP(srvp, data);
 
diff --git a/libcdi/src/table.c b/libcdi/src/table.c
index 7649e91..33daaaf 100644
--- a/libcdi/src/table.c
+++ b/libcdi/src/table.c
@@ -148,6 +148,7 @@ int decodeForm1(char *pline, char *name, char *longname, char *units)
   char *pstart, *pend;
   long len;
 
+  /* FIXME: parse success isn't verified */
   level = strtol(pline, &pline, 10);
   while ( isspace((int) *pline) ) pline++;
 
@@ -165,7 +166,9 @@ int decodeForm1(char *pline, char *name, char *longname, char *units)
   len = strlen(pline);
   if ( len == 0 ) return (0);
 
+  /* FIXME: successful parse isn't verified */
   add  = strtod(pline, &pline);
+  /* FIXME: successful parse isn't verified */
   mult = strtod(pline, &pline);
 
   while ( isspace((int) *pline) ) pline++;
diff --git a/libcdi/src/taxis.c b/libcdi/src/taxis.c
index ee33c31..0b49566 100644
--- a/libcdi/src/taxis.c
+++ b/libcdi/src/taxis.c
@@ -3,9 +3,6 @@
 #endif
 
 #include <string.h>
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
 
 #include "dmemory.h"
 
@@ -15,9 +12,9 @@
 #include "calendar.h"
 #include "pio_util.h"
 #include "namespace.h"
+#include "serialize.h"
 #include "resource_handle.h"
-#include "pio_rpc.h"
-#include "pio_util.h"
+#include "resource_unpack.h"
 
 extern int cdiDefaultCalendar;
 
@@ -43,17 +40,13 @@ char *Timeunits[] = {
 static int    taxisCompareP    ( void * taxisptr1, void * taxisptr2 );
 static void   taxisDestroyP    ( void * taxisptr );
 static void   taxisPrintP      ( void * taxisptr, FILE * fp );
-#ifdef USE_MPI
-static int    taxisGetPackSize ( void * taxisptr, MPI_Comm comm );
+static int    taxisGetPackSize ( void * taxisptr, void *context );
 static void   taxisPack        ( void * taxisptr, void *buf, int size,
-				 int *position, MPI_Comm comm );
+				 int *position, void *context );
 static int    taxisTxCode      ( void );
-#endif
 
 resOps taxisOps = { taxisCompareP, taxisDestroyP, taxisPrintP
-#ifdef USE_MPI
                     , taxisGetPackSize, taxisPack, taxisTxCode
-#endif
 };
 
 
@@ -124,6 +117,7 @@ void taxisDefaultValue ( taxis_t *taxisptr )
   taxisptr->vtime_ub    = 0;
   taxisptr->name        = NULL;
   taxisptr->longname    = NULL;
+  taxisptr->climatology = FALSE;
 }
 
 static
@@ -660,7 +654,7 @@ int taxisInqVtime(int taxisID)
 void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub)
 {
   taxis_t *taxisptr;
-  
+
   taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
 
   taxis_check_ptr(__func__, taxisptr);
@@ -686,7 +680,7 @@ void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub)
 
   taxisptr->vtime_lb = vtime_lb;
   taxisptr->vtime_ub = vtime_ub;
- 
+
   taxisptr->has_bounds = TRUE;
 }
 
@@ -1209,20 +1203,21 @@ void ptaxisCopy(taxis_t *dest, taxis_t *source)
   reshLock ();
 
   /* memcpy(dest, source, sizeof(taxis_t)); */
-  dest->used       = source->used;
-  dest->type       = source->type;
-  dest->vdate      = source->vdate;
-  dest->vtime      = source->vtime;
-  dest->rdate      = source->rdate;
-  dest->rtime      = source->rtime;
-  dest->calendar   = source->calendar;
-  dest->unit       = source->unit;
-  dest->numavg     = source->numavg;
-  dest->has_bounds = source->has_bounds;
-  dest->vdate_lb   = source->vdate_lb;
-  dest->vtime_lb   = source->vtime_lb;
-  dest->vdate_ub   = source->vdate_ub;
-  dest->vtime_ub   = source->vtime_ub;
+  dest->used        = source->used;
+  dest->type        = source->type;
+  dest->vdate       = source->vdate;
+  dest->vtime       = source->vtime;
+  dest->rdate       = source->rdate;
+  dest->rtime       = source->rtime;
+  dest->calendar    = source->calendar;
+  dest->unit        = source->unit;
+  dest->numavg      = source->numavg;
+  dest->has_bounds  = source->has_bounds;
+  dest->vdate_lb    = source->vdate_lb;
+  dest->vtime_lb    = source->vtime_lb;
+  dest->vdate_ub    = source->vdate_ub;
+  dest->vtime_ub    = source->vtime_ub;
+  dest->climatology = source->climatology;
 
   reshUnlock ();
 }
@@ -1241,21 +1236,22 @@ void taxisPrintKernel ( taxis_t * taxisptr, FILE * fp )
   fprintf ( fp, "#\n");
   fprintf ( fp, "# taxisID %d\n", taxisptr->self);
   fprintf ( fp, "#\n");
-  fprintf ( fp, "self       = %d\n", taxisptr->self );
-  fprintf ( fp, "used       = %d\n", taxisptr->used );
-  fprintf ( fp, "type       = %d\n", taxisptr->type );
-  fprintf ( fp, "vdate      = %d\n", taxisptr->vdate );
-  fprintf ( fp, "vtime      = %d\n", taxisptr->vtime );
-  fprintf ( fp, "rdate      = %d\n", taxisptr->rdate );
-  fprintf ( fp, "rtime      = %d\n", taxisptr->rtime );
-  fprintf ( fp, "calendar   = %d\n", taxisptr->calendar );
-  fprintf ( fp, "unit       = %d\n", taxisptr->unit );
-  fprintf ( fp, "numavg     = %d\n", taxisptr->numavg );
-  fprintf ( fp, "has_bounds = %d\n", taxisptr->has_bounds );
-  fprintf ( fp, "vdate_lb   = %d\n", vdate_lb );
-  fprintf ( fp, "vtime_lb   = %d\n", vtime_lb );
-  fprintf ( fp, "vdate_ub   = %d\n", vdate_ub );
-  fprintf ( fp, "vtime_ub   = %d\n", vtime_ub );
+  fprintf ( fp, "self        = %d\n", taxisptr->self );
+  fprintf ( fp, "used        = %d\n", taxisptr->used );
+  fprintf ( fp, "type        = %d\n", taxisptr->type );
+  fprintf ( fp, "vdate       = %d\n", taxisptr->vdate );
+  fprintf ( fp, "vtime       = %d\n", taxisptr->vtime );
+  fprintf ( fp, "rdate       = %d\n", taxisptr->rdate );
+  fprintf ( fp, "rtime       = %d\n", taxisptr->rtime );
+  fprintf ( fp, "calendar    = %d\n", taxisptr->calendar );
+  fprintf ( fp, "unit        = %d\n", taxisptr->unit );
+  fprintf ( fp, "numavg      = %d\n", taxisptr->numavg );
+  fprintf ( fp, "climatology = %d\n", taxisptr->climatology );
+  fprintf ( fp, "has_bounds  = %d\n", taxisptr->has_bounds );
+  fprintf ( fp, "vdate_lb    = %d\n", vdate_lb );
+  fprintf ( fp, "vtime_lb    = %d\n", vtime_lb );
+  fprintf ( fp, "vdate_ub    = %d\n", vdate_ub );
+  fprintf ( fp, "vtime_ub    = %d\n", vtime_ub );
   fprintf ( fp, "\n");
 }
 
@@ -1282,116 +1278,150 @@ int taxisCompareP ( void *  taxisptr1, void * taxisptr2 )
   xassert ( t1 );
   xassert ( t2 );
 
-  return ! ( t1->used       == t2->used       &&
-	     t1->type       == t2->type       &&
-	     t1->vdate      == t2->vdate      &&
-	     t1->vtime      == t2->vtime      &&
-	     t1->rdate      == t2->rdate      &&
-	     t1->rtime      == t2->rtime      &&
-	     t1->calendar   == t2->calendar   &&
-	     t1->unit       == t2->unit       &&
-	     t1->numavg     == t2->numavg     &&
-	     t1->has_bounds == t2->has_bounds &&
-	     t1->vdate_lb   == t2->vdate_lb   &&
-	     t1->vtime_lb   == t2->vtime_lb   &&
-	     t1->vdate_ub   == t2->vdate_ub   &&
-	     t1->vtime_ub   == t2->vtime_ub );
+  return ! ( t1->used        == t2->used        &&
+	     t1->type        == t2->type        &&
+	     t1->vdate       == t2->vdate       &&
+	     t1->vtime       == t2->vtime       &&
+	     t1->rdate       == t2->rdate       &&
+	     t1->rtime       == t2->rtime       &&
+	     t1->calendar    == t2->calendar    &&
+	     t1->unit        == t2->unit        &&
+	     t1->numavg      == t2->numavg      &&
+	     t1->climatology == t2->climatology &&
+	     t1->has_bounds  == t2->has_bounds  &&
+	     t1->vdate_lb    == t2->vdate_lb    &&
+	     t1->vtime_lb    == t2->vtime_lb    &&
+	     t1->vdate_ub    == t2->vdate_ub    &&
+	     t1->vtime_ub    == t2->vtime_ub );
 }
 
 
-#ifdef USE_MPI
 static int
 taxisTxCode ( void )
 {
   return TAXIS;
 }
 
-enum { taxisNint = 15 };
+enum { taxisNint = 18 };
 
-static
-int taxisGetPackSize ( void * voidP, MPI_Comm comm )
+static int
+taxisGetPackSize(void *p, void *context)
 {
-  int packBufferSize = 0, size;
-
-  xmpi ( MPI_Pack_size ( taxisNint, MPI_INT, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
-
+  taxis_t *taxisptr = p;
+  int packBufferSize
+    = serializeGetSize(taxisNint, DATATYPE_INT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context)
+    + (taxisptr->name ?
+       serializeGetSize(strlen(taxisptr->name), DATATYPE_TXT, context) : 0)
+    + (taxisptr->longname ?
+       serializeGetSize(strlen(taxisptr->longname), DATATYPE_TXT,
+                        context) : 0);
   return packBufferSize;
 }
 
-
-void taxisUnpack ( char * unpackBuffer, int unpackBufferSize,
-		   int * unpackBufferPos, int nspTarget, MPI_Comm comm )
+int
+taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
+            int nspTarget, void *context, int checkForSameID)
 {
   taxis_t * taxisP;
   int intBuffer[taxisNint];
   double d;
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-		      intBuffer, taxisNint, MPI_INT, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-		      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  intBuffer, taxisNint, DATATYPE_INT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( xchecksum ( DATATYPE_INT, taxisNint, intBuffer ) == d );
+  xassert(xchecksum(DATATYPE_INT, taxisNint, intBuffer) == d);
 
-  taxisInit ();
+  taxisInit();
 
   taxisP = taxisNewEntry();
   if ( ! taxisP ) Error("No memory");
 
-  xassert ( namespaceAdaptKey ( intBuffer[0], nspTarget ) == taxisP->self );
-
-  taxisP->used       = intBuffer[1];
-  taxisP->type       = intBuffer[2];
-  taxisP->vdate      = intBuffer[3];
-  taxisP->vtime      = intBuffer[4];
-  taxisP->rdate      = intBuffer[5];
-  taxisP->rtime      = intBuffer[6];
-  taxisP->calendar   = intBuffer[7];
-  taxisP->unit       = intBuffer[8];
-  taxisP->numavg     = intBuffer[9];
-  taxisP->has_bounds = intBuffer[10];
-  taxisP->vdate_lb   = intBuffer[11];
-  taxisP->vtime_lb   = intBuffer[12];
-  taxisP->vdate_ub   = intBuffer[13];
-  taxisP->vtime_ub   = intBuffer[14];
+  xassert(!checkForSameID
+          || namespaceAdaptKey(intBuffer[0], nspTarget) == taxisP->self);
+
+  taxisP->used        = intBuffer[1];
+  taxisP->type        = intBuffer[2];
+  taxisP->vdate       = intBuffer[3];
+  taxisP->vtime       = intBuffer[4];
+  taxisP->rdate       = intBuffer[5];
+  taxisP->rtime       = intBuffer[6];
+  taxisP->calendar    = intBuffer[7];
+  taxisP->unit        = intBuffer[8];
+  taxisP->numavg      = intBuffer[9];
+  taxisP->has_bounds  = intBuffer[10];
+  taxisP->vdate_lb    = intBuffer[11];
+  taxisP->vtime_lb    = intBuffer[12];
+  taxisP->vdate_ub    = intBuffer[13];
+  taxisP->vtime_ub    = intBuffer[14];
+  if (intBuffer[15])
+    {
+      size_t len = intBuffer[15];
+      char *name = xmalloc(len + 1);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      name, len, DATATYPE_TXT, context);
+      name[len] = '\0';
+      taxisP->name = name;
+    }
+  if (intBuffer[16])
+    {
+      size_t len = intBuffer[16];
+      char *longname = xmalloc(len + 1);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      longname, len, DATATYPE_TXT, context);
+      longname[len] = '\0';
+      taxisP->longname = longname;
+    }
+
+  taxisP->climatology = intBuffer[17];
+
+  return taxisP->self;
 }
 
 
-static
-void taxisPack ( void * voidP, void * packBuffer, int packBufferSize,
-		 int * packBufferPos, MPI_Comm comm )
+static void
+taxisPack(void * voidP, void * packBuffer, int packBufferSize, int * packBufferPos,
+          void *context)
 {
-  taxis_t   * taxisP = ( taxis_t * ) voidP;
+  taxis_t *taxisP = (taxis_t *)voidP;
   int intBuffer[taxisNint];
   double d;
 
-  intBuffer[0]  = taxisP->self; 
-  intBuffer[1]  = taxisP->used;      
-  intBuffer[2]  = taxisP->type;      
-  intBuffer[3]  = taxisP->vdate;     
-  intBuffer[4]  = taxisP->vtime;     
-  intBuffer[5]  = taxisP->rdate;     
-  intBuffer[6]  = taxisP->rtime;     
-  intBuffer[7]  = taxisP->calendar;  
-  intBuffer[8]  = taxisP->unit;      
-  intBuffer[9]  = taxisP->numavg;    
+  intBuffer[0]  = taxisP->self;
+  intBuffer[1]  = taxisP->used;
+  intBuffer[2]  = taxisP->type;
+  intBuffer[3]  = taxisP->vdate;
+  intBuffer[4]  = taxisP->vtime;
+  intBuffer[5]  = taxisP->rdate;
+  intBuffer[6]  = taxisP->rtime;
+  intBuffer[7]  = taxisP->calendar;
+  intBuffer[8]  = taxisP->unit;
+  intBuffer[9]  = taxisP->numavg;
   intBuffer[10] = taxisP->has_bounds;
-  intBuffer[11] = taxisP->vdate_lb;  
-  intBuffer[12] = taxisP->vtime_lb;  
-  intBuffer[13] = taxisP->vdate_ub;  
-  intBuffer[14] = taxisP->vtime_ub;  
-  
-  xmpi ( MPI_Pack ( intBuffer, taxisNint, MPI_INT, 
-		    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT, taxisNint, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-		    packBuffer, packBufferSize, packBufferPos, comm ));
+  intBuffer[11] = taxisP->vdate_lb;
+  intBuffer[12] = taxisP->vtime_lb;
+  intBuffer[13] = taxisP->vdate_ub;
+  intBuffer[14] = taxisP->vtime_ub;
+  intBuffer[15] = taxisP->name ? strlen(taxisP->name) : 0;
+  intBuffer[16] = taxisP->longname ? strlen(taxisP->longname) : 0;
+
+  serializePack(intBuffer, taxisNint, DATATYPE_INT,
+                packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_INT, taxisNint, intBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
+  if (taxisP->name)
+    serializePack(taxisP->name, intBuffer[15], DATATYPE_TXT,
+                  packBuffer, packBufferSize, packBufferPos, context);
+  if (taxisP->longname)
+    serializePack(taxisP->longname, intBuffer[16], DATATYPE_TXT,
+                  packBuffer, packBufferSize, packBufferPos, context);
+
+  intBuffer[17] = taxisP->climatology;
 }
 
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/taxis.h b/libcdi/src/taxis.h
index a57e090..72ec845 100644
--- a/libcdi/src/taxis.h
+++ b/libcdi/src/taxis.h
@@ -1,6 +1,9 @@
 #ifndef _TAXIS_H
 #define _TAXIS_H
 
+#ifndef RESOURCE_HANDLE_H
+#include "resource_handle.h"
+#endif
 
 typedef struct {
   /* Date format  YYYYMMDD */
@@ -15,6 +18,7 @@ typedef struct {
   int     calendar;
   int     unit;           /* time unit             */
   int     numavg;
+  int     climatology;
   int     has_bounds;
   int     vdate_lb;       /* lower bounds of vdate */
   int     vtime_lb;       /* lower bounds of vtime */
@@ -33,6 +37,11 @@ double  cdiEncodeTimeval(int date, int time, taxis_t *taxis);
 void    timeval2vtime(double timevalue, taxis_t *taxis, int *vdate, int *vtime);
 double  vtime2timeval(int vdate, int vtime, taxis_t *taxis);
 
+extern resOps taxisOps;
+
+int
+taxisUnpack(char * unpackBuffer, int unpackBufferSize, int * unpackBufferPos,
+            int nspTarget, void *context, int checkForSameID);
 
 #endif  /* _TAXIS_H */
 /*
diff --git a/libcdi/src/varscan.c b/libcdi/src/varscan.c
index 15597a9..8c0f407 100644
--- a/libcdi/src/varscan.c
+++ b/libcdi/src/varscan.c
@@ -38,41 +38,42 @@ leveltable_t;
 
 typedef struct
 {
-  int         param;
-  int         prec;
-  int         tsteptype;
-  int         timave;
-  int         timaccu;
-  int         gridID;
-  int         zaxistype;
-  int         ltype;     /* GRIB level type */
-  int         lbounds;
-  int         level_sf;
-  int         level_unit;
-  int         zaxisID;
-  int         nlevels;
-  int         levelTableSize;
+  int           param;
+  int           prec;
+  int           tsteptype;
+  int           timave;
+  int           timaccu;
+  int           gridID;
+  int           zaxistype;
+  int           ltype;     /* GRIB level type */
+  int           lbounds;
+  int           level_sf;
+  int           level_unit;
+  int           zaxisID;
+  int           nlevels;
+  int           levelTableSize;
   leveltable_t *levelTable;
-  int         instID;
-  int         modelID;
-  int         tableID;
-  int         comptype;       // compression type
-  int         complevel;      // compression level
-  int         lmissval;
-  double      missval;
-  char       *name;
-  char       *longname;
-  char       *units;
-  ensinfo_t  *ensdata;
+  int           instID;
+  int           modelID;
+  int           tableID;
+  int           comptype;       // compression type
+  int           complevel;      // compression level
+  int           lmissval;
+  double        missval;
+  char         *name;
+  char         *longname;
+  char         *units;
+  ensinfo_t    *ensdata;
+  int           typeOfGeneratingProcess;
 #if  defined  (HAVE_LIBGRIB_API)
   /* (Optional) list of keyword/double value pairs */
-  int    opt_grib_dbl_nentries;
-  char*  opt_grib_dbl_keyword[MAX_OPT_GRIB_ENTRIES];
-  double opt_grib_dbl_val[MAX_OPT_GRIB_ENTRIES];
+  int           opt_grib_dbl_nentries;
+  char         *opt_grib_dbl_keyword[MAX_OPT_GRIB_ENTRIES];
+  double        opt_grib_dbl_val[MAX_OPT_GRIB_ENTRIES];
   /* (Optional) list of keyword/integer value pairs */
-  int    opt_grib_int_nentries;
-  char*  opt_grib_int_keyword[MAX_OPT_GRIB_ENTRIES];
-  int    opt_grib_int_val[MAX_OPT_GRIB_ENTRIES];
+  int           opt_grib_int_nentries;
+  char         *opt_grib_int_keyword[MAX_OPT_GRIB_ENTRIES];
+  int           opt_grib_int_val[MAX_OPT_GRIB_ENTRIES];
 #endif
 }
 vartable_t;
@@ -104,6 +105,7 @@ void paramInitEntry(int varID, int param)
   vartable[varID].instID         = UNDEFID;
   vartable[varID].modelID        = UNDEFID;
   vartable[varID].tableID        = UNDEFID;
+  vartable[varID].typeOfGeneratingProcess  = UNDEFID;
   vartable[varID].comptype       = COMPRESS_NONE;
   vartable[varID].complevel      = 1;
   vartable[varID].lmissval       = 0;
@@ -570,6 +572,13 @@ void cdi_generate_vars(stream_t *streamptr)
       zaxisID = varDefZaxis(vlistID, zaxistype, nlevels, dlevels, lbounds, dlevels1, dlevels2,
                             Vctsize, Vct, NULL, NULL, unitptr, 0, 0, ltype);
 
+      if ( zaxisInqType(zaxisID) == ZAXIS_REFERENCE )
+        {
+          if ( numberOfVerticalLevels > 0 ) zaxisDefNlevRef(zaxisID, numberOfVerticalLevels);
+          if ( numberOfVerticalGrid > 0 ) zaxisDefNumber(zaxisID, numberOfVerticalGrid);
+          if ( uuidVGrid[0] != 0 ) zaxisDefUUID(zaxisID, uuidVGrid);
+        }
+
       if ( lbounds ) free(dlevels1);
       if ( lbounds ) free(dlevels2);
       free(dlevels);
@@ -583,6 +592,9 @@ void cdi_generate_vars(stream_t *streamptr)
       vlistDefVarTimaccu(vlistID, varID, timaccu);
       vlistDefVarCompType(vlistID, varID, comptype);
 
+      if ( vartable[varid].typeOfGeneratingProcess != UNDEFID )
+        vlistDefVarTypeOfGeneratingProcess(vlistID, varID, vartable[varid].typeOfGeneratingProcess);
+
       if ( vartable[varid].lmissval ) vlistDefVarMissval(vlistID, varID, vartable[varid].missval);
 
       if ( vartable[varid].name )     vlistDefVarName(vlistID, varID, vartable[varid].name);
@@ -699,9 +711,9 @@ void varDefVCT(size_t vctsize, double *vctptr)
 }
 
 
-void varDefZAxisReference(int nlev, int nvgrid, char *uuid)
+void varDefZAxisReference(int nhlev, int nvgrid, char *uuid)
 {
-  numberOfVerticalLevels = nlev;
+  numberOfVerticalLevels = nhlev;
   numberOfVerticalGrid = nvgrid;
   memcpy(uuidVGrid, uuid, 16);
 }
@@ -996,6 +1008,12 @@ void varDefEnsembleInfo(int varID, int ens_idx, int ens_count, int forecast_type
 }
 
 
+void varDefTypeOfGeneratingProcess(int varID, int typeOfGeneratingProcess)
+{
+  vartable[varID].typeOfGeneratingProcess = typeOfGeneratingProcess;
+}
+
+
 void varDefOptGribInt(int varID, long lval, const char *keyword)
 {
 #if  defined  (HAVE_LIBGRIB_API)
diff --git a/libcdi/src/varscan.h b/libcdi/src/varscan.h
index 084d1f6..f2e17e6 100644
--- a/libcdi/src/varscan.h
+++ b/libcdi/src/varscan.h
@@ -29,6 +29,9 @@ void varDefTable(int varID, int tableID);
 int  varInqTable(int varID);
 void varDefEnsembleInfo(int varID, int ens_idx, int ens_count, int forecast_type);
 
+void varDefTypeOfGeneratingProcess(int varID, int typeOfGeneratingProcess);
+
+
 void varDefOptGribInt(int varID, long lval, const char *keyword);
 void varDefOptGribDbl(int varID, double dval, const char *keyword);
 int varOptGribNentries(int varID);
diff --git a/libcdi/src/vlist.c b/libcdi/src/vlist.c
index 44c57a3..3cbebbf 100644
--- a/libcdi/src/vlist.c
+++ b/libcdi/src/vlist.c
@@ -15,6 +15,9 @@
 #include "vlist_att.h"
 #include "pio_rpc.h"
 
+#include "resource_unpack.h"
+#include "serialize.h"
+
 #if  defined  (HAVE_LIBGRIB_API)
 /* list of additional GRIB2 keywords which are read by the open process */
 int    cdiNAdditionalGRIBKeys = 0;
@@ -25,7 +28,6 @@ extern void zaxisGetIndexList ( int, int * );
 
 static int VLIST_Debug = 0;
 
-static int vlistIsInitialized = 0;
 static void vlist_initialize(void);
 
 #if  defined  (HAVE_LIBPTHREAD)
@@ -38,8 +40,10 @@ static pthread_once_t  _vlist_init_thread = PTHREAD_ONCE_INIT;
 
 #else
 
+static int vlistIsInitialized = 0;
+
 #  define VLIST_INIT()               \
-  if ( vlistIsInitialized == FALSE ) vlist_initialize()
+  if ( !vlistIsInitialized ) vlist_initialize()
 #endif
 
 
@@ -57,22 +61,21 @@ vlist_compare(vlist_t *a, vlist_t *b)
 
 static void
 vlistPrintKernel(vlist_t *vlistptr, FILE * fp );
-#ifdef USE_MPI
-static int  vlistGetSizeP ( void * vlistptr, MPI_Comm comm );
+static void
+vlist_delete(vlist_t *vlistptr);
+
+static int  vlistGetSizeP ( void * vlistptr, void *context);
 static void vlistPackP    ( void * vlistptr, void * buff, int size,
-                            int *position, MPI_Comm comm );
+                            int *position, void *context);
 static int  vlistTxCode   ( void );
-#endif
 
 resOps vlist_ops = {
   (valCompareFunc)vlist_compare,
-  free,
+  (valDestroyFunc)vlist_delete,
   (valPrintFunc)vlistPrintKernel
-#ifdef USE_MPI
   , vlistGetSizeP,
   vlistPackP,
   vlistTxCode
-#endif
 };
 
 
@@ -135,8 +138,9 @@ void vlist_initialize(void)
 
   env = getenv("VLIST_DEBUG");
   if ( env ) VLIST_Debug = atoi(env);
-
+#ifndef HAVE_LIBPTHREAD
   vlistIsInitialized = TRUE;
+#endif
 }
 
 static
@@ -198,31 +202,18 @@ int vlistCreate(void)
   return (vlistID);
 }
 
-/*
- at Function  vlistDestroy
- at Title     Destroy a variable list
-
- at Prototype void vlistDestroy(int vlistID)
- at Parameter
-    @Item  vlistID  Variable list ID, from a previous call to @fref{vlistCreate}
-
- at EndFunction
-*/
-void vlistDestroy(int vlistID)
+static void
+vlist_delete(vlist_t *vlistptr)
 {
-  vlist_t *vlistptr;
-  int nvars;
-  int varID;
-
-  vlistptr = vlist_to_pointer(vlistID);
-
   vlist_check_ptr(__func__, vlistptr);
 
+  int vlistID = vlistptr->self;
+
   vlistDelAtts(vlistID, CDI_GLOBAL);
 
-  nvars = vlistptr->nvars;
+  int nvars = vlistptr->nvars;
 
-  for ( varID = 0; varID < nvars; varID++ )
+  for (int varID = 0; varID < nvars; varID++ )
     {
       if ( vlistptr->vars[varID].levinfo )  free(vlistptr->vars[varID].levinfo);
       if ( vlistptr->vars[varID].name )     free(vlistptr->vars[varID].name);
@@ -252,6 +243,26 @@ void vlistDestroy(int vlistID)
   vlist_delete_entry(vlistptr);
 }
 
+
+/*
+ at Function  vlistDestroy
+ at Title     Destroy a variable list
+
+ at Prototype void vlistDestroy(int vlistID)
+ at Parameter
+    @Item  vlistID  Variable list ID, from a previous call to @fref{vlistCreate}
+
+ at EndFunction
+*/
+void vlistDestroy(int vlistID)
+{
+  vlist_t *vlistptr;
+
+  vlistptr = vlist_to_pointer(vlistID);
+
+  vlist_delete(vlistptr);
+}
+
 /*
 @Function  vlistCopy
 @Title     Copy a variable list
@@ -309,7 +320,6 @@ void vlistCopy(int vlistID2, int vlistID1)
               memcpy(vlistptr2->vars[varID].ensdata,
                      vlistptr1->vars[varID].ensdata, sizeof(ensinfo_t));
             }
-
 #if  defined  (HAVE_LIBGRIB_API)
           /* ---------------------------------- */
           /* Local change: 2013-01-28, FP (DWD) */
@@ -372,9 +382,6 @@ int vlistDuplicate(int vlistID)
 
   vlistCopy(vlistIDnew, vlistID);
 
-  if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
-    reshSetStatus ( vlistIDnew, &vlist_ops, SUSPENDED );
-
   return (vlistIDnew);
 }
 
@@ -1137,7 +1144,7 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
   int param, gridID, zaxisID, tsteptype, nlevs;
   int dtype;
 
-  int i, iorank, decoSize, size, rank, offset, chunk;
+  int iorank;
 
   char paramstr[32];
   char *name, *longname, *units;
@@ -1160,7 +1167,7 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
   if ( nvars > 0 )
     {
       fprintf(fp, " varID param    gridID zaxisID tsteptype nlevel flag "
-              " name     longname iorank decosize\n");
+              " name     longname iorank\n");
       for ( varID = 0; varID < nvars; varID++ )
         {
           param    = vlistptr->vars[varID].param;
@@ -1173,14 +1180,13 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
           units    = vlistptr->vars[varID].units;
           flag     = vlistptr->vars[varID].flag;
           iorank   = vlistptr->vars[varID].iorank;
-          decoSize = vlistptr->vars[varID].decoSize;
 
           cdiParamToString(param, paramstr, sizeof(paramstr));
           fprintf(fp, "%6d %-8s %6d %6d %6d %6d %5d %-8s"
-                  " %s %6d %6d",
+                  " %s %6d",
                   varID, paramstr, gridID, zaxisID, tsteptype, nlevs, flag,
                   name ? name : "", longname ? longname : "",
-                  iorank, decoSize);
+                  iorank);
 
           if ( units ) fprintf ( fp, "   [%s]", units);
           fprintf ( fp, "\n");
@@ -1209,24 +1215,12 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
         }
 
       fprintf(fp, "\n");
-      fprintf(fp, " varID  size iorank decosize corank offset  chunk\n");
+      fprintf(fp, " varID  size iorank\n");
       for ( varID = 0; varID < nvars; varID++ )
-        {
-          iorank    = vlistptr->vars[varID].iorank;
-          decoSize  = vlistptr->vars[varID].decoSize;
-          size      = vlistptr->vars[varID].nlevs *
-            gridInqSize ( vlistptr->vars[varID].gridID );
-
-          for ( i = 0; i < decoSize; i++ )
-            {
-              rank   = vlistptr->vars[varID].deco[i].rank;
-              offset = vlistptr->vars[varID].deco[i].offset;
-              offset = vlistptr->vars[varID].deco[i].offset;
-              chunk  = vlistptr->vars[varID].deco[i].chunk;
-              fprintf ( fp, "%3d %8d %6d %6d %6d %8d %6d\n",
-                        varID, size, iorank, decoSize, rank, offset, chunk );
-            }
-        }
+        fprintf(fp, "%3d %8d %6d\n", varID,
+                vlistptr->vars[varID].nlevs
+                * gridInqSize(vlistptr->vars[varID].gridID),
+                vlistptr->vars[varID].iorank);
     }
 }
 
@@ -1690,8 +1684,6 @@ int vlistHasTime(int vlistID)
   return (hastime);
 }
 
-#ifdef USE_MPI
-
 enum {
   vlist_nints=7,
 };
@@ -1704,21 +1696,21 @@ vlistTxCode ( void )
 
 
 static
-int  vlistGetSizeP ( void * vlistptr, MPI_Comm comm )
+int  vlistGetSizeP ( void * vlistptr, void *context)
 {
   int txsize, varID;
   vlist_t *p = vlistptr;
-  xmpi(MPI_Pack_size(vlist_nints, MPI_INT, comm, &txsize));
-  txsize += vlistAttsGetSize(p, CDI_GLOBAL, comm);
+  txsize = serializeGetSize(vlist_nints, DATATYPE_INT, context);
+  txsize += vlistAttsGetSize(p, CDI_GLOBAL, context);
   for ( varID = 0; varID <  p->nvars; varID++ )
-    txsize += vlistVarGetSize(p, varID, comm);
+    txsize += vlistVarGetSize(p, varID, context);
   return txsize;
 }
 
 
 static
 void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
-                  MPI_Comm comm )
+                  void *context )
 {
   int varID, tempbuf[vlist_nints];
   vlist_t *p = vlistptr;
@@ -1729,32 +1721,30 @@ void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
   tempbuf[4] = p->tableID;
   tempbuf[5] = p->instID;
   tempbuf[6] = p->modelID;
-  xmpi(MPI_Pack(tempbuf, vlist_nints, MPI_INT, buf, size, position, comm));
-  vlistAttsPack(p, CDI_GLOBAL, buf, size, position, comm);
+  serializePack(tempbuf, vlist_nints, DATATYPE_INT, buf, size, position, context);
+  vlistAttsPack(p, CDI_GLOBAL, buf, size, position, context);
   for ( varID = 0; varID < p->nvars; varID++ )
     {
-      vlistVarPack(p, varID, buf, size, position, comm);
+      vlistVarPack(p, varID, buf, size, position, context);
     }
 }
 
-void vlistUnpack(char * buf, int size, int *position, int nspTarget, MPI_Comm comm)
+void vlistUnpack(char * buf, int size, int *position, int nspTarget, void *context)
 {
   int newvlist;
   int varID, tempbuf[vlist_nints];
-  xmpi(MPI_Unpack(buf, size, position, tempbuf, vlist_nints, MPI_INT, comm));
+  serializeUnpack(buf, size, position, tempbuf, vlist_nints, DATATYPE_INT, context);
   newvlist = vlistCreate();
   /* xassert(newvlist == tempbuf[0]); */
   vlistDefTaxis ( newvlist, namespaceAdaptKey ( tempbuf[3], nspTarget ));
   vlistDefTable(newvlist, tempbuf[4]);
   vlistDefInstitut ( newvlist, namespaceAdaptKey ( tempbuf[5], nspTarget ));
   vlistDefModel ( newvlist, namespaceAdaptKey ( tempbuf[6], nspTarget ));
-  vlistAttsUnpack(newvlist, CDI_GLOBAL, buf, size, position, comm);
+  vlistAttsUnpack(newvlist, CDI_GLOBAL, buf, size, position, context);
   for ( varID = 0; varID < tempbuf[1]; varID++ )
-    vlistVarUnpack ( newvlist, buf, size, position, nspTarget, comm );
+    vlistVarUnpack(newvlist, buf, size, position, nspTarget, context);
 }
 
-#endif
-
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/vlist.h b/libcdi/src/vlist.h
index 2e6970f..9c4dadc 100644
--- a/libcdi/src/vlist.h
+++ b/libcdi/src/vlist.h
@@ -7,10 +7,6 @@
 
 #include <stddef.h>  /* size_t */
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
 #ifndef _CDI_LIMITS_H
 #  include "cdi_limits.h"
 #endif
@@ -54,14 +50,6 @@ levinfo_t;
 
 typedef struct
 {
-  int      rank;
-  int      offset;
-  int      chunk;
-}
-deco_t;
-
-typedef struct
-{
   int ens_index;
   int ens_count;
   int forecast_init_type;
@@ -93,6 +81,7 @@ typedef struct
   int         tableID;
   int         timave;
   int         timaccu;
+  int         typeOfGeneratingProcess;
   int         chunktype;
   int         xyz;
   int         missvalused; /* TRUE if missval is defined */
@@ -112,9 +101,6 @@ typedef struct
   ensinfo_t  *ensdata;      /* Ensemble information */
   cdi_atts_t  atts;
   int         iorank;
-  int         decoSize;
-  deco_t     *deco;
-
 #if  defined  (HAVE_LIBGRIB_API)
   /* ---------------------------------- */
   /* Local change: 2013-01-28, FP (DWD) */
@@ -168,11 +154,7 @@ int      vlistHasTime(int vlistID);
 int      vlistDelAtts(int vlistID, int varID);
 int      vlistCopyVarAtts(int vlistID1, int varID_1, int vlistID2, int varID_2);
 
-#ifdef USE_MPI
-void     vlistUnpack(char * buffer, int bufferSize, int * pos, int, MPI_Comm comm);
-void     vlistDefVarDeco ( int vlistID, int varID, int decoSize, 
-                              deco_t * deco );
-#endif
+void     vlistUnpack(char * buffer, int bufferSize, int * pos, int, void *context);
 
 /*      vlistDefVarValidrange: Define the valid range of a Variable */
 void    vlistDefVarValidrange(int vlistID, int varID, const double *validrange);
diff --git a/libcdi/src/vlist_att.c b/libcdi/src/vlist_att.c
index db29cf2..a63fe11 100644
--- a/libcdi/src/vlist_att.c
+++ b/libcdi/src/vlist_att.c
@@ -6,17 +6,13 @@
 #include <string.h>
 #include <assert.h>
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
 #include "dmemory.h"
 
 #include "cdi.h"
 #include "cdi_int.h"
 #include "vlist.h"
 #include "pio_util.h"
-
+#include "serialize.h"
 
 static
 cdi_atts_t *get_attsp(vlist_t *vlistptr, int varID)
@@ -453,69 +449,64 @@ int vlistInqAttTxt(int vlistID, int varID, const char *name, int mlen, char *tp)
   return vlist_inq_att(DATATYPE_TXT, vlistID, varID, name, mlen*sizeof(char), (void *) tp);
 }
 
-#ifdef USE_MPI
-
 enum {
   vlist_att_nints = 4,          /* namesz, exdtype, indtype, nelems */
 };
 
-static int
-vlistAttGetSize(vlist_t *vlistptr, int varID, int attnum, MPI_Comm comm)
+static inline int
+vlistAttTypeLookup(cdi_att_t *attp)
 {
-  int txsize = 0, txinc;
-  cdi_atts_t *attsp;
-  cdi_att_t *attp;
-  char text[1024];
-
-  xassert(attsp = get_attsp(vlistptr, varID));
-  xassert(attnum >= 0 && attnum < (int)attsp->nelems);
-  attp = &(attsp->value[attnum]);
-  xmpi(MPI_Pack_size(vlist_att_nints, MPI_INT, comm, &txsize));
-  xmpi(MPI_Pack_size(attp->namesz, MPI_CHAR, comm, &txinc));
-  txsize += txinc;
+  int type;
   switch (attp->indtype)
   {
   case DATATYPE_FLT:
-    xmpi(MPI_Pack_size((int)attp->nelems, MPI_DOUBLE, comm, &txinc));
+    type = DATATYPE_FLT64;
     break;
   case DATATYPE_INT:
-    xmpi(MPI_Pack_size((int)attp->nelems, MPI_INT, comm, &txinc));
-    break;
   case DATATYPE_TXT:
-    xmpi(MPI_Pack_size((int)attp->nelems, MPI_CHAR, comm, &txinc));
+    type = attp->indtype;
     break;
   default:
-    sprintf( text, "Unknown datatype encountered in attribute %s: %d\n",
+    xabort("Unknown datatype encountered in attribute %s: %d\n",
             attp->name, attp->indtype);
-    xabort ( text );
   }
-  txsize += txinc;
+  return type;
+}
+
+static int
+vlistAttGetSize(vlist_t *vlistptr, int varID, int attnum, void *context)
+{
+  cdi_atts_t *attsp;
+  cdi_att_t *attp;
+
+  xassert(attsp = get_attsp(vlistptr, varID));
+  xassert(attnum >= 0 && attnum < (int)attsp->nelems);
+  attp = &(attsp->value[attnum]);
+  int txsize = serializeGetSize(vlist_att_nints, DATATYPE_INT, context)
+    + serializeGetSize(attp->namesz, DATATYPE_TXT, context);
+  txsize += serializeGetSize((int)attp->nelems, vlistAttTypeLookup(attp), context);
   return txsize;
 }
 
 int
-vlistAttsGetSize(vlist_t *p, int varID, MPI_Comm comm)
+vlistAttsGetSize(vlist_t *p, int varID, void *context)
 {
   int numAtts, i;
-  int txsize;
   cdi_atts_t *attsp = get_attsp(p, varID);
+  int txsize = serializeGetSize(1, DATATYPE_INT, context);
   numAtts = attsp->nelems;
-  xmpi(MPI_Pack_size(1, MPI_INT, comm, &txsize));
   for (i = 0; i < numAtts; ++i)
-  {
-    txsize += vlistAttGetSize(p, varID, i, comm);
-  }
+    txsize += vlistAttGetSize(p, varID, i, context);
   return txsize;
 }
 
 static void
 vlistAttPack(vlist_t *vlistptr, int varID, int attnum,
-             void * buf, int size, int *position, MPI_Comm comm)
+             void * buf, int size, int *position, void *context)
 {
   cdi_atts_t *attsp;
   cdi_att_t *attp;
   int tempbuf[vlist_att_nints];
-  MPI_Datatype attVMPIDt;
 
   xassert(attsp = get_attsp(vlistptr, varID));
   xassert(attnum >= 0 && attnum < (int)attsp->nelems);
@@ -524,74 +515,58 @@ vlistAttPack(vlist_t *vlistptr, int varID, int attnum,
   tempbuf[1] = attp->exdtype;
   tempbuf[2] = attp->indtype;
   tempbuf[3] = attp->nelems;
-  xmpi(MPI_Pack(tempbuf, vlist_att_nints, MPI_INT, buf, size, position, comm));
-  xmpi(MPI_Pack(attp->name, attp->namesz, MPI_CHAR, buf, size, position, comm));
-  switch (attp->indtype)
-  {
-  case DATATYPE_FLT:
-    attVMPIDt = MPI_DOUBLE;
-    break;
-  case DATATYPE_INT:
-    attVMPIDt = MPI_INT;
-    break;
-  case DATATYPE_TXT:
-    attVMPIDt = MPI_CHAR;
-    break;
-  default:
-    xabort("Unknown datatype encountered in attribute %s: %d\n",
-           attp->name, attp->indtype);
-  }
-  xmpi(MPI_Pack(attp->xvalue, (int)attp->nelems, attVMPIDt,
-                buf, size, position, comm));
+  serializePack(tempbuf, vlist_att_nints, DATATYPE_INT, buf, size, position, context);
+  serializePack(attp->name, attp->namesz, DATATYPE_TXT, buf, size, position, context);
+  serializePack(attp->xvalue, (int)attp->nelems, vlistAttTypeLookup(attp),
+                buf, size, position, context);
 }
 
 void
 vlistAttsPack(vlist_t *p, int varID,
-              void * buf, int size, int *position, MPI_Comm comm)
+              void * buf, int size, int *position, void *context)
 {
   int numAtts, i;
   cdi_atts_t *attsp = get_attsp(p, varID);
   numAtts = attsp->nelems;
-  xmpi(MPI_Pack(&numAtts, 1, MPI_INT, buf, size, position, comm));
+  serializePack(&numAtts, 1, DATATYPE_INT, buf, size, position, context);
   for (i = 0; i < numAtts; ++i)
-    vlistAttPack(p, varID, i, buf, size, position, comm);
+    vlistAttPack(p, varID, i, buf, size, position, context);
 }
 
 static void
 vlistAttUnpack(int vlistID, int varID,
-               void * buf, int size, int *position, MPI_Comm comm)
+               void * buf, int size, int *position, void *context)
 {
   char *attName;
   int tempbuf[vlist_att_nints];
-  MPI_Datatype attVMPIDt;
+  int attVDt;
   int elemSize;
-  void *attData;
 
-  xmpi(MPI_Unpack(buf, size, position,
-                  tempbuf, vlist_att_nints, MPI_INT, comm));
+  serializeUnpack(buf, size, position,
+                  tempbuf, vlist_att_nints, DATATYPE_INT, context);
   attName = xmalloc(tempbuf[0] + 1);
-  xmpi(MPI_Unpack(buf, size, position, attName, tempbuf[0], MPI_CHAR, comm));
+  serializeUnpack(buf, size, position, attName, tempbuf[0], DATATYPE_TXT, context);
   attName[tempbuf[0]] = '\0';
   switch (tempbuf[2])
   {
   case DATATYPE_FLT:
-    attVMPIDt = MPI_DOUBLE;
+    attVDt = DATATYPE_FLT64;
     elemSize = sizeof(double);
     break;
   case DATATYPE_INT:
-    attVMPIDt = MPI_INT;
+    attVDt = DATATYPE_INT;
     elemSize = sizeof(int);
     break;
   case DATATYPE_TXT:
-    attVMPIDt = MPI_CHAR;
+    attVDt = DATATYPE_TXT;
     elemSize = 1;
     break;
   default:
     xabort("Unknown datatype encountered in attribute %s: %d\n",
            attName, tempbuf[2]);
   }
-  attData = xmalloc(elemSize * tempbuf[3]);
-  xmpi(MPI_Unpack(buf, size, position, attData, tempbuf[3], attVMPIDt, comm));
+  void *attData = xmalloc(elemSize * tempbuf[3]);
+  serializeUnpack(buf, size, position, attData, tempbuf[3], attVDt, context);
   vlist_def_att(tempbuf[2], tempbuf[1], vlistID, varID, attName,
                 tempbuf[3], tempbuf[3] * elemSize, attData);
   free(attName);
@@ -600,19 +575,16 @@ vlistAttUnpack(int vlistID, int varID,
 
 void
 vlistAttsUnpack(int vlistID, int varID,
-                void * buf, int size, int *position, MPI_Comm comm)
+                void * buf, int size, int *position, void *context)
 {
   int numAtts, i;
-  xmpi(MPI_Unpack(buf, size, position, &numAtts, 1, MPI_INT, comm));
+  serializeUnpack(buf, size, position, &numAtts, 1, DATATYPE_INT, context);
   for (i = 0; i < numAtts; ++i)
   {
-    vlistAttUnpack(vlistID, varID, buf, size, position, comm);
+    vlistAttUnpack(vlistID, varID, buf, size, position, context);
   }
 }
 
-
-
-#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/vlist_att.h b/libcdi/src/vlist_att.h
index 0a02a80..c42b364 100644
--- a/libcdi/src/vlist_att.h
+++ b/libcdi/src/vlist_att.h
@@ -5,24 +5,17 @@
 #include "config.h"
 #endif
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
-#ifdef USE_MPI
-
 int
-vlistAttsGetSize(vlist_t *p, int varID, MPI_Comm comm);
+vlistAttsGetSize(vlist_t *p, int varID, void *context);
 
 void
 vlistAttsPack(vlist_t *p, int varID,
-              void * buf, int size, int *position, MPI_Comm comm);
+              void * buf, int size, int *position, void *context);
 
 void
 vlistAttsUnpack(int vlistID, int varID,
-                void * buf, int size, int *position, MPI_Comm comm);
+                void * buf, int size, int *position, void *context);
 
-#endif
 
 #endif
 
diff --git a/libcdi/src/vlist_var.c b/libcdi/src/vlist_var.c
index 9c8e919..3583b77 100644
--- a/libcdi/src/vlist_var.c
+++ b/libcdi/src/vlist_var.c
@@ -3,10 +3,6 @@
 #endif
 
 #include <limits.h>
-#ifdef USE_MPI
-#include <mpi.h>
-#include "pio_comm.h"
-#endif
 
 #include "dmemory.h"
 #include "cdi.h"
@@ -16,6 +12,7 @@
 #include "resource_handle.h"
 #include "vlist_att.h"
 #include "namespace.h"
+#include "serialize.h"
 #include "pio_util.h"
 
 extern resOps vlist_ops;
@@ -62,8 +59,6 @@ void vlistvarInitEntry(int vlistID, int varID)
   vlistptr->vars[varID].validrange[1] = VALIDMISS;
   vlistptr->vars[varID].ensdata       = NULL;
   vlistptr->vars[varID].iorank        = CDI_UNDEFID;
-  vlistptr->vars[varID].decoSize      = 0;
-  vlistptr->vars[varID].deco          = NULL;
 
 #if  defined  (HAVE_LIBGRIB_API)
   /* ---------------------------------- */
@@ -115,11 +110,8 @@ int vlistvarNewEntry(int vlistID)
     }
   else
     {
-      while ( varID < vlistvarSize )
-	{
-	  if ( ! vlistvar[varID].isUsed ) break;
-	  varID++;
-	}
+      while (varID < vlistvarSize && vlistvar[varID].isUsed)
+        ++varID;
     }
   /*
     If the table overflows, double its size.
@@ -1246,9 +1238,6 @@ otherwise the result is an empty string.
 */
 void vlistInqVarExtra(int vlistID, int varID, char *extra)
 {
-  int tableID;
-  int param;
-  int pdis, pcat, pnum;
   vlist_t *vlistptr;
 
   vlistptr = vlist_to_pointer(vlistID);
@@ -1439,6 +1428,32 @@ int vlistInqVarTimaccu(int vlistID, int varID)
 }
 
 
+void vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGeneratingProcess)
+{
+  vlist_t *vlistptr;
+
+  if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
+    {
+      xwarning("%s", "Operation not executed.");
+      return;
+    }
+
+  vlistptr = vlist_to_pointer(vlistID);
+
+  vlistptr->vars[varID].typeOfGeneratingProcess = typeOfGeneratingProcess;
+}
+
+
+int vlistInqVarTypeOfGeneratingProcess(int vlistID, int varID)
+{
+  vlist_t *vlistptr;
+
+  vlistptr = vlist_to_pointer(vlistID);
+
+  return (vlistptr->vars[varID].typeOfGeneratingProcess);
+}
+
+
 void vlistDestroyVarName(int vlistID, int varID)
 {
   vlist_t *vlistptr;
@@ -2028,107 +2043,6 @@ int vlistInqVarIntKey(int vlistID, int varID, const char* name)
 }
 
 
-void vlistDefVarDeco ( int vlistID, int varID, int decoSize, deco_t * deco )
-{
-  vlist_t * vlistptr;
-  int i;
-
-  vlistptr = vlist_to_pointer(vlistID );
-
-  vlistCheckVarID ( __func__, vlistID, varID );
-
-  if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
-    {
-      xwarning("%s", "Operation not executed.");
-      return;
-    }
-
-  xassert ( decoSize && deco );
- 
-  vlistptr->vars[varID].deco = xmalloc ( decoSize * sizeof ( deco_t )); 
-
-  for ( i = 0; i < decoSize; i++ )
-    {
-      vlistptr->vars[varID].deco[i].rank   = deco[i].rank;
-      vlistptr->vars[varID].deco[i].offset = deco[i].offset;
-      vlistptr->vars[varID].deco[i].chunk  = deco[i].chunk;
-    }
-
-  vlistptr->vars[varID].decoSize = decoSize;
-}
-
-
-int vlistInqVarDecoChunk ( int vlistID, int varID, int rankModel  )
-{
-  vlist_t *vlistptr;
-  int iret = CDI_UNDEFID;
-
-  vlistptr = vlist_to_pointer(vlistID);
-
-  vlistCheckVarID(__func__, vlistID, varID);
-
-#ifdef USE_MPI
-  {
-    deco_t * deco;
-    int i, decoSize = 0;
-    xassert ( vlistptr->vars[varID].deco != NULL &&
-             vlistptr->vars[varID].decoSize != CDI_UNDEFID ); 
-    
-    deco  = vlistptr->vars[varID].deco;
-    decoSize = vlistptr->vars[varID].decoSize;
-    if ( decoSize && deco )
-      for ( i = 0; i < decoSize; i++ )
-        if ( deco[i].rank == rankModel ) 
-          {
-            iret = deco[i].chunk;
-            break;
-          }
-  }
-#else
-  iret = vlistInqVarSize ( vlistID, varID );
-#endif
-
-  xassert ( iret != CDI_UNDEFID );
-  return iret;
-}
-
-
-int vlistInqVarDecoOff ( int vlistID, int varID, int rankModel  )
-{
-  vlist_t *vlistptr;
-  int iret = CDI_UNDEFID;
-
-  vlistptr = vlist_to_pointer(vlistID);
-
-  vlistCheckVarID(__func__, vlistID, varID);
-
-#ifdef USE_MPI
-  {
-    deco_t * deco;
-    int i, decoSize = 0;
-    
-    xassert ( vlistptr->vars[varID].deco != NULL &&
-             vlistptr->vars[varID].decoSize != CDI_UNDEFID );
-    
-    deco  = vlistptr->vars[varID].deco;
-    decoSize = vlistptr->vars[varID].decoSize;
-    if ( decoSize && deco )
-      for ( i = 0; i < decoSize; i++ )
-        if ( deco[i].rank == rankModel ) 
-          {
-            iret = deco[i].offset;
-            break;
-          }
-  }
-#else
-  iret = 0;
-#endif
-
-  xassert (  iret != CDI_UNDEFID );  
-  return iret;
-}
-
-
 void     vlistDefVarIOrank   ( int vlistID, int varID, int iorank )
 {
   vlist_t * vlistptr;
@@ -2159,54 +2073,31 @@ int vlistInqVarIOrank(int vlistID, int varID)
 }
 
 
-#ifdef USE_MPI
-
 enum {
-  vlistvar_nints = 21,
+  vlistvar_nints = 20,
   vlistvar_ndbls = 3,
 };
 
-int vlistVarGetSize(vlist_t *p, int varID, MPI_Comm comm)
+int vlistVarGetSize(vlist_t *p, int varID, void *context)
 {
   var_t *var = p->vars + varID;
-  int varsize, txinc;
-
-  xmpi(MPI_Pack_size(vlistvar_nints, MPI_INT, comm, &varsize));
-  xmpi(MPI_Pack_size(vlistvar_ndbls, MPI_DOUBLE, comm, &txinc));
-  varsize += txinc;
+  int varsize = serializeGetSize(vlistvar_nints, DATATYPE_INT, context)
+    + serializeGetSize(vlistvar_ndbls, DATATYPE_FLT64, context);
   if (var->name)
-  {
-    xmpi(MPI_Pack_size(strlen(var->name), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
+    varsize += serializeGetSize(strlen(var->name), DATATYPE_TXT, context);
   if (var->longname)
-  {
-    xmpi(MPI_Pack_size(strlen(var->longname), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
+    varsize += serializeGetSize(strlen(var->longname), DATATYPE_TXT, context);
   if (var->stdname)
-  {
-    xmpi(MPI_Pack_size(strlen(var->stdname), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
+    varsize += serializeGetSize(strlen(var->stdname), DATATYPE_TXT, context);
   if (var->units)
-  {
-    xmpi(MPI_Pack_size(strlen(var->units), MPI_CHAR, comm, &txinc));
-    varsize += txinc;
-  }
-  xmpi(MPI_Pack_size(4 * var->nlevs, MPI_INT, comm, &txinc));
-  varsize += txinc;
-  if ( var->deco != NULL )
-    {
-      xmpi(MPI_Pack_size(3 * var->decoSize, MPI_INT, comm, &txinc));
-      varsize += txinc;
-    }
-  varsize += vlistAttsGetSize(p, varID, comm);
+    varsize += serializeGetSize(strlen(var->units), DATATYPE_TXT, context);
+  varsize += serializeGetSize(4 * var->nlevs, DATATYPE_INT, context);
+  varsize += vlistAttsGetSize(p, varID, context);
   return varsize;
 }
 
 void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
-                  MPI_Comm comm)
+                  void *context)
 {
   double dtempbuf[vlistvar_ndbls];
   var_t *var = p->vars + varID;
@@ -2232,25 +2123,24 @@ void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
   tempbuf[17] = var->complevel;
   tempbuf[18] = var->nlevs;
   tempbuf[19] = var->iorank;
-  tempbuf[20] = var->decoSize;
   dtempbuf[0] = var->missval;
   dtempbuf[1] = var->scalefactor;
   dtempbuf[2] = var->addoffset;
-  xmpi(MPI_Pack(tempbuf, vlistvar_nints, MPI_INT,
-                buf, size, position, comm));
-  xmpi(MPI_Pack(dtempbuf, vlistvar_ndbls, MPI_DOUBLE,
-                buf, size, position, comm));
+  serializePack(tempbuf, vlistvar_nints, DATATYPE_INT,
+                buf, size, position, context);
+  serializePack(dtempbuf, vlistvar_ndbls, DATATYPE_FLT64,
+                buf, size, position, context);
   if (namesz)
-    xmpi(MPI_Pack(var->name, namesz, MPI_CHAR, buf, size, position, comm));
+    serializePack(var->name, namesz, DATATYPE_TXT, buf, size, position, context);
   if (longnamesz)
-    xmpi(MPI_Pack(var->longname, longnamesz, MPI_CHAR,
-                  buf, size, position, comm));
+    serializePack(var->longname, longnamesz, DATATYPE_TXT,
+                  buf, size, position, context);
   if (stdnamesz)
-    xmpi(MPI_Pack(var->stdname, stdnamesz, MPI_CHAR,
-                  buf, size, position, comm));
+    serializePack(var->stdname, stdnamesz, DATATYPE_TXT,
+                  buf, size, position, context);
   if (unitssz)
-    xmpi(MPI_Pack(var->units, unitssz, MPI_CHAR,
-                  buf, size, position, comm));
+    serializePack(var->units, unitssz, DATATYPE_TXT,
+                  buf, size, position, context);
   {
     int levbuf[var->nlevs][4];
     for (i = 0; i < var->nlevs; ++i)
@@ -2260,22 +2150,10 @@ void vlistVarPack(vlist_t *p, int varID, char * buf, int size, int *position,
       levbuf[i][2] = var->levinfo[i].mlevelID;
       levbuf[i][3] = var->levinfo[i].flevelID;
     }
-    xmpi(MPI_Pack(levbuf, var->nlevs * 4, MPI_INT,
-                  buf, size, position, comm));
+    serializePack(levbuf, var->nlevs * 4, DATATYPE_INT,
+                  buf, size, position, context);
   }
-  if ( var->deco != NULL )
-    {
-      int deco[var->decoSize][3];
-      for (i = 0; i < var->decoSize; ++i)
-        {
-          deco[i][0] = var->deco[i].rank;
-          deco[i][1] = var->deco[i].offset;
-          deco[i][2] = var->deco[i].chunk;
-        }
-      xmpi(MPI_Pack(deco, var->decoSize * 3, MPI_INT,
-                    buf, size, position, comm));
-    }
-  vlistAttsPack(p, varID, buf, size, position, comm);
+  vlistAttsPack(p, varID, buf, size, position, context);
 }
 
 static inline int
@@ -2286,16 +2164,16 @@ imax(int a, int b)
 
 
 void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
-		    int nspTarget, MPI_Comm comm)
+		    int nspTarget, void *context)
 {
   double dtempbuf[vlistvar_ndbls];
   int tempbuf[vlistvar_nints];
   int newvar;
   char *varname = NULL;
-  xmpi(MPI_Unpack(buf, size, position,
-                  tempbuf, vlistvar_nints, MPI_INT, comm));
-  xmpi(MPI_Unpack(buf, size, position,
-                  dtempbuf, vlistvar_ndbls, MPI_DOUBLE, comm));
+  serializeUnpack(buf, size, position,
+                  tempbuf, vlistvar_nints, DATATYPE_INT, context);
+  serializeUnpack(buf, size, position,
+                  dtempbuf, vlistvar_ndbls, DATATYPE_FLT64, context);
 
   newvar = vlistDefVar ( vlistID,
 			 namespaceAdaptKey ( tempbuf[1], nspTarget ),
@@ -2306,29 +2184,29 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
                            tempbuf[7])+ 1);
   if (tempbuf[4])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[4], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[4], DATATYPE_TXT, context);
     varname[tempbuf[4]] = '\0';
     vlistDefVarName(vlistID, newvar, varname);
   }
   if (tempbuf[5])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[5], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[5], DATATYPE_TXT, context);
     varname[tempbuf[5]] = '\0';
     vlistDefVarLongname(vlistID, newvar, varname);
   }
   if (tempbuf[6])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[6], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[6], DATATYPE_TXT, context);
     varname[tempbuf[6]] = '\0';
     vlistDefVarStdname(vlistID, newvar, varname);
   }
   if (tempbuf[7])
   {
-    xmpi(MPI_Unpack(buf, size, position,
-                    varname, tempbuf[7], MPI_CHAR, comm));
+    serializeUnpack(buf, size, position,
+                    varname, tempbuf[7], DATATYPE_TXT, context);
     varname[tempbuf[7]] = '\0';
     vlistDefVarUnits(vlistID, newvar, varname);
   }
@@ -2354,8 +2232,8 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
     var_t *var = vlist_to_pointer(vlistID)->vars + newvar;
     int nlevs=tempbuf[18], i, flagSetLev = 0;
     xassert(nlevs == var->nlevs);
-    xmpi(MPI_Unpack(buf, size, position,
-                    levbuf, nlevs * 4, MPI_INT, comm));
+    serializeUnpack(buf, size, position,
+                    levbuf, nlevs * 4, DATATYPE_INT, context);
     for (i = 0; i < nlevs; ++i)
     {
       vlistDefFlag(vlistID, newvar, i, levbuf[i][0]);
@@ -2368,29 +2246,11 @@ void vlistVarUnpack(int vlistID, char * buf, int size, int *position,
     }
     vlistDefFlag(vlistID, newvar, flagSetLev, levbuf[flagSetLev][0]);
   }
-  if ( tempbuf[20] != 0 )
-    {
-      int decoSize = tempbuf[20], i;
-      deco_t deco[decoSize];
-      int decobuf[decoSize][3];
-
-      xmpi ( MPI_Unpack(buf, size, position,
-                        decobuf, decoSize * 3, MPI_INT, comm ));
-      for (i = 0; i < decoSize; ++i)
-        {
-          deco[i].rank   = decobuf[i][0];
-          deco[i].offset = decobuf[i][1];
-          deco[i].chunk  = decobuf[i][2];
-        }
-      vlistDefVarDeco(vlistID, newvar, decoSize, &deco[0]);
-    }
   vlistDefVarIOrank(vlistID, newvar, tempbuf[19]);
-  vlistAttsUnpack(vlistID, newvar, buf, size, position, comm);
+  vlistAttsUnpack(vlistID, newvar, buf, size, position, context);
 }
 
 
-#endif
-
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/src/vlist_var.h b/libcdi/src/vlist_var.h
index c152e0d..96f0b44 100644
--- a/libcdi/src/vlist_var.h
+++ b/libcdi/src/vlist_var.h
@@ -5,10 +5,6 @@
 #include "config.h"
 #endif
 
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
-
 #ifndef _VLIST_H
 #include "vlist.h"
 #endif
@@ -16,15 +12,13 @@
 int  vlistInqVarDecoChunk ( int, int, int );
 int  vlistInqVarDecoOff   ( int, int, int );
 
-#ifdef USE_MPI
-int  vlistVarGetSize(vlist_t *p, int varID, MPI_Comm comm);
+int  vlistVarGetSize(vlist_t *p, int varID, void *context);
 void vlistVarPack(vlist_t *p, int varID,
-                  char * buffer, int bufferSize, int * pos, MPI_Comm comm);
+                  char * buffer, int bufferSize, int * pos, void *context);
 void vlistVarUnpack(int vlistID,
-                    char * buf, int size, int *position, int, MPI_Comm comm);
+                    char * buf, int size, int *position, int, void *context);
 void vlistDefVarIOrank    ( int, int, int );
 int  vlistInqVarIOrank    ( int, int );
-#endif
 
 #endif
 /*
diff --git a/libcdi/src/zaxis.c b/libcdi/src/zaxis.c
index 2d38392..353d31d 100644
--- a/libcdi/src/zaxis.c
+++ b/libcdi/src/zaxis.c
@@ -12,9 +12,10 @@
 #include "cdi_int.h"
 #include "pio_util.h"
 #include "resource_handle.h"
-#include "pio_rpc.h"
+#include "resource_unpack.h"
 #include "varscan.h"
 #include "namespace.h"
+#include "serialize.h"
 
 #define  LevelUp    1
 #define  LevelDown  2
@@ -28,27 +29,32 @@ static struct {
   char *units;
 }
 ZaxistypeEntry[] = {
-  { /*  0 */ 0, "sfc",        "surface",           "",               ""},
-  { /*  1 */ 0, "lev",        "generic",           "",               "level"},
-  { /*  2 */ 2, "lev",        "hybrid",            "",               "level"},
-  { /*  3 */ 2, "lev",        "hybrid_half",       "",               "level"},
-  { /*  4 */ 2, "lev",        "pressure",          "air_pressure",   "Pa"},
-  { /*  5 */ 1, "height",     "height",            "height",         "m"},
-  { /*  6 */ 2, "depth",      "depth_below_sea",   "depth",          "m"},
-  { /*  7 */ 2, "depth",      "depth_below_land",  "",               "cm"},
-  { /*  8 */ 0, "lev",        "isentropic",        "",               "K"},
-  { /*  9 */ 0, "lev",        "trajectory",        "",               ""},
-  { /* 10 */ 1, "alt",        "altitude",          "",               "m"},
-  { /* 11 */ 0, "lev",        "sigma",             "",               "level"},
-  { /* 12 */ 0, "lev",        "meansea",           "",               "level"},
-  { /* 13 */ 0, "toa",        "top_of_atmosphere", "",               ""},
-  { /* 14 */ 0, "seabottom",  "sea_bottom",        "",               ""},
-  { /* 15 */ 0, "atmosphere", "atmosphere",        "",               ""},
-  { /* 16 */ 0, "cloudbase",  "cloud_base",        "",               ""},
-  { /* 17 */ 0, "cloudtop",   "cloud_top",         "",               ""},
-  { /* 18 */ 0, "isotherm0",  "isotherm_zero",     "",               ""},
-  { /* 19 */ 0, "snow",       "snow",              "",               ""},
-  { /* 20 */ 0, "height",     "generalized height","height",         "m"},
+  { /*  0 */ 0, "sfc",               "surface",                "",               ""},
+  { /*  1 */ 0, "lev",               "generic",                "",               "level"},
+  { /*  2 */ 2, "lev",               "hybrid",                 "",               "level"},
+  { /*  3 */ 2, "lev",               "hybrid_half",            "",               "level"},
+  { /*  4 */ 2, "lev",               "pressure",               "air_pressure",   "Pa"},
+  { /*  5 */ 1, "height",            "height",                 "height",         "m"},
+  { /*  6 */ 2, "depth",             "depth_below_sea",        "depth",          "m"},
+  { /*  7 */ 2, "depth",             "depth_below_land",       "",               "cm"},
+  { /*  8 */ 0, "lev",               "isentropic",             "",               "K"},
+  { /*  9 */ 0, "lev",               "trajectory",             "",               ""},
+  { /* 10 */ 1, "alt",               "altitude",               "",               "m"},
+  { /* 11 */ 0, "lev",               "sigma",                  "",               "level"},
+  { /* 12 */ 0, "lev",               "meansea",                "",               "level"},
+  { /* 13 */ 0, "toa",               "top_of_atmosphere",      "",               ""},
+  { /* 14 */ 0, "seabottom",         "sea_bottom",             "",               ""},
+  { /* 15 */ 0, "atmosphere",        "atmosphere",             "",               ""},
+  { /* 16 */ 0, "cloudbase",         "cloud_base",             "",               ""},
+  { /* 17 */ 0, "cloudtop",          "cloud_top",              "",               ""},
+  { /* 18 */ 0, "isotherm0",         "isotherm_zero",          "",               ""},
+  { /* 19 */ 0, "snow",              "snow",                   "",               ""},
+  { /* 20 */ 0, "lakebottom",        "lake_bottom",            "",               ""},
+  { /* 21 */ 0, "sedimentbottom",    "sediment_bottom",        "",               ""},
+  { /* 22 */ 0, "sedimentbottomta",  "sediment_bottom_ta",     "",               ""},
+  { /* 23 */ 0, "sedimentbottomtw",  "sediment_bottom_tw",     "",               ""},
+  { /* 24 */ 0, "mixlayer",          "mix_layer",              "",               ""},
+  { /* 25 */ 0, "height",            "generalized height",     "height",         ""},
 };
 
 static int CDI_MaxZaxistype = sizeof(ZaxistypeEntry) / sizeof(ZaxistypeEntry[0]);
@@ -72,7 +78,8 @@ typedef struct {
   int      direction;
   int      vctsize;
   double  *vct;
-  int      reference;
+  int      number;   /* Reference number to a generalized Z-axis */
+  int      nhlev;
   char     uuid[17];
 }
 zaxis_t;
@@ -80,17 +87,12 @@ zaxis_t;
 static int    zaxisCompareP    ( void * zaxisptr1, void * zaxisptr2 );
 static void   zaxisDestroyP    ( void * zaxisptr );
 static void   zaxisPrintP      ( void * zaxisptr, FILE * fp );
-#ifdef USE_MPI
-static int    zaxisGetPackSize ( void * zaxisptr, MPI_Comm comm );
-static void   zaxisPack        ( void * zaxisptr, void * buffer, int size,
-                                 int *pos, MPI_Comm comm);
+static int    zaxisGetPackSize ( void * zaxisptr, void *context);
+static void   zaxisPack        ( void * zaxisptr, void * buffer, int size, int *pos, void *context);
 static int    zaxisTxCode      ( void );
-#endif
 
 resOps zaxisOps = { zaxisCompareP, zaxisDestroyP, zaxisPrintP
-#ifdef USE_MPI
                     , zaxisGetPackSize, zaxisPack, zaxisTxCode
-#endif
 };
 
 static int  ZAXIS_Debug = 0;   /* If set to 1, debugging */
@@ -115,7 +117,8 @@ void zaxisDefaultValue ( zaxis_t *zaxisptr )
   zaxisptr->size        = 0;
   zaxisptr->vctsize     = 0;
   zaxisptr->vct         = NULL;
-  zaxisptr->reference   = CDI_UNDEFID;
+  zaxisptr->number      = 0;
+  zaxisptr->nhlev       = 0;
   zaxisptr->uuid[0]     = 0;
 }
 
@@ -185,6 +188,8 @@ int zaxisSize(void)
                       @func{ZAXIS_ISENTROPIC}, @func{ZAXIS_ALTITUDE}, @func{ZAXIS_MEANSEA}, @func{ZAXIS_TOA},
                       @func{ZAXIS_SEA_BOTTOM}, @func{ZAXIS_ATMOSPHERE}, @func{ZAXIS_CLOUD_BASE},
                       @func{ZAXIS_CLOUD_TOP}, @func{ZAXIS_ISOTHERM_ZERO}, @func{ZAXIS_SNOW},
+                      @func{ZAXIS_LAKE_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM_TA},
+                      @func{ZAXIS_SEDIMENT_BOTTOM_TW}, @func{ZAXIS_MIX_LAYER},
                       @func{ZAXIS_DEPTH_BELOW_SEA} and @func{ZAXIS_DEPTH_BELOW_LAND}.
     @Item  size       Number of levels.
 
@@ -546,6 +551,24 @@ int zaxisInqPrec(int zaxisID)
 }
 
 
+void zaxisDefPositive(int zaxisID, int positive)
+{
+  zaxis_t *zaxisptr;
+
+  if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
+    {
+      xwarning("%s", "Operation not executed.");
+      return;
+    }
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  zaxisptr->positive = positive;
+}
+
+
 int zaxisInqPositive(int zaxisID)
 {
   zaxis_t *zaxisptr;
@@ -659,25 +682,58 @@ void zaxisDefLevel(int zaxisID, int levelID, double level)
     zaxisptr->vals[levelID] = level;
 }
 
+
+void zaxisDefNlevRef(int zaxisID, const int nhlev)
+{
+  zaxis_t *zaxisptr;
+
+  if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
+    {
+      xwarning("%s", "Operation not executed.");
+      return;
+    }
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  zaxisptr->nhlev = nhlev;
+}
+
+
+int zaxisInqNlevRef(int zaxisID)
+{
+  int nhlev = -1;
+  zaxis_t *zaxisptr;
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  nhlev = zaxisptr->nhlev;
+
+  return (nhlev);
+}
+
 /*
- at Function  zaxisDefReference
- at Title     Define the reference for a genralized Z-axis
+ at Function  zaxisDefNumber
+ at Title     Define the reference number for a generalized Z-axis
 
- at Prototype void zaxisDefReference(int zaxisID, const int reference)
+ at Prototype void zaxisDefNumber(int zaxisID, const int number)
 @Parameter
     @Item  zaxisID     Z-axis ID, from a previous call to @fref{zaxisCreate}.
-    @Item  reference   Reference for a generalized Z-axis.
+    @Item  number      Reference number for a generalized Z-axis.
 
 @Description
-The function @func{zaxisDefReference} defines the reference for a generalized  Z-axis.
+The function @func{zaxisDefNumber} defines the reference number for a generalized Z-axis.
 
 @EndFunction
 */
-void zaxisDefReference(int zaxisID, const int reference)
+void zaxisDefNumber(int zaxisID, const int number)
 {
   zaxis_t *zaxisptr;
 
-    if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
+  if ( reshGetStatus ( zaxisID, &zaxisOps ) == CLOSED )
     {
       xwarning("%s", "Operation not executed.");
       return;
@@ -687,7 +743,36 @@ void zaxisDefReference(int zaxisID, const int reference)
 
   zaxis_check_ptr(zaxisID, zaxisptr);
 
-  zaxisptr->reference = reference;
+  zaxisptr->number = number;
+}
+
+/*
+ at Function  zaxisInqNumber
+ at Title     Get the reference number to a generalized Z-axis
+
+ at Prototype int zaxisInqNumber(int zaxisID)
+ at Parameter
+    @Item  zaxisID  Z-axis ID, from a previous call to @fref{zaxisCreate}.
+
+ at Description
+The function @func{zaxisInqNumber} returns the reference number to a generalized Z-axis.
+
+ at Result
+ at func{zaxisInqNumber} returns the reference number to a generalized Z-axis.
+ at EndFunction
+*/
+int zaxisInqNumber(int zaxisID)
+{
+  int number = -1;
+  zaxis_t *zaxisptr;
+
+  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
+
+  zaxis_check_ptr(zaxisID, zaxisptr);
+
+  number = zaxisptr->number;
+
+  return (number);
 }
 
 /*
@@ -725,7 +810,7 @@ void zaxisDefUUID(int zaxisID, const char *uuid)
 
 /*
 @Function  zaxisInqUUID
- at Title     Get the uuid to a generalized Z-axis.
+ at Title     Get the uuid to a generalized Z-axis
 
 @Prototype char *zaxisInqUUID(int zaxisID, char *uuid)
 @Parameter
@@ -752,35 +837,6 @@ char *zaxisInqUUID(int zaxisID, char *uuid)
 }
 
 /*
- at Function  zaxisInqReference
- at Title     Get the reference to a generalized Z-axis.
-
- at Prototype int zaxisInqReference(int zaxisID)
- at Parameter
-    @Item  zaxisID  Z-axis ID, from a previous call to @fref{zaxisCreate}.
-
- at Description
-The function @func{zaxisInqReference} returns the reference to a generalized Z-axis.
-
- at Result
- at func{zaxisInqReference} returns the reference to a generalized Z-axis.
- at EndFunction
-*/
-int zaxisInqReference(int zaxisID)
-{
-  int reference = -1;
-  zaxis_t *zaxisptr;
-
-  zaxisptr = ( zaxis_t * ) reshGetVal ( zaxisID, &zaxisOps );
-
-  zaxis_check_ptr(zaxisID, zaxisptr);
-
-  reference = zaxisptr->reference;
-
-  return (reference);
-}
-
-/*
 @Function  zaxisInqLevel
 @Title     Get one level of a Z-axis
 
@@ -997,6 +1053,8 @@ The valid CDI Z-axis types are @func{ZAXIS_GENERIC}, @func{ZAXIS_SURFACE},
 @func{ZAXIS_ISENTROPIC}, @func{ZAXIS_ALTITUDE}, @func{ZAXIS_MEANSEA}, @func{ZAXIS_TOA},
 @func{ZAXIS_SEA_BOTTOM}, @func{ZAXIS_ATMOSPHERE}, @func{ZAXIS_CLOUD_BASE},
 @func{ZAXIS_CLOUD_TOP}, @func{ZAXIS_ISOTHERM_ZERO}, @func{ZAXIS_SNOW},
+ at func{ZAXIS_LAKE_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM}, @func{ZAXIS_SEDIMENT_BOTTOM_TA},
+ at func{ZAXIS_SEDIMENT_BOTTOM_TW}, @func{ZAXIS_MIX_LAYER},
 @func{ZAXIS_DEPTH_BELOW_SEA} and @func{ZAXIS_DEPTH_BELOW_LAND}.
 
 @EndFunction
@@ -1555,14 +1613,13 @@ int  zaxisCompareP ( void * zaxisptr1, void * zaxisptr2 )
 }
 
 
-#ifdef USE_MPI
 static int
 zaxisTxCode ( void )
 {
   return ZAXIS;
 }
 
-enum { zaxisNint     = 7,
+enum { zaxisNint     = 8,
        zaxisNstrings = 4,
        vals     = 1 << 0,
        lbounds  = 1 << 1,
@@ -1586,99 +1643,63 @@ int zaxisGetMemberMask ( zaxis_t * zaxisP )
   return memberMask;
 }
 
-static
-int zaxisGetPackSize ( void * voidP, MPI_Comm comm )
+static int
+zaxisGetPackSize(void * voidP, void *context)
 {
   zaxis_t * zaxisP = ( zaxis_t * ) voidP;
-  int packBufferSize = 0, size;
+  int packBufferSize = serializeGetSize(zaxisNint, DATATYPE_INT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context);
 
-  xmpi ( MPI_Pack_size ( zaxisNint + 1, MPI_INT, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
+  if (zaxisP->vals || zaxisP->lbounds || zaxisP->ubounds || zaxisP->weights)
+    xassert(zaxisP->size);
 
   if ( zaxisP->vals )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize( zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->lbounds )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize(zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->ubounds )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize(zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->weights )
-    {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack_size ( zaxisP->size, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-    }
+    packBufferSize += serializeGetSize(zaxisP->size + 1, DATATYPE_FLT64, context);
 
   if ( zaxisP->vct )
     {
       xassert ( zaxisP->vctsize );
-
-      xmpi ( MPI_Pack_size ( zaxisP->vctsize, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
-      xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-      packBufferSize += size;
+      packBufferSize += serializeGetSize(zaxisP->vctsize + 1, DATATYPE_FLT64, context);
     }
 
-  xmpi ( MPI_Pack_size ( zaxisNstrings * CDI_MAX_NAME , MPI_CHAR, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_DOUBLE, comm, &size ));
-  packBufferSize += size;
-  xmpi ( MPI_Pack_size ( 1, MPI_UNSIGNED_CHAR, comm, &size ));
-  packBufferSize += size;
-
+  packBufferSize += serializeGetSize(zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context)
+    + serializeGetSize(1, DATATYPE_FLT64, context)
+    + serializeGetSize(1, DATATYPE_UCHAR, context);
   return packBufferSize;
 }
 
 
-void zaxisUnpack ( char * unpackBuffer, int unpackBufferSize,
-                   int * unpackBufferPos, int nspTarget, MPI_Comm comm )
+void
+zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
+            int * unpackBufferPos, int nspTarget, void *context)
 {
   zaxis_t * zaxisP;
-  int intBuffer[zaxisNint + 1], memberMask;
+  int intBuffer[zaxisNint], memberMask;
   double d;
   char charBuffer[zaxisNstrings * CDI_MAX_NAME];
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      intBuffer, zaxisNint + 1, MPI_INT, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  intBuffer, zaxisNint, DATATYPE_INT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( xchecksum ( DATATYPE_INT, zaxisNint + 1, intBuffer ) == d );
+  xassert ( xchecksum ( DATATYPE_INT, zaxisNint, intBuffer ) == d );
 
   zaxisInit ();
 
   zaxisP = zaxisNewEntry();
   if ( ! zaxisP ) Error("No memory");
 
-  xassert ( namespaceAdaptKey ( intBuffer[0], nspTarget ) == zaxisP->self );
+  xassert(namespaceAdaptKey(intBuffer[0], nspTarget) == zaxisP->self);
 
   zaxisP->prec      = intBuffer[1];
   zaxisP->type      = intBuffer[2];
@@ -1688,88 +1709,93 @@ void zaxisUnpack ( char * unpackBuffer, int unpackBufferSize,
   zaxisP->vctsize   = intBuffer[6];
   memberMask        = intBuffer[7];
 
-  if ( memberMask & vals )
+  if (memberMask & vals)
     {
-      xassert ( zaxisP->size );
-
-      zaxisP->vals = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->vals, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->vals ) == d );
+      int size;
+      xassert((size = zaxisP->size));
+
+      zaxisP->vals = xmalloc(size * sizeof ( double ));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->vals, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->vals) == d);
     }
 
-  if ( memberMask & lbounds )
+  if (memberMask & lbounds)
     {
-      xassert ( zaxisP->size );
-
-      zaxisP->lbounds = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->lbounds, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->lbounds ) == d );
+      int size;
+      xassert((size = zaxisP->size));
+
+      zaxisP->lbounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->lbounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->lbounds) == d);
     }
 
-  if ( memberMask & ubounds )
+  if (memberMask & ubounds)
     {
-      xassert ( zaxisP->size );
-
-      zaxisP->ubounds = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->ubounds, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->ubounds ) == d );
+      int size;
+      xassert((size = zaxisP->size));
+
+      zaxisP->ubounds = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->ubounds, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->ubounds) == d);
     }
 
-  if ( memberMask & weights )
+  if (memberMask & weights)
     {
-      xassert ( zaxisP->size );
-
-      zaxisP->weights = xmalloc ( zaxisP->size * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->weights, zaxisP->size, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->weights ) == d );
+      int size;
+      xassert((size = zaxisP->size));
+
+      zaxisP->weights = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->weights, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->weights) == d);
     }
 
   if ( memberMask & vct )
     {
-      xassert ( zaxisP->vctsize );
-
-      zaxisP->vct = xmalloc ( zaxisP->vctsize * sizeof ( double ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          zaxisP->vct, zaxisP->vctsize, MPI_DOUBLE, comm ));
-      xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                          &d, 1, MPI_DOUBLE, comm ));
-      xassert ( xchecksum ( DATATYPE_FLT, zaxisP->vctsize, zaxisP->vct ) == d );
+      int size;
+      xassert((size = zaxisP->vctsize));
+
+      zaxisP->vct = xmalloc(size * sizeof (double));
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      zaxisP->vct, size, DATATYPE_FLT64, context);
+      serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                      &d, 1, DATATYPE_FLT64, context);
+      xassert(xchecksum(DATATYPE_FLT, size, zaxisP->vct) == d);
     }
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      charBuffer, zaxisNstrings * CDI_MAX_NAME, MPI_CHAR, comm ));
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      &d, 1, MPI_DOUBLE, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &d, 1, DATATYPE_FLT64, context);
 
-  xassert ( d == xchecksum ( DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer ));
+  xassert(d == xchecksum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer));
 
   memcpy ( zaxisP->name,     &charBuffer[CDI_MAX_NAME * 0], CDI_MAX_NAME );
   memcpy ( zaxisP->longname, &charBuffer[CDI_MAX_NAME * 1], CDI_MAX_NAME );
   memcpy ( zaxisP->stdname,  &charBuffer[CDI_MAX_NAME * 2], CDI_MAX_NAME );
   memcpy ( zaxisP->units,    &charBuffer[CDI_MAX_NAME * 3], CDI_MAX_NAME );
 
-  xmpi ( MPI_Unpack ( unpackBuffer, unpackBufferSize, unpackBufferPos,
-                      &zaxisP->positive, 1, MPI_UNSIGNED_CHAR, comm ));
+  serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+                  &zaxisP->positive, 1, DATATYPE_UCHAR, context);
 }
 
-static
-void zaxisPack ( void * voidP, void * packBuffer, int packBufferSize,
-                 int * packBufferPos, MPI_Comm comm )
+static void
+zaxisPack(void * voidP, void * packBuffer, int packBufferSize,
+          int * packBufferPos, void *context)
 {
   zaxis_t   * zaxisP = ( zaxis_t * ) voidP;
-  int intBuffer[zaxisNint + 1];
+  int intBuffer[zaxisNint];
   double d;
   char charBuffer[zaxisNstrings * CDI_MAX_NAME];
 
@@ -1782,66 +1808,64 @@ void zaxisPack ( void * voidP, void * packBuffer, int packBufferSize,
   intBuffer[6]  = zaxisP->vctsize;
   intBuffer[7]  = zaxisGetMemberMask ( zaxisP );
 
-  xmpi ( MPI_Pack ( intBuffer, zaxisNint + 1, MPI_INT,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum ( DATATYPE_INT, zaxisNint + 1, intBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(intBuffer, zaxisNint, DATATYPE_INT,
+                packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum ( DATATYPE_INT, zaxisNint, intBuffer );
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
+
 
   if ( zaxisP->vals )
     {
-
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack ( zaxisP->vals, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->vals );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(zaxisP->size);
+      serializePack(zaxisP->vals, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->vals );
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->lbounds )
+  if (zaxisP->lbounds)
     {
-      xassert ( zaxisP->size );
-
-      xmpi ( MPI_Pack ( zaxisP->lbounds, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->lbounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      xassert(zaxisP->size);
+      serializePack(zaxisP->lbounds, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->lbounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->ubounds )
+  if (zaxisP->ubounds)
     {
-      xassert ( zaxisP->size );
+      xassert(zaxisP->size);
 
-      xmpi ( MPI_Pack ( zaxisP->ubounds, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->ubounds );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(zaxisP->ubounds, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->ubounds);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->weights )
+  if (zaxisP->weights)
     {
-      xassert ( zaxisP->size );
+      xassert(zaxisP->size);
 
-      xmpi ( MPI_Pack ( zaxisP->weights, zaxisP->size, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->size, zaxisP->weights );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(zaxisP->weights, zaxisP->size, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->size, zaxisP->weights);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
-  if ( zaxisP->vct )
+  if (zaxisP->vct)
     {
-      xassert ( zaxisP->vctsize );
+      xassert(zaxisP->vctsize);
 
-      xmpi ( MPI_Pack ( zaxisP->vct, zaxisP->vctsize, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
-      d = xchecksum ( DATATYPE_FLT, zaxisP->vctsize, zaxisP->vct );
-      xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                        packBuffer, packBufferSize, packBufferPos, comm ));
+      serializePack(zaxisP->vct, zaxisP->vctsize, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
+      d = xchecksum(DATATYPE_FLT, zaxisP->vctsize, zaxisP->vct);
+      serializePack(&d, 1, DATATYPE_FLT64,
+                    packBuffer, packBufferSize, packBufferPos, context);
     }
 
   memcpy ( &charBuffer[CDI_MAX_NAME * 0], zaxisP->name,     CDI_MAX_NAME );
@@ -1849,17 +1873,16 @@ void zaxisPack ( void * voidP, void * packBuffer, int packBufferSize,
   memcpy ( &charBuffer[CDI_MAX_NAME * 2], zaxisP->stdname,  CDI_MAX_NAME );
   memcpy ( &charBuffer[CDI_MAX_NAME * 3], zaxisP->units,    CDI_MAX_NAME );
 
-  xmpi ( MPI_Pack ( charBuffer, zaxisNstrings * CDI_MAX_NAME, MPI_CHAR,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
-  d = xchecksum  ( DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer );
-  xmpi ( MPI_Pack ( &d, 1, MPI_DOUBLE,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT,
+                packBuffer, packBufferSize, packBufferPos, context);
+  d = xchecksum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer);
+  serializePack(&d, 1, DATATYPE_FLT64,
+                packBuffer, packBufferSize, packBufferPos, context);
 
-  xmpi ( MPI_Pack ( &zaxisP->positive, 1, MPI_UNSIGNED_CHAR,
-                    packBuffer, packBufferSize, packBufferPos, comm ));
+  serializePack(&zaxisP->positive, 1, DATATYPE_UCHAR,
+                packBuffer, packBufferSize, packBufferPos, context);
 }
 
-#endif
 
 void zaxisGetIndexList ( int nzaxis, int * zaxisResHs )
 {
diff --git a/libcdi/tests/Makefile.am b/libcdi/tests/Makefile.am
index bae6aac..316c9f4 100644
--- a/libcdi/tests/Makefile.am
+++ b/libcdi/tests/Makefile.am
@@ -1,23 +1,33 @@
 ## Process this file with automake to produce Makefile.in
 #
-TESTS = test_grib.sh test_cksum_grib test_cksum_nc test_cksum_extra \
+TESTS = test_grib.sh cksum_verify \
+	test_cksum_grib test_cksum_nc test_cksum_extra \
 	test_cksum_service test_cksum_nc2 test_cksum_nc4 test_cksum_ieg \
+	test_chunk_cksum \
 	pio_write_run pio_cksum_mpinonb pio_cksum_fpguard \
-	pio_cksum_asynch pio_cksum_writer
-check_PROGRAMS = test_grib cksum_write cksum_read pio_write
+	pio_cksum_asynch pio_cksum_writer pio_cksum_cdf \
+	test_resource_copy
+check_PROGRAMS = cksum_verify test_grib cksum_write cksum_read pio_write \
+	test_resource_copy cksum_write_chunk
 #
 test_grib_SOURCES = test_grib.c
+cksum_verify_SOURCES = cksum_verify.c cksum.c cksum.h
 cksum_write_SOURCES = cksum_write.c cksum.c cksum.h
+cksum_write_chunk_SOURCES = cksum_write_chunk.c cksum.c cksum.h
 cksum_read_SOURCES = cksum_read.c \
 	var_cksum.c var_cksum.h \
 	stream_cksum.c stream_cksum.h \
 	cksum.c cksum.h \
 	ensure_array_size.h ensure_array_size.c
 pio_write_SOURCES = pio_write.c cksum.h cksum.c
+test_resource_copy_SOURCES = test_resource_copy.c
 #
+AM_CFLAGS = $(YAXT_CFLAGS)
 LDADD = ../src/libcdi.la -lm
 INCLUDES   = -I$(top_srcdir)/src
 #
 EXTRA_DIST = $(TESTS)
 #
 CLEANFILES  = `ls *~ *.grb *.nc *.srv *.ext example_*.cksum`
+#
+AUTOMAKE_OPTIONS = color-tests
diff --git a/libcdi/tests/Makefile.in b/libcdi/tests/Makefile.in
index d85d84c..605e3f0 100644
--- a/libcdi/tests/Makefile.in
+++ b/libcdi/tests/Makefile.in
@@ -50,13 +50,21 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-check_PROGRAMS = test_grib$(EXEEXT) cksum_write$(EXEEXT) \
-	cksum_read$(EXEEXT) pio_write$(EXEEXT)
+TESTS = test_grib.sh cksum_verify$(EXEEXT) test_cksum_grib \
+	test_cksum_nc test_cksum_extra test_cksum_service \
+	test_cksum_nc2 test_cksum_nc4 test_cksum_ieg test_chunk_cksum \
+	pio_write_run pio_cksum_mpinonb pio_cksum_fpguard \
+	pio_cksum_asynch pio_cksum_writer pio_cksum_cdf \
+	test_resource_copy$(EXEEXT)
+check_PROGRAMS = cksum_verify$(EXEEXT) test_grib$(EXEEXT) \
+	cksum_write$(EXEEXT) cksum_read$(EXEEXT) pio_write$(EXEEXT) \
+	test_resource_copy$(EXEEXT) cksum_write_chunk$(EXEEXT)
 subdir = tests
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-	$(srcdir)/pio_cksum_asynch.in $(srcdir)/pio_cksum_fpguard.in \
-	$(srcdir)/pio_cksum_mpinonb.in $(srcdir)/pio_cksum_writer.in \
-	$(srcdir)/pio_write_run.in $(srcdir)/test_cksum_extra.in \
+	$(srcdir)/pio_cksum_asynch.in $(srcdir)/pio_cksum_cdf.in \
+	$(srcdir)/pio_cksum_fpguard.in $(srcdir)/pio_cksum_mpinonb.in \
+	$(srcdir)/pio_cksum_writer.in $(srcdir)/pio_write_run.in \
+	$(srcdir)/test_chunk_cksum.in $(srcdir)/test_cksum_extra.in \
 	$(srcdir)/test_cksum_grib.in $(srcdir)/test_cksum_ieg.in \
 	$(srcdir)/test_cksum_nc.in $(srcdir)/test_cksum_nc2.in \
 	$(srcdir)/test_cksum_nc4.in $(srcdir)/test_cksum_service.in
@@ -79,8 +87,9 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES = test_cksum_grib test_cksum_nc test_cksum_nc2 \
 	test_cksum_nc4 test_cksum_extra test_cksum_service \
-	test_cksum_ieg pio_write_run pio_cksum_mpinonb \
-	pio_cksum_fpguard pio_cksum_asynch pio_cksum_writer
+	test_cksum_ieg test_chunk_cksum pio_write_run \
+	pio_cksum_mpinonb pio_cksum_fpguard pio_cksum_asynch \
+	pio_cksum_writer pio_cksum_cdf
 CONFIG_CLEAN_VPATH_FILES =
 am_cksum_read_OBJECTS = cksum_read.$(OBJEXT) var_cksum.$(OBJEXT) \
 	stream_cksum.$(OBJEXT) cksum.$(OBJEXT) \
@@ -88,10 +97,19 @@ am_cksum_read_OBJECTS = cksum_read.$(OBJEXT) var_cksum.$(OBJEXT) \
 cksum_read_OBJECTS = $(am_cksum_read_OBJECTS)
 cksum_read_LDADD = $(LDADD)
 cksum_read_DEPENDENCIES = ../src/libcdi.la
+am_cksum_verify_OBJECTS = cksum_verify.$(OBJEXT) cksum.$(OBJEXT)
+cksum_verify_OBJECTS = $(am_cksum_verify_OBJECTS)
+cksum_verify_LDADD = $(LDADD)
+cksum_verify_DEPENDENCIES = ../src/libcdi.la
 am_cksum_write_OBJECTS = cksum_write.$(OBJEXT) cksum.$(OBJEXT)
 cksum_write_OBJECTS = $(am_cksum_write_OBJECTS)
 cksum_write_LDADD = $(LDADD)
 cksum_write_DEPENDENCIES = ../src/libcdi.la
+am_cksum_write_chunk_OBJECTS = cksum_write_chunk.$(OBJEXT) \
+	cksum.$(OBJEXT)
+cksum_write_chunk_OBJECTS = $(am_cksum_write_chunk_OBJECTS)
+cksum_write_chunk_LDADD = $(LDADD)
+cksum_write_chunk_DEPENDENCIES = ../src/libcdi.la
 am_pio_write_OBJECTS = pio_write.$(OBJEXT) cksum.$(OBJEXT)
 pio_write_OBJECTS = $(am_pio_write_OBJECTS)
 pio_write_LDADD = $(LDADD)
@@ -100,6 +118,10 @@ am_test_grib_OBJECTS = test_grib.$(OBJEXT)
 test_grib_OBJECTS = $(am_test_grib_OBJECTS)
 test_grib_LDADD = $(LDADD)
 test_grib_DEPENDENCIES = ../src/libcdi.la
+am_test_resource_copy_OBJECTS = test_resource_copy.$(OBJEXT)
+test_resource_copy_OBJECTS = $(am_test_resource_copy_OBJECTS)
+test_resource_copy_LDADD = $(LDADD)
+test_resource_copy_DEPENDENCIES = ../src/libcdi.la
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/src
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
@@ -113,10 +135,14 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(cksum_read_SOURCES) $(cksum_write_SOURCES) \
-	$(pio_write_SOURCES) $(test_grib_SOURCES)
-DIST_SOURCES = $(cksum_read_SOURCES) $(cksum_write_SOURCES) \
-	$(pio_write_SOURCES) $(test_grib_SOURCES)
+SOURCES = $(cksum_read_SOURCES) $(cksum_verify_SOURCES) \
+	$(cksum_write_SOURCES) $(cksum_write_chunk_SOURCES) \
+	$(pio_write_SOURCES) $(test_grib_SOURCES) \
+	$(test_resource_copy_SOURCES)
+DIST_SOURCES = $(cksum_read_SOURCES) $(cksum_verify_SOURCES) \
+	$(cksum_write_SOURCES) $(cksum_write_chunk_SOURCES) \
+	$(pio_write_SOURCES) $(test_grib_SOURCES) \
+	$(test_resource_copy_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -124,8 +150,21 @@ am__can_run_installinfo = \
   esac
 ETAGS = etags
 CTAGS = ctags
+# If stdout is a non-dumb tty, use colors.  If test -t is not supported,
+# then this fails; a conservative approach.  Of course do not redirect
+# stdout here, just stderr.
 am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
+red=; grn=; lgn=; blu=; std=; \
+test "X$(AM_COLOR_TESTS)" != Xno \
+&& test "X$$TERM" != Xdumb \
+&& { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
+&& { \
+  red=''; \
+  grn=''; \
+  lgn=''; \
+  blu=''; \
+  std=''; \
+}
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -135,6 +174,13 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+BUILD_CXX = @BUILD_CXX@
+BUILD_F77 = @BUILD_F77@
+BUILD_FC = @BUILD_FC@
+BUILD_FCFLAGS = @BUILD_FCFLAGS@
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CDI_F90_INTERFACE_FCFLAGS = @CDI_F90_INTERFACE_FCFLAGS@
@@ -160,6 +206,9 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
 ENABLE_EXTRA = @ENABLE_EXTRA@
 ENABLE_GRIB = @ENABLE_GRIB@
 ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
+ENABLE_NETCDF = @ENABLE_NETCDF@
 ENABLE_PYTHON = @ENABLE_PYTHON@
 ENABLE_RUBY = @ENABLE_RUBY@
 ENABLE_SERVICE = @ENABLE_SERVICE@
@@ -180,6 +229,7 @@ FPP_INCOPT = @FPP_INCOPT@
 GREP = @GREP@
 GRIB_API_INCLUDE = @GRIB_API_INCLUDE@
 GRIB_API_LIBS = @GRIB_API_LIBS@
+HAVE_PARALLEL_NC4 = @HAVE_PARALLEL_NC4@
 HDF5_INCLUDE = @HDF5_INCLUDE@
 HDF5_LIBS = @HDF5_LIBS@
 HDF5_ROOT = @HDF5_ROOT@
@@ -223,6 +273,11 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PPM_CORE_CFLAGS = @PPM_CORE_CFLAGS@
+PPM_CORE_LIBS = @PPM_CORE_LIBS@
 PTHREAD_CC = @PTHREAD_CC@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
@@ -242,6 +297,8 @@ THREADS_LIBS = @THREADS_LIBS@
 USER_NAME = @USER_NAME@
 USE_MPI = @USE_MPI@
 VERSION = @VERSION@
+YAXT_CFLAGS = @YAXT_CFLAGS@
+YAXT_LIBS = @YAXT_LIBS@
 ZLIB_INCLUDE = @ZLIB_INCLUDE@
 ZLIB_LIBS = @ZLIB_LIBS@
 abs_builddir = @abs_builddir@
@@ -301,16 +358,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-
-#
-TESTS = test_grib.sh test_cksum_grib test_cksum_nc test_cksum_extra \
-	test_cksum_service test_cksum_nc2 test_cksum_nc4 test_cksum_ieg \
-	pio_write_run pio_cksum_mpinonb pio_cksum_fpguard \
-	pio_cksum_asynch pio_cksum_writer
-
 #
 test_grib_SOURCES = test_grib.c
+cksum_verify_SOURCES = cksum_verify.c cksum.c cksum.h
 cksum_write_SOURCES = cksum_write.c cksum.c cksum.h
+cksum_write_chunk_SOURCES = cksum_write_chunk.c cksum.c cksum.h
 cksum_read_SOURCES = cksum_read.c \
 	var_cksum.c var_cksum.h \
 	stream_cksum.c stream_cksum.h \
@@ -318,13 +370,17 @@ cksum_read_SOURCES = cksum_read.c \
 	ensure_array_size.h ensure_array_size.c
 
 pio_write_SOURCES = pio_write.c cksum.h cksum.c
+test_resource_copy_SOURCES = test_resource_copy.c
 #
+AM_CFLAGS = $(YAXT_CFLAGS)
 LDADD = ../src/libcdi.la -lm
 INCLUDES = -I$(top_srcdir)/src
 #
 EXTRA_DIST = $(TESTS)
 #
 CLEANFILES = `ls *~ *.grb *.nc *.srv *.ext example_*.cksum`
+#
+AUTOMAKE_OPTIONS = color-tests
 all: all-am
 
 .SUFFIXES:
@@ -373,6 +429,8 @@ test_cksum_service: $(top_builddir)/config.status $(srcdir)/test_cksum_service.i
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 test_cksum_ieg: $(top_builddir)/config.status $(srcdir)/test_cksum_ieg.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+test_chunk_cksum: $(top_builddir)/config.status $(srcdir)/test_chunk_cksum.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 pio_write_run: $(top_builddir)/config.status $(srcdir)/pio_write_run.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 pio_cksum_mpinonb: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpinonb.in
@@ -383,6 +441,8 @@ pio_cksum_asynch: $(top_builddir)/config.status $(srcdir)/pio_cksum_asynch.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 pio_cksum_writer: $(top_builddir)/config.status $(srcdir)/pio_cksum_writer.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+pio_cksum_cdf: $(top_builddir)/config.status $(srcdir)/pio_cksum_cdf.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 clean-checkPROGRAMS:
 	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -395,15 +455,24 @@ clean-checkPROGRAMS:
 cksum_read$(EXEEXT): $(cksum_read_OBJECTS) $(cksum_read_DEPENDENCIES) $(EXTRA_cksum_read_DEPENDENCIES) 
 	@rm -f cksum_read$(EXEEXT)
 	$(LINK) $(cksum_read_OBJECTS) $(cksum_read_LDADD) $(LIBS)
+cksum_verify$(EXEEXT): $(cksum_verify_OBJECTS) $(cksum_verify_DEPENDENCIES) $(EXTRA_cksum_verify_DEPENDENCIES) 
+	@rm -f cksum_verify$(EXEEXT)
+	$(LINK) $(cksum_verify_OBJECTS) $(cksum_verify_LDADD) $(LIBS)
 cksum_write$(EXEEXT): $(cksum_write_OBJECTS) $(cksum_write_DEPENDENCIES) $(EXTRA_cksum_write_DEPENDENCIES) 
 	@rm -f cksum_write$(EXEEXT)
 	$(LINK) $(cksum_write_OBJECTS) $(cksum_write_LDADD) $(LIBS)
+cksum_write_chunk$(EXEEXT): $(cksum_write_chunk_OBJECTS) $(cksum_write_chunk_DEPENDENCIES) $(EXTRA_cksum_write_chunk_DEPENDENCIES) 
+	@rm -f cksum_write_chunk$(EXEEXT)
+	$(LINK) $(cksum_write_chunk_OBJECTS) $(cksum_write_chunk_LDADD) $(LIBS)
 pio_write$(EXEEXT): $(pio_write_OBJECTS) $(pio_write_DEPENDENCIES) $(EXTRA_pio_write_DEPENDENCIES) 
 	@rm -f pio_write$(EXEEXT)
 	$(LINK) $(pio_write_OBJECTS) $(pio_write_LDADD) $(LIBS)
 test_grib$(EXEEXT): $(test_grib_OBJECTS) $(test_grib_DEPENDENCIES) $(EXTRA_test_grib_DEPENDENCIES) 
 	@rm -f test_grib$(EXEEXT)
 	$(LINK) $(test_grib_OBJECTS) $(test_grib_LDADD) $(LIBS)
+test_resource_copy$(EXEEXT): $(test_resource_copy_OBJECTS) $(test_resource_copy_DEPENDENCIES) $(EXTRA_test_resource_copy_DEPENDENCIES) 
+	@rm -f test_resource_copy$(EXEEXT)
+	$(LINK) $(test_resource_copy_OBJECTS) $(test_resource_copy_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -413,11 +482,14 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cksum.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cksum_read.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cksum_verify.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cksum_write.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cksum_write_chunk.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ensure_array_size.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pio_write.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stream_cksum.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_grib.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_resource_copy.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/var_cksum.Po at am__quote@
 
 .c.o:
diff --git a/libcdi/tests/cksum_verify b/libcdi/tests/cksum_verify
new file mode 100755
index 0000000..3805fd2
Binary files /dev/null and b/libcdi/tests/cksum_verify differ
diff --git a/libcdi/tests/cksum_verify.c b/libcdi/tests/cksum_verify.c
new file mode 100644
index 0000000..bdbf262
--- /dev/null
+++ b/libcdi/tests/cksum_verify.c
@@ -0,0 +1,58 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "cksum.h"
+
+enum {
+  block_size = 16,
+};
+
+int
+main()
+{
+  unsigned char *test_data, *init_block;
+  size_t num_blocks = 1000;
+  if (!(init_block = calloc(block_size * block_size, 1U))
+      || !(test_data = calloc((size_t)block_size * num_blocks, 1U)))
+    return EXIT_FAILURE;
+  /* this is supposed to be non-random */
+  srand48(5L);
+  init_block[7] = 15U;
+  /* repeat block and rotate */
+  for (size_t i = 1; i < block_size; ++i)
+    {
+      memcpy(init_block + block_size * i,
+             init_block + block_size - i, i);
+      memcpy(init_block + block_size * i + i, init_block,
+             block_size - i);
+    }
+  for (size_t i = 0; i < num_blocks; ++i)
+    {
+      size_t block_idx = ((size_t)lrand48()) % block_size;
+      memcpy(test_data + i, init_block + block_idx * block_size,
+             block_size);
+    }
+  uint32_t cksum_result = memcrc(test_data, num_blocks * block_size);
+  if (cksum_result != UINT32_C(0xc47779cd))
+    {
+      printf("unexpected crc result: 0x%8"PRIx32"\n", cksum_result);
+      return EXIT_FAILURE;
+    }
+  return EXIT_SUCCESS;
+}
+
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
diff --git a/libcdi/tests/cksum_write.c b/libcdi/tests/cksum_write.c
index 7b25d6d..ba060da 100644
--- a/libcdi/tests/cksum_write.c
+++ b/libcdi/tests/cksum_write.c
@@ -11,6 +11,7 @@
 
 #include "cksum.h"
 
+
 static int
 parse_intarg(const char msg[])
 {
@@ -37,6 +38,13 @@ sign_flat(double v)
   return v;
 }
 
+static void
+allocError(const char *msg)
+{
+  perror(msg);
+  exit(EXIT_FAILURE);
+}
+
 static char *
 fname_create(const char *prefix, const char *suffix)
 {
@@ -44,16 +52,35 @@ fname_create(const char *prefix, const char *suffix)
   char *fname;
   if (!(fname =malloc((prefix_len = strlen(prefix)) + 1
                       + (suffix_len = strlen(suffix)) + 1)))
-    {
-      perror("cannot create string");
-      exit(EXIT_FAILURE);
-    }
+    allocError("cannot create string");
   strcpy(fname, prefix);
   fname[prefix_len] = '.';
   strcpy(fname + prefix_len + 1, suffix);
   return fname;
 }
 
+#ifdef TEST_CHUNK_WRITE
+static void
+get_chunk(double *chunkBuf, double *var, int varShape[3],
+          int chunk[3][2])
+{
+  size_t ofs = 0;
+  unsigned start_k = (unsigned)chunk[2][0], start_j = (unsigned)chunk[1][0],
+    start_i = (unsigned)chunk[0][0];
+  unsigned size_k = (unsigned)chunk[2][1] - (unsigned)chunk[2][0] + 1,
+    size_j = (unsigned)chunk[1][1] - (unsigned)chunk[1][0] + 1,
+    size_i = (unsigned)chunk[0][1] - (unsigned)chunk[0][0] + 1;
+  size_t stride_k = (size_t)varShape[0] * (size_t)varShape[1],
+    stride_j = (size_t)varShape[0];
+  for (unsigned k = 0; k < size_k ; ++k)
+    for (unsigned j = 0; j < size_j; ++j)
+      for (unsigned i = 0; i < size_i; ++i)
+        chunkBuf[ofs++] = var[(k + start_k) * stride_k
+                              + (j + start_j) * stride_j + (i + start_i)];
+}
+#endif
+
+#ifndef TEST_CHUNK_WRITE
 static const struct {
   char suffix[4];
   int type, defaultDT, defaultGrid;
@@ -66,7 +93,7 @@ static const struct {
   { "svc", FILETYPE_SRV, DATATYPE_FLT64, GRID_GENERIC, },
   { "ieg", FILETYPE_IEG, DATATYPE_FLT64, GRID_LONLAT },
 };
-
+#endif
 enum {
   nvars = 2,
 };
@@ -86,13 +113,24 @@ main(int argc, char *argv[])
   double *lons, *lats, *var[nvars], *levs, mscale, mrscale;
   size_t varSize[nvars];
   char *varName[nvars] = { "varname1", "varname2" };
+#ifndef TEST_CHUNK_WRITE
   const char *suffix = "grb", *prefix = "example";
   int grid = GRID_LONLAT;
   int filetype = FILETYPE_GRB, datatype = DATATYPE_PACK24;
+#else
+  const char *suffix = "nc", *prefix = "example";
+  int grid = GRID_LONLAT;
+  int filetype = FILETYPE_NC, datatype = DATATYPE_FLT64;
+#endif
   {
     int opt;
-    while ((opt = getopt(argc, argv, "f:m:n:o:t:")) != -1)
+    while ((opt = getopt(argc, argv,
+#ifndef TEST_CHUNK_WRITE
+                         "f:"
+#endif
+                         "m:n:o:t:")) != -1)
       switch (opt) {
+#ifndef TEST_CHUNK_WRITE
       case 'f':
         {
           int found = 0;
@@ -114,8 +152,17 @@ main(int argc, char *argv[])
             }
         }
         break;
+#endif
       case 'm':
         nlon = parse_intarg("error parsing number of longitudes");
+#ifdef TEST_CHUNK_WRITE
+        if (nlon < 2)
+          {
+            fputs("number of longitudes must be larger 1 for "
+                  "chunk write test\n", stderr);
+            exit(EXIT_FAILURE);
+          }
+#endif
         break;
       case 'n':
         nlat = parse_intarg("error parsing number of latitudes");
@@ -177,7 +224,6 @@ main(int argc, char *argv[])
       vlistDefVarDatatype(vlistID, varID[i], datatype);
       // create memory for variables
       var[i] = malloc(varSize[i] * sizeof (var[i][0]));
-
     }
 
   {
@@ -266,8 +312,38 @@ main(int argc, char *argv[])
         memcrc_r(&checksum_state[1], (const unsigned char *)var[1], varSize[1] * sizeof (var[1][0]));
 
         // Write var1 and var2
+#ifdef TEST_CHUNK_WRITE
+        {
+          size_t maxChunkSize = (nlon + 1)/2 * nlat * nlev;
+          double *chunkBuf = malloc(maxChunkSize * sizeof (double));
+          int varShape[2][3] = { { nlon, nlat, 1 }, { nlon, nlat, nlev } },
+            chunk[3][2] = { { 0, nlon/2 - 1 }, { 0, nlat - 1 }, { 0, 0 } };
+          if (!chunkBuf)
+              allocError("cannot create chunk buffer");
+          chunk[0][0] = 0; chunk[0][1] = nlon/2 - 1;
+          chunk[2][1] = 0;
+          get_chunk(chunkBuf, var[0], varShape[0], chunk);
+          streamWriteVarChunk(streamID, varID[0], (const int (*)[2])chunk,
+                              chunkBuf, nmiss);
+          chunk[2][1] = nlev - 1;
+          get_chunk(chunkBuf, var[1], varShape[1], chunk);
+          streamWriteVarChunk(streamID, varID[1], (const int (*)[2])chunk,
+                              chunkBuf, nmiss);
+          chunk[0][0] = chunk[0][1] + 1; chunk[0][1] = nlon - 1;
+          chunk[2][1] = 0;
+          get_chunk(chunkBuf, var[0], varShape[0], chunk);
+          streamWriteVarChunk(streamID, varID[0], (const int (*)[2])chunk,
+                              chunkBuf, nmiss);
+          chunk[2][1] = nlev - 1;
+          get_chunk(chunkBuf, var[1], varShape[1], chunk);
+          streamWriteVarChunk(streamID, varID[1], (const int (*)[2])chunk,
+                              chunkBuf, nmiss);
+          free(chunkBuf);
+        }
+#else
         streamWriteVar(streamID, varID[0], var[0], nmiss);
         streamWriteVar(streamID, varID[1], var[1], nmiss);
+#endif
       }
     // write checksums to table file
     {
@@ -301,12 +377,16 @@ main(int argc, char *argv[])
   streamClose(streamID);
 
   // Destroy the objects
+  for (i = 0; i < nvars; ++i)
+    free(var[i]);
   vlistDestroy(vlistID);
   taxisDestroy(taxisID);
   zaxisDestroy(zaxisID[0]);
   zaxisDestroy(zaxisID[1]);
   gridDestroy(gridID);
-
+  free(levs);
+  free(lats);
+  free(lons);
   return 0;
 }
 
diff --git a/libcdi/tests/cksum_write_chunk.c b/libcdi/tests/cksum_write_chunk.c
new file mode 100644
index 0000000..bd8628c
--- /dev/null
+++ b/libcdi/tests/cksum_write_chunk.c
@@ -0,0 +1,2 @@
+#define TEST_CHUNK_WRITE 1
+#include "cksum_write.c"
diff --git a/libcdi/tests/pio_cksum_cdf b/libcdi/tests/pio_cksum_cdf
new file mode 100755
index 0000000..1f28a45
--- /dev/null
+++ b/libcdi/tests/pio_cksum_cdf
@@ -0,0 +1,10 @@
+#! /bin/sh
+pio_write_args="-f nc4 -w 3"
+mpi_task_num=7
+LOG=pio_cksum_cdf.log
+suffix=nc4
+if [ "" = yes -a "yes" = yes ]; then
+  . ./pio_write_run
+else
+  exit 77
+fi
diff --git a/libcdi/tests/pio_cksum_cdf.in b/libcdi/tests/pio_cksum_cdf.in
new file mode 100644
index 0000000..afa30ee
--- /dev/null
+++ b/libcdi/tests/pio_cksum_cdf.in
@@ -0,0 +1,10 @@
+#! @SHELL@
+pio_write_args="-f nc4 -w 3"
+mpi_task_num=7
+LOG=pio_cksum_cdf.log
+suffix=nc4
+if [ "@USE_MPI@" = yes -a "@ENABLE_NETCDF@" = yes ]; then
+  . ./pio_write_run
+else
+  exit 77
+fi
diff --git a/libcdi/tests/pio_write.c b/libcdi/tests/pio_write.c
index 4cf59cf..32ce947 100644
--- a/libcdi/tests/pio_write.c
+++ b/libcdi/tests/pio_write.c
@@ -14,7 +14,7 @@
 
 #ifdef USE_MPI
 #include <mpi.h>
-#include "pio_c_temp.h"
+#include <yaxt.h>
 #else
 typedef int MPI_Comm;
 #endif
@@ -83,6 +83,10 @@ modelRegionCompute(double region[], size_t offset, size_t len,
     }
 }
 
+#ifdef USE_MPI
+static int
+uniform_partition_start(int set_interval[2], int nparts, int part_idx);
+#endif
 
 static void
 modelRun(struct model_config setup, MPI_Comm comm)
@@ -94,21 +98,25 @@ modelRun(struct model_config setup, MPI_Comm comm)
 
   int gridID, zaxisID[nVars], taxisID;
   int vlistID, varIDs[nVars], streamID, tsID, tfID = 0;
-  int i, varID, nmiss = 0;
+  int i, nmiss = 0;
   double *lons, *lats;
-  double *var = NULL, *varslice;
+  double *var = NULL, *varslice = NULL;
   double mscale, mrscale;
   time_t current_time;
   int vdate = 19850101, vtime = 120000;
-  int start = CDI_UNDEFID, chunk = CDI_UNDEFID, rank = 0, comm_size = 1;
+  int rank = 0;
   char filename[1024];
   int nlon = setup.nlon, nlat = setup.nlat;
   uint32_t checksum_state[nVars];
-  size_t varSize[nVars], varslice_size;
+  size_t varSize[nVars], varslice_size = 0;
   int *nlev;
   double *levs;
 #if USE_MPI
-  int *chunks = NULL, *displs = NULL;
+  int *chunks = NULL, *displs = NULL, comm_size = 1;
+  struct var1DDeco {
+    int chunkSize, start;
+    Xt_idxlist partDesc;
+  } varDeco[nVars];
 #endif
 
 #if USE_MPI
@@ -128,10 +136,10 @@ modelRun(struct model_config setup, MPI_Comm comm)
   gridID = gridCreate ( GRID_LONLAT, nlon*nlat );
   gridDefXsize ( gridID, nlon );
   gridDefYsize ( gridID, nlat );
-  lons = malloc(nlon * sizeof (lons[0]));
+  lons = xmalloc(nlon * sizeof (lons[0]));
   for (i = 0; i < nlon; ++i)
     lons[i] = ((double)(i * 360))/nlon;
-  lats = malloc(nlat * sizeof (lats[0]));
+  lats = xmalloc(nlat * sizeof (lats[0]));
   for (i = 0; i < nlat; ++i)
     lats[i] = ((double)(i * 180))/nlat - 90.0;
   gridDefXvals ( gridID, lons );
@@ -150,15 +158,30 @@ modelRun(struct model_config setup, MPI_Comm comm)
       zaxisDefLevels ( zaxisID[i], levs );
     }
 
-  varslice = NULL;
-  varslice_size = 0;
-
   vlistID = vlistCreate ();
 
   for ( i = 0; i < nVars; i++ )
     {
       varIDs[i] = vlistDefVar ( vlistID, gridID, zaxisID[i], TIME_VARIABLE );
       varSize[i] = nlon * nlat * nlev[i];
+#ifdef USE_MPI
+      {
+         int start = uniform_partition_start((int [2]){ 0, varSize[i] - 1 },
+                                             comm_size, rank),
+           chunkSize = uniform_partition_start((int [2]){ 0, varSize[i] - 1 },
+                                               comm_size, rank + 1) - start;
+         fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank,
+                 start, chunkSize);
+         Xt_idxlist idxlist
+           = xt_idxstripes_new(&(struct Xt_stripe){ .start = start,
+                   .nstrides = chunkSize, .stride = 1 }, 1);
+         varDeco[i] = (struct var1DDeco){
+           .start = start,
+           .chunkSize = chunkSize,
+           .partDesc = idxlist
+         };
+      }
+#endif
       vlistDefVarCode(vlistID, varIDs[i], varCodes[i]);
       vlistDefVarDatatype(vlistID, varIDs[i], setup.datatype);
     }
@@ -171,7 +194,9 @@ modelRun(struct model_config setup, MPI_Comm comm)
   xassert ( streamID >= 0 );
   streamDefVlist ( streamID, vlistID);
 
+#ifdef USE_MPI
   pioEndDef ();
+#endif
 
   for ( tfID = 0; tfID < ntfiles; tfID++ )
     {
@@ -193,10 +218,15 @@ modelRun(struct model_config setup, MPI_Comm comm)
 	  taxisDefVdate ( taxisID, vdate );
 	  taxisDefVtime ( taxisID, vtime );
 	  streamDefTimestep ( streamID, tsID );
-	  for ( varID = 0; varID < nVars; varID++ )
+	  for (int varID = 0; varID < nVars; ++varID)
 	    {
-              start = pioInqVarDecoOff(vlistID, varIDs[varID]);
-              chunk = pioInqVarDecoChunk(vlistID, varIDs[varID]);
+#ifdef USE_MPI
+              int start = varDeco[varID].start;
+              int chunk = varDeco[varID].chunkSize;
+#else
+              int chunk = varSize[varID];
+              int start = 0;
+#endif
               if (varslice_size < chunk)
                 {
                   varslice = xrealloc(varslice, chunk * sizeof (var[0]));
@@ -229,12 +259,19 @@ modelRun(struct model_config setup, MPI_Comm comm)
                            varSize[varID] * sizeof (var[0]));
                 }
 
-	      streamWriteVar ( streamID, varIDs[varID], varslice, nmiss );
+#ifdef USE_MPI
+	      streamWriteVarPart(streamID, varIDs[varID], varslice, nmiss,
+                                 varDeco[varID].partDesc);
+#else
+	      streamWriteVar(streamID, varIDs[varID], varslice, nmiss);
+#endif
 	      start = CDI_UNDEFID;
 	      chunk = CDI_UNDEFID;
 	    }
           current_time += 86400;
+#ifdef USE_MPI
 	  pioWriteTimestep ( tsID, vdate, vtime );
+#endif
 	}
       if (rank == 0 && setup.compute_checksum)
         {
@@ -265,13 +302,25 @@ modelRun(struct model_config setup, MPI_Comm comm)
           }
         }
     }
+  free(varslice);
+#ifdef USE_MPI
   pioEndTimestepping ();
+#endif
   streamClose ( streamID );
   vlistDestroy ( vlistID );
   taxisDestroy ( taxisID );
   for ( i = 0; i < nVars; i++ )
     zaxisDestroy ( zaxisID[i] );
   gridDestroy ( gridID );
+#if USE_MPI
+  for (int varID = 0; varID < nVars; ++varID)
+    xt_idxlist_delete(varDeco[varID].partDesc);
+  free(displs);
+  free(chunks);
+  free(var);
+#endif
+  free(nlev);
+  free(levs);
   free(lats);
   free(lons);
 }
@@ -367,12 +416,6 @@ search_iomode_str(const char *modestr)
 
 int main (int argc, char *argv[])
 {
-#ifdef USE_MPI
-  enum {
-    nNamespaces = 2 };
-  static int hasLocalFile[nNamespaces] = { 0, 1 };
-#endif
-
   struct model_config setup = default_setup;
 
   MPI_Comm commModel;
@@ -384,7 +427,8 @@ int main (int argc, char *argv[])
   int nProcsIO = 2;
 
   xmpi ( MPI_Init ( &argc, &argv));
-  xmpi ( MPI_Comm_dup ( MPI_COMM_WORLD, &commGlob ));
+  commGlob = MPI_COMM_WORLD;
+  xt_initialize(commGlob);
   xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN ));
   xmpi ( MPI_Comm_size ( commGlob, &sizeGlob ));
   xmpi ( MPI_Comm_rank ( commGlob, &rankGlob ));
@@ -469,8 +513,9 @@ int main (int argc, char *argv[])
   }
 
 #ifdef USE_MPI
-  commModel = pioInit_c(commGlob, nProcsIO, IOMode,
-                        nNamespaces, hasLocalFile);
+  int pioNamespace;
+  commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0);
+  pioNamespaceSetActive(pioNamespace);
 #else
   commModel = -1;
 #endif
@@ -479,6 +524,7 @@ int main (int argc, char *argv[])
 
 #ifdef USE_MPI
   pioFinalize ();
+  xt_finalize();
   MPI_Finalize ();
 #endif
   return 0;
@@ -515,6 +561,17 @@ time_t2cditime(time_t t, int *date, int *timeofday)
   *timeofday = t_s->tm_hour * 10000 + t_s->tm_min * 100 + t_s->tm_sec;
 }
 
+#ifdef USE_MPI
+static int
+uniform_partition_start(int set_interval[2], int nparts, int part_idx)
+{
+  int part_offset
+    = (((long long)set_interval[1] - (long long)set_interval[0] + 1LL)
+       * (long long)part_idx) / (long long)nparts;
+  int start = set_interval[0] + part_offset;
+  return start;
+}
+#endif
 /*
  * Local Variables:
  * c-file-style: "Java"
diff --git a/libcdi/tests/pio_write_run b/libcdi/tests/pio_write_run
index 3ad5030..11ba2d2 100755
--- a/libcdi/tests/pio_write_run
+++ b/libcdi/tests/pio_write_run
@@ -2,12 +2,13 @@
 set -e
 LOG="${LOG-pio_write.log}"
 mpi_task_num="${mpi_task_num-4}"
+suffix="${suffix-grb}"
 exec 5>&1 6>&2 >"$LOG" 2>&1
 ../libtool --mode=execute /Users/m214003/cdt/work/cdo/build/gcc/libcdi/util/serialrun -n ${mpi_task_num} \
-  ./pio_write ${pio_write_args}
+  ${tool_wrap} ./pio_write ${pio_write_args}
 exec 2>&6 1>&5 5>&- 6>&-
 ../libtool --mode=execute \
-  ./cksum_read example_0.grb example_0.cksum
+  ${tool_wrap} ./cksum_read example_0.${suffix} example_0.cksum
 ../libtool --mode=execute \
-  ./cksum_read example_1.grb example_1.cksum
+  ${tool_wrap} ./cksum_read example_1.${suffix} example_1.cksum
 \rm "$LOG"
diff --git a/libcdi/tests/pio_write_run.in b/libcdi/tests/pio_write_run.in
index aafa5d4..c2c2953 100644
--- a/libcdi/tests/pio_write_run.in
+++ b/libcdi/tests/pio_write_run.in
@@ -2,12 +2,13 @@
 set -e
 LOG="${LOG-pio_write.log}"
 mpi_task_num="${mpi_task_num-4}"
+suffix="${suffix-grb}"
 exec 5>&1 6>&2 >"$LOG" 2>&1
 ../libtool --mode=execute @MPI_LAUNCH@ -n ${mpi_task_num} \
-  ./pio_write ${pio_write_args}
+  ${tool_wrap} ./pio_write ${pio_write_args}
 exec 2>&6 1>&5 5>&- 6>&-
 ../libtool --mode=execute \
-  ./cksum_read example_0.grb example_0.cksum
+  ${tool_wrap} ./cksum_read example_0.${suffix} example_0.cksum
 ../libtool --mode=execute \
-  ./cksum_read example_1.grb example_1.cksum
+  ${tool_wrap} ./cksum_read example_1.${suffix} example_1.cksum
 \rm "$LOG"
diff --git a/libcdi/tests/test_cksum_nc b/libcdi/tests/test_chunk_cksum
similarity index 54%
copy from libcdi/tests/test_cksum_nc
copy to libcdi/tests/test_chunk_cksum
index e9adf2c..7265822 100755
--- a/libcdi/tests/test_cksum_nc
+++ b/libcdi/tests/test_chunk_cksum
@@ -2,12 +2,12 @@
 
 set -e
 format=nc
-if [ @ENABLE_NETCDF@ = yes ]; then
-  exec >test_cksum_$format.log 2>&1
-  ./cksum_write -f $format
+if [ yes = yes ]; then
+  exec >test_chunk_cksum_$format.log 2>&1
+  ./cksum_write_chunk -m 17
   ./cksum_read example.$format
   \rm example.cksum example.$format
-  \rm test_cksum_$format.log
+  \rm test_chunk_cksum_$format.log
 else
   # skip tests for unsupported formats
   exit 77
diff --git a/libcdi/tests/test_cksum_nc b/libcdi/tests/test_chunk_cksum.in
old mode 100755
new mode 100644
similarity index 64%
copy from libcdi/tests/test_cksum_nc
copy to libcdi/tests/test_chunk_cksum.in
index e9adf2c..8142e3e
--- a/libcdi/tests/test_cksum_nc
+++ b/libcdi/tests/test_chunk_cksum.in
@@ -3,11 +3,11 @@
 set -e
 format=nc
 if [ @ENABLE_NETCDF@ = yes ]; then
-  exec >test_cksum_$format.log 2>&1
-  ./cksum_write -f $format
+  exec >test_chunk_cksum_$format.log 2>&1
+  ./cksum_write_chunk -m 17
   ./cksum_read example.$format
   \rm example.cksum example.$format
-  \rm test_cksum_$format.log
+  \rm test_chunk_cksum_$format.log
 else
   # skip tests for unsupported formats
   exit 77
diff --git a/libcdi/tests/test_cksum_nc b/libcdi/tests/test_cksum_nc
index e9adf2c..e9849a2 100755
--- a/libcdi/tests/test_cksum_nc
+++ b/libcdi/tests/test_cksum_nc
@@ -2,7 +2,7 @@
 
 set -e
 format=nc
-if [ @ENABLE_NETCDF@ = yes ]; then
+if [ yes = yes ]; then
   exec >test_cksum_$format.log 2>&1
   ./cksum_write -f $format
   ./cksum_read example.$format
diff --git a/libcdi/tests/test_cksum_nc2 b/libcdi/tests/test_cksum_nc2
index 1e622e8..e7d07e2 100755
--- a/libcdi/tests/test_cksum_nc2
+++ b/libcdi/tests/test_cksum_nc2
@@ -2,7 +2,7 @@
 
 set -e
 format=nc2
-if [ @ENABLE_NC2@ = yes ]; then
+if [ yes = yes ]; then
   exec >test_cksum_$format.log 2>&1
   ./cksum_write -f $format
   ./cksum_read example.$format
diff --git a/libcdi/tests/test_cksum_nc4 b/libcdi/tests/test_cksum_nc4
index 3ddad3a..75bb567 100755
--- a/libcdi/tests/test_cksum_nc4
+++ b/libcdi/tests/test_cksum_nc4
@@ -2,7 +2,7 @@
 
 set -e
 format=nc4
-if [ @ENABLE_NC4@ = yes ]; then
+if [ yes = yes ]; then
   exec >test_cksum_$format.log 2>&1
   ./cksum_write -f $format
   ./cksum_read example.$format
diff --git a/libcdi/tests/test_resource_copy b/libcdi/tests/test_resource_copy
new file mode 100755
index 0000000..7a4e255
Binary files /dev/null and b/libcdi/tests/test_resource_copy differ
diff --git a/libcdi/examples/pio/compareResourcesArray.c b/libcdi/tests/test_resource_copy.c
similarity index 77%
copy from libcdi/examples/pio/compareResourcesArray.c
copy to libcdi/tests/test_resource_copy.c
index 62aa035..6bd227a 100644
--- a/libcdi/examples/pio/compareResourcesArray.c
+++ b/libcdi/tests/test_resource_copy.c
@@ -7,13 +7,11 @@
 #ifdef USE_MPI
 #include <mpi.h>
 #include "cdi.h"
-#include "pio_c_temp.h"
 #include "pio_util.h"
+#include "resource_handle.h"
+#include "resource_unpack.h"
+#include "pio_serialize.h"
 
-extern int    reshListCompare      ( int, int );
-extern void   reshPackBufferCreate  ( char **, int *, MPI_Comm );
-extern void   reshPackBufferDestroy ( char ** );
-extern void   rpcUnpackResources    ( char *, int, MPI_Comm );
 extern void   arrayDestroy          ( void );
 
 enum {
@@ -26,8 +24,6 @@ enum {
   nlev             = 5,
   ntsteps          = 3 };
 
-static int hasLocalFile[nNamespaces] = { 0, 0 };
-
 double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
 double lats[nlat] = {-75, -45, -15, 15, 45, 75};
 double levs[nlev] = {101300, 92500, 85000, 50000, 20000};
@@ -40,7 +36,7 @@ int defineGrid ()
   double area_vec[nlon*nlat];
   const double * ap = &area_vec[0];
   int i;
-  
+
   gridID = gridCreate(GRID_LONLAT, nlon*nlat);
   gridDefXsize(gridID, nlon);
   gridDefYsize(gridID, nlat);
@@ -49,10 +45,10 @@ int defineGrid ()
   gridDefNvertex ( gridID, 1 );
   gridDefXbounds ( gridID, lons );
   gridDefYbounds ( gridID, lats );
-  for ( i = 0; i < nlon*nlat; i++ )    
+  for ( i = 0; i < nlon*nlat; i++ )
     mask_vec[i] = i % 2 ;
   gridDefMaskGME ( gridID, mp );
-  for ( i = 0; i < nlon*nlat; i++ )    
+  for ( i = 0; i < nlon*nlat; i++ )
     mask_vec[i] = 1;
   gridDefMask ( gridID, mp );
   gridDefXname ( gridID, "myXname" );
@@ -74,17 +70,17 @@ int defineGrid ()
   gridDefPosition ( gridID, 7 );
   gridDefReference ( gridID, "myReference" );
 /* gridDefLCC ( gridID, double originLon, double originLat,  */
-/* 	   double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag); */
+/*         double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag); */
 /* gridDefLcc2 ( gridID, double earth_radius, double lon_0,  */
-/* 	    double lat_0, double lat_1,double lat_2);*/
+/*          double lat_0, double lat_1,double lat_2);*/
 /* gridDefLaea ( gridID, double earth_radius, double lon_0, double lat_0); */
-  for ( i = 0; i < nlon*nlat; i++ )    
+  for ( i = 0; i < nlon*nlat; i++ )
     area_vec[i] = 0.1 * i;
   gridDefArea ( gridID, ap );
-  for ( i = 0; i < nlon*nlat; i++ )    
+  for ( i = 0; i < nlon*nlat; i++ )
     mask_vec[i] = i;
   gridDefRowlon ( gridID, nlon*nlat, mp );
-  gridDefComplexPacking ( gridID, 1 );	       
+  gridDefComplexPacking ( gridID, 1 );
 
   return gridID;
 }
@@ -115,7 +111,7 @@ int defineTaxis ()
   int taxisID = CDI_UNDEFID;
 
   taxisID = taxisCreate(TAXIS_ABSOLUTE);
-  
+
   taxisDefType  ( taxisID, 0 );
   taxisDefVdate ( taxisID, 1 );
   taxisDefVtime ( taxisID, 2 );
@@ -177,15 +173,16 @@ int defineModel ( int instID )
   return modelID;
 }
 
-void modelRun ( MPI_Comm comm )
+int modelRun ( MPI_Comm comm )
 {
   int gridID, zaxisID, taxisID, instID, modelID, vlistID, streamID;
 
   char * recvBuffer, * sendBuffer;
   int bufferSize, differ;
-  MPI_Status status;
 
   pioNamespaceSetActive ( 0 );
+  if (IOMode != PIO_NONE)
+    serializeSetMPI();
 
   gridID  = defineGrid      ();
   zaxisID = defineZaxis     ();
@@ -197,55 +194,54 @@ void modelRun ( MPI_Comm comm )
   if ( streamID < 0 ) xabort ( "Could not open file" );
   defineStream ( streamID, vlistID );
 
-  reshPackBufferCreate ( &sendBuffer, &bufferSize, comm );
-  xmpi ( MPI_Send ( sendBuffer, bufferSize, MPI_PACKED, 0, 0, comm ));  
-  recvBuffer = xmalloc ( bufferSize * sizeof ( char ));
-  xmpi ( MPI_Recv ( recvBuffer, bufferSize, MPI_PACKED, 0,
-		    0, comm, &status ));
- 
+  reshPackBufferCreate ( &sendBuffer, &bufferSize, &comm );
+  recvBuffer = xmalloc(bufferSize);
+  xmpi(MPI_Sendrecv(sendBuffer, bufferSize, MPI_PACKED, 0, 0,
+                    recvBuffer, bufferSize, MPI_PACKED, 0, 0,
+                    MPI_COMM_SELF, MPI_STATUS_IGNORE));
   pioNamespaceSetActive ( 1 );
-  rpcUnpackResources ( recvBuffer, bufferSize, comm );  
-  free ( recvBuffer );  
+  reshUnpackResources(recvBuffer, bufferSize, &comm);
+  free ( recvBuffer );
   reshPackBufferDestroy ( &sendBuffer );
 
   differ = reshListCompare ( 0, 1 );
-  printf ( "The resource arrays %s.\n", differ ? "differ" : "are equal" );
-  reshListPrint ( "reshArrayModel" );
 
   pioNamespaceSetActive ( 0 );
   streamClose(streamID);
-  return;
+  return differ;
 }
 
-#endif 
+#endif
 
-int main (int argc, char *argv[]) 
+int main (int argc, char *argv[])
 {
+  int exitCode = 77;
 #ifdef USE_MPI
-  int sizeGlob;
+  int sizeGlob, pioNamespace;
   MPI_Comm commGlob, commModel;
 
-  MPI_Init(&argc, &argv);           
+  MPI_Init(&argc, &argv);
   xmpi ( MPI_Comm_dup ( MPI_COMM_WORLD, &commGlob ));
   xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN ));
-  xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); 
+  xmpi ( MPI_Comm_size ( commGlob, &sizeGlob ));
 
-  if ( sizeGlob != 1 )                                         
+  if ( sizeGlob != 1 )
       xabort ( "test transition of resource array only with 1 PE." );
-                                         
+
   if ( nProcsIO != 1 )
     xabort ( "bad distribution of tasks on PEs" );
 
-  commModel = pioInit_c ( commGlob, nProcsIO, IOMode, nNamespaces, hasLocalFile );
+  commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f);
+  pioNamespaceSetActive(pioNamespace);
 
-  modelRun ( commModel );
+  exitCode = modelRun(commModel);
 
-  MPI_Finalize (); 
+  xmpi(MPI_Finalize());
 #else
   printf ( "Use MPI for this testprogram.\n" );
 #endif
 
-  return 0;
+  return exitCode;
 }
 
 /*
diff --git a/libcdi/util/sunf95preproc-wrapper b/libcdi/util/sunf95preproc-wrapper
index 49a1d64..c3e4760 100755
--- a/libcdi/util/sunf95preproc-wrapper
+++ b/libcdi/util/sunf95preproc-wrapper
@@ -1,4 +1,49 @@
 #! /bin/sh
+#
+# sunf95preproc-wrapper --- wrapper to produce Sun F95 style front-end
+#                           preprocessor output on stdout
+#
+# Copyright  (C)  2010, 2012  Thomas Jahns <jahns at dkrz.de>
+#
+# Version: 1.0
+# Keywords:
+# Author: Thomas Jahns <jahns at dkrz.de>
+# Maintainer: Thomas Jahns <jahns at dkrz.de>
+# URL: https://www.dkrz.de/redmine/projects/scales-ppm
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are  permitted provided that the following conditions are
+# met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name of the DKRZ GmbH nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Commentary:
+#
+#
+#
+# Code:
+#
 if [ "${DEBUG+set}" = set ]; then
   set -x
   outputRedir=">&2"
@@ -13,7 +58,6 @@ TRAPCMD=':'
 trap 'eval $TRAPCMD' 0
 set -e
 test "${DEBUG+set}" = set && echo "$FPPFLAGS" >&2
-FCFLAGS=${FCFLAGS--EP}
 if [ "${FC+set}" != set ]; then
   for F90C in sunf95 '' ; do
     test -n "$F90C" || exit 1
@@ -24,6 +68,9 @@ if [ "${FC+set}" != set ]; then
   done
 fi
 FC=${FC-$F90C}
+# nagfor 5.3 up chokes on -EP flag
+nag=`$FC -V 2>&1 | sed -n '/^NAG/s/NAG Fortran Compiler.*/NAG/;t print;b;: print; p'`
+[ x"$nag" = xNAG ] || FCFLAGS=${FCFLAGS--EP}
 # append -fpp if necessary
 IFStr=`echo "$IFS" | sed -n '$!s/$/\\\\n/
 H
@@ -74,3 +121,8 @@ s:\.F90:.f90:'`
     fi
   done
 done
+#
+# Local Variables:
+# license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm"
+# license-default: "bsd"
+# End:
diff --git a/libcdi/util/sxpreproc-wrapper b/libcdi/util/sxpreproc-wrapper
index ceae5c9..f384218 100755
--- a/libcdi/util/sxpreproc-wrapper
+++ b/libcdi/util/sxpreproc-wrapper
@@ -1,4 +1,49 @@
 #! /bin/sh
+#
+# sxpreproc-wrapper --- capture preprocessed output from frontends of
+#                       NEC SX series Fortran 90 compiler
+#
+# Copyright  (C)  2010  Thomas Jahns <jahns at dkrz.de>
+#
+# Version: 1.0
+# Keywords:
+# Author: Thomas Jahns <jahns at dkrz.de>
+# Maintainer: Thomas Jahns <jahns at dkrz.de>
+# URL: https://www.dkrz.de/redmine/projects/show/scales-ppm
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are  permitted provided that the following conditions are
+# met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name of the DKRZ GmbH nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Commentary:
+#
+#
+#
+# Code:
+#
 if [ "${DEBUG+set}" = set ]; then
   set -x
   outputRedir=">&2"
@@ -56,4 +101,9 @@ s:^:'"$tmp/"'i.:'`
   test "${DEBUG+set}" = set && cat "$fppOutput" >&2
   rm "$fppOutput"
 done
-rm -rf "$tmp"
\ No newline at end of file
+rm -rf "$tmp"
+#
+# Local Variables:
+# license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm"
+# license-default: "bsd"
+# End:
diff --git a/libcdi/util/xlfpreproc-wrapper b/libcdi/util/xlfpreproc-wrapper
index 647c234..fe0ad8b 100755
--- a/libcdi/util/xlfpreproc-wrapper
+++ b/libcdi/util/xlfpreproc-wrapper
@@ -1,5 +1,36 @@
 #! /bin/sh
 #
+# xlfpreproc-wrapper --- wrapper to produce IBM xlf style front-end
+#                        preprocessor output on stdout
+#
+# Copyright  (C)  2010  Thomas Jahns <jahns at dkrz.de>
+#
+# Version: 1.0
+# Keywords:
+# Author: Thomas Jahns <jahns at dkrz.de>
+# Maintainer: Thomas Jahns <jahns at dkrz.de>
+# URL: http://
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+# Commentary:
+#
+#
+#
+# Code:
+#
 if [ "${DEBUG+set}" = set ]; then
   set -x
   outputRedir=">&2"
@@ -16,7 +47,13 @@ for srcfile in "$@" ; do
   eval \$FC \$FCFLAGS \$FPPFLAGS -d -qnoobject \"\$srcfile\" $outputRedir
   set -e
   FPPOUTNAME=`echo $srcfile | sed -e 's:\(.*/\)*\([^/]*\)\.[^./]*$:F\2.f:'`
+  test -r "$FPPOUTNAME" || FPPOUTNAME="${FPPOUTNAME}90"
   cat "$FPPOUTNAME" 2>/dev/null
   test "${DEBUG+set}" = set && cat "$FPPOUTNAME" >&2
   rm "$FPPOUTNAME"
 done
+#
+# Local Variables:
+# license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm"
+# license-default: "bsd"
+# End:
diff --git a/m4/acx_options.m4 b/m4/acx_options.m4
index 8016b81..4b4c816 100644
--- a/m4/acx_options.m4
+++ b/m4/acx_options.m4
@@ -354,6 +354,33 @@ AC_ARG_WITH([proj],
             [AC_MSG_CHECKING([for the PROJ library])
              AC_MSG_RESULT([suppressed])])
 #  ----------------------------------------------------------------------
+#  Checks for CURL library
+AC_ARG_WITH([curl],
+            [AS_HELP_STRING([--with-curl=<directory>],
+                            [Specify location of CURL library.])],
+            [AS_CASE(["$with_curl"],
+                     [no],[AC_MSG_CHECKING([for curl library])
+                           AC_MSG_RESULT([suppressed])],
+                     [yes],[AC_CHECK_HEADERS([curl/curl.h])
+                            AC_SEARCH_LIBS([curl_global_init],[curl],[AC_DEFINE([HAVE_LIBCURL],[1],[Define to 1 for CURL support])],
+                                           [AC_MSG_ERROR([Could not link to CURL library!])])
+                            AC_SUBST([CURL_LDFLAGS],[" -lcurl"])
+                            AC_SUBST([CURL_INCLUDE],[""])],
+                     [*],[CURL_ROOT=$with_curl
+                          AS_IF([test -d "$CURL_ROOT"],
+                                [LDFLAGS="-L$CURL_ROOT/lib $LDFLAGS"
+                                 CPPFLAGS="-I$CURL_ROOT/include $CPPFLAGS"
+                                 AC_CHECK_HEADERS([curl/curl.h])
+                                 AC_SEARCH_LIBS([curl_global_init],
+                                                [curl],
+                                                [AC_DEFINE([HAVE_LIBCURL],[1],[Define to 1 for CURL support])],
+                                                [AC_MSG_ERROR([Could not link to CURL library!])])
+                                 AC_SUBST([CURL_LDFLAGS],[" -L$CURL_ROOT/lib -lcurl"])
+                                 AC_SUBST([CURL_INCLUDE],[" -I$CURL_ROOT/include"])],
+                                [AC_MSG_ERROR([$CURL_ROOT is not a directory! CURL suppressed])])])],
+            [AC_MSG_CHECKING([for the CURL library])
+             AC_MSG_RESULT([suppressed])])
+#  ----------------------------------------------------------------------
 #  Link application with UDUNITS2 library
 AC_ARG_WITH([udunits2],
             [AS_HELP_STRING([--with-udunits2=<directory>],
@@ -362,7 +389,9 @@ AC_ARG_WITH([udunits2],
                      [no],[AC_MSG_CHECKING([for udunits2 library])
                            AC_MSG_RESULT([suppressed])],
                      [yes],[AC_CHECK_HEADERS([udunits2.h])
-                            AC_SEARCH_LIBS([ut_parse],[udunits2],[AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
+                            AC_SEARCH_LIBS([ut_parse],
+                                           [udunits2],
+                                           [AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
                                            [AC_MSG_ERROR([Could not link to udunits2 library!])])
                             AC_SUBST([UDUNITS_LDFLAGS],[" -ludunits2"])
                             AC_SUBST([UDUNITS_INCLUDE],[""])],
@@ -371,6 +400,7 @@ AC_ARG_WITH([udunits2],
                                 [LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
                                  CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include"
                                  AC_CHECK_HEADERS([udunits2.h])
+                                 AC_CHECK_HEADERS([udunits2/udunits2.h])
                                  AC_SEARCH_LIBS([ut_parse],
                                                 [udunits2],
                                                 [AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
index 2152a80..4ecd9c6 100644
--- a/m4/ax_pthread.m4
+++ b/m4/ax_pthread.m4
@@ -258,7 +258,7 @@ if test "x$ax_pthread_ok" = xyes; then
         CFLAGS="$save_CFLAGS"
 
         # More AIX lossage: must compile with xlc_r or cc_r
-	if test x"$GCC" != xyes; then
+	if test x"$GCC" != xyes -a \( x"$CC" = xxlc -o x"$CC" = cc \) ; then
           AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
         else
           PTHREAD_CC=$CC
diff --git a/src/Adisit.c b/src/Adisit.c
index 880f5ea..64b071d 100644
--- a/src/Adisit.c
+++ b/src/Adisit.c
@@ -18,7 +18,8 @@
 /*
    This module contains the following operators:
 
-      Adisit      adisit          potential temperature
+      Adisit      adisit          compute insitu from potential temperature
+      Adisit      adipot          compute potential from insitu temperature
 */
 
 #include <ctype.h>
@@ -47,8 +48,7 @@
 static
 double adisit_1(double tpot, double sal, double p)
 {
-  double a_a1 = 3.6504E-4, a_a2 = 8.3198E-5, a_a3 = 5.4065E-7,
-         a_a4 = 4.0274E-9,
+  double a_a1 = 3.6504E-4, a_a2 = 8.3198E-5, a_a3 = 5.4065E-7, a_a4 = 4.0274E-9,
          a_b1 = 1.7439E-5, a_b2 = 2.9778E-7,
          a_c1 = 8.9309E-7, a_c2 = 3.1628E-8, a_c3 = 2.1987E-10,
          a_d = 4.1057E-9,
@@ -76,6 +76,31 @@ double adisit_1(double tpot, double sal, double p)
   return (t);
 }
 
+/* compute potential temperature from insitu temperature */
+/* Ref: Gill, p. 602, Section A3.5:Potential Temperature */
+static
+double adipot(double t, double s, double p)
+{
+  double a_a1 = 3.6504E-4, a_a2 = 8.3198E-5, a_a3 = 5.4065E-7, a_a4 = 4.0274E-9,
+         a_b1 = 1.7439E-5, a_b2 = 2.9778E-7,
+         a_c1 = 8.9309E-7, a_c2 = 3.1628E-8, a_c3 = 2.1987E-10,
+         a_d = 4.1057E-9,
+         a_e1 = 1.6056E-10, a_e2 = 5.0484E-12;
+
+  double aa,bb,cc,cc1,dd,tpot,s_rel;
+
+  s_rel = s - 35.0;
+
+   aa = (a_a1+ t*(a_a2 - t*(a_a3 - a_a4*t)));
+   bb = s_rel*(a_b1 -a_b2*t)     ;
+   cc = (a_c1 + t*(-a_c2 + a_c3*t));
+  cc1 = a_d*s_rel;
+   dd = (-a_e1 + a_e2*t);
+
+   tpot=t-p*(aa + bb + p*(cc - cc1 + p*dd));
+
+  return (tpot);
+}
 
 static
 void calc_adisit(long gridsize, long nlevel, double *pressure, field_t tho, field_t sao, field_t tis)
@@ -109,9 +134,42 @@ void calc_adisit(long gridsize, long nlevel, double *pressure, field_t tho, fiel
     }
 }
 
+static
+void calc_adipot(long gridsize, long nlevel, double *pressure, field_t t, field_t s, field_t tpot)
+{
+  /* pressure units: hPa     */
+  /* t units:      Celsius */
+  /* s units:      psu     */
+
+  long i, levelID, offset;
+  double *tpotptr, *tptr, *sptr;
+
+  for ( levelID = 0; levelID < nlevel; ++levelID )
+    {
+      offset = gridsize*levelID;
+      tptr = t.ptr + offset;
+      sptr = s.ptr + offset;
+      tpotptr = tpot.ptr + offset;
+
+      for ( i = 0; i < gridsize; ++i )
+	{
+	  if ( DBL_IS_EQUAL(tptr[i], t.missval) ||
+	       DBL_IS_EQUAL(sptr[i], s.missval) )
+	    {
+	      tpotptr[i] = tpot.missval;
+	    }
+	  else
+	    {
+	      tpotptr[i] = adipot(tptr[i], sptr[i], pressure[levelID]); 
+	    }
+	}
+    }
+}
+
 
 void *Adisit(void *argument)
 {
+  int operatorID, ADISIT, ADIPOT;
   int streamID1, streamID2;
   int nrecs;
   int tsID, recID, varID, levelID;
@@ -133,6 +191,10 @@ void *Adisit(void *argument)
   field_t tho, sao, tis;
 
   cdoInitialize(argument);
+  ADISIT = cdoOperatorAdd("adisit", 1, 1, "");
+  ADIPOT = cdoOperatorAdd("adipot", 1, 1, "");
+
+  operatorID = cdoOperatorID();
 
   if ( operatorArgc() == 1 ) pin = atof(operatorArgv()[0]);
   
@@ -154,14 +216,17 @@ void *Adisit(void *argument)
 	  vlistInqVarStdname(vlistID1,varID, stdname);
 	  strtolower(varname);
 
-	  if      ( strcmp(varname, "tho")   == 0 ) code = 2;
-	  else if ( strcmp(varname, "sao")   == 0 ) code = 5;
-
-	  else if ( strcmp(varname, "s")     == 0 ) code = 5;
-	  else if ( strcmp(varname, "t")     == 0 ) code = 2;
-
-	  else if ( strcmp(stdname, "sea_water_salinity")              == 0 ) code = 5;
-	  else if ( strcmp(stdname, "sea_water_potential_temperature") == 0 ) code = 2;
+               if ( strcmp(varname, "s")     == 0 ) code = 5;
+          else if ( strcmp(varname, "t")     == 0 ) code = 2;
+	  else if ( strcmp(stdname, "sea_water_salinity") == 0 ) code = 5;
+          
+          if ( operatorID == ADISIT )
+          {
+	   if ( strcmp(stdname, "sea_water_potential_temperature") == 0 ) code = 2;
+          }
+          else {
+	   if ( strcmp(stdname, "sea_water_temperature") == 0 ) code = 2;
+          }
 	}
 
       if      ( code == 2 ) thoID = varID;
@@ -169,7 +234,7 @@ void *Adisit(void *argument)
     }
 
   if ( saoID == -1 ) cdoAbort("Sea water salinity not found!");
-  if ( thoID == -1 ) cdoAbort("Potential temperature not found!");
+  if ( thoID == -1 ) cdoAbort("Potential or Insitu temperature not found!");
 
   ngrids = vlistNgrids(vlistID1);
   gridID = vlistGrid(vlistID1, 0);
@@ -206,6 +271,9 @@ void *Adisit(void *argument)
 	cdoPrint("%5d  %g", i+1, pressure[i]);
     }
 
+  field_init(&tho);
+  field_init(&sao);
+  field_init(&tis);
   tho.ptr = (double *) malloc(gridsize*nlevel*sizeof(double));
   sao.ptr = (double *) malloc(gridsize*nlevel*sizeof(double));
   tis.ptr = (double *) malloc(gridsize*nlevel*sizeof(double));
@@ -222,16 +290,26 @@ void *Adisit(void *argument)
   vlistID2 = vlistCreate();
 
   tisID2 = vlistDefVar(vlistID2, gridID, zaxisID, TIME_VARIABLE);
-  vlistDefVarParam(vlistID2, tisID2, cdiEncodeParam(20, 255, 255));
-  vlistDefVarName(vlistID2, tisID2, "to");
-  vlistDefVarLongname(vlistID2, tisID2, "Sea water temperature");
-  vlistDefVarStdname(vlistID2, tisID2, "sea_water_temperature");
+  if (operatorID == ADISIT)
+    {
+      vlistDefVarParam(vlistID2, tisID2, cdiEncodeParam(20, 255, 255));
+      vlistDefVarName(vlistID2, tisID2, "to");
+      vlistDefVarLongname(vlistID2, tisID2, "Sea water temperature");
+      vlistDefVarStdname(vlistID2, tisID2, "sea_water_temperature");
+    }
+  else
+    {
+      vlistDefVarParam(vlistID2, tisID2, cdiEncodeParam(2, 255, 255));
+      vlistDefVarName(vlistID2, tisID2, "tho");
+      vlistDefVarLongname(vlistID2, tisID2, "Sea water potential temperature");
+      vlistDefVarStdname(vlistID2, tisID2, "sea_water_potential_temperature");
+    }
   vlistDefVarUnits(vlistID2, tisID2, "K");
   vlistDefVarMissval(vlistID2, tisID2, tis.missval);
 
   saoID2 = vlistDefVar(vlistID2, gridID, zaxisID, TIME_VARIABLE);
   vlistDefVarParam(vlistID2, saoID2, cdiEncodeParam(5, 255, 255));
-  vlistDefVarName(vlistID2, saoID2, "sao");
+  vlistDefVarName(vlistID2, saoID2, "s");
   vlistDefVarLongname(vlistID2, saoID2, "Sea water salinity");
   vlistDefVarStdname(vlistID2, saoID2, "sea_water_salinity");
   vlistDefVarUnits(vlistID2, saoID2, "psu");
@@ -263,7 +341,15 @@ void *Adisit(void *argument)
 	  if ( varID == saoID ) streamReadRecord(streamID1, sao.ptr+offset, &(sao.nmiss));
 	}
 
-      calc_adisit(gridsize, nlevel, pressure, tho, sao, tis); 
+      if (operatorID == ADISIT )
+        {
+          calc_adisit(gridsize, nlevel, pressure, tho, sao, tis); 
+        }
+      else
+        {
+          calc_adipot(gridsize, nlevel, pressure, tho, sao, tis); 
+        }
+
 
       for ( levelID = 0; levelID < nlevel; ++levelID )
 	{
diff --git a/src/Arith.c b/src/Arith.c
index 529f87f..05903a6 100644
--- a/src/Arith.c
+++ b/src/Arith.c
@@ -148,6 +148,8 @@ void *Arith(void *argument)
 
   gridsize = vlistGridsizeMax(vlistIDx1);
 
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
   if ( filltype == FILL_VAR || filltype == FILL_VARTS )
diff --git a/src/Arithc.c b/src/Arithc.c
index 322e017..0371156 100644
--- a/src/Arithc.c
+++ b/src/Arithc.c
@@ -116,6 +116,7 @@ void *Arithc(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr    = (double *) malloc(gridsize*sizeof(double));
   field.weight = NULL;
 
diff --git a/src/Arithdays.c b/src/Arithdays.c
index 83558ea..37a55bf 100644
--- a/src/Arithdays.c
+++ b/src/Arithdays.c
@@ -115,6 +115,7 @@ void *Arithdays(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr    = (double *) malloc(gridsize*sizeof(double));
   field.weight = NULL;
 
diff --git a/src/CdoMagicsMapper.c b/src/CdoMagicsMapper.c
index 4c995ed..3996519 100644
--- a/src/CdoMagicsMapper.c
+++ b/src/CdoMagicsMapper.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" /* HAVE_LIBMAGICS */
 #endif
 
@@ -114,7 +114,7 @@ int Set_magics_param_CTABLE( char *user_name, char *param_value )
 		return 1;
 	printf("Setting the CTABLE magics params \n"); 
 #if 0
-#if  defined  (HAVE_LIBMAGICS)
+#if defined(HAVE_LIBMAGICS)
         SetMagicsParameterValue( "contour_level_list", "floatarray", param_value );
 #endif
 #endif
diff --git a/src/Consecstat.c b/src/Consecstat.c
index a6384c1..a882eb5 100644
--- a/src/Consecstat.c
+++ b/src/Consecstat.c
@@ -56,7 +56,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
   {
     if ( current.nmiss > 0 || history.nmiss > 0 )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
       for ( i = 0; i < len; i++ )
@@ -80,7 +80,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
     }
     else
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
       for ( i = 0; i < len; i++ )
@@ -91,7 +91,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
   {
     if ( current.nmiss > 0 )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
       for ( i = 0; i < len; i++ )
@@ -106,7 +106,7 @@ static void selEndOfPeriod(field_t *periods, field_t history, field_t current, i
     }
     else
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
       for ( i = 0; i < len; i++ )
@@ -130,8 +130,6 @@ void *Consecstat (void *argument)
   int recID, nrecs;
   int varID, nvars;
   int levelID, nlevels; 
-  int gridID, gridsize;
-  double missval;
   double refval = 0.0;
 
   field_t **vars = NULL, **hist = NULL, **periods = NULL;
@@ -153,48 +151,21 @@ void *Consecstat (void *argument)
   otaxisID = taxisDuplicate(itaxisID);
   vlistDefTaxis(ovlistID, otaxisID);
 
+  field_init(&field);
   field.ptr = (double *) malloc(vlistGridsizeMax(ovlistID)*sizeof(double));
+
   nvars     = vlistNvars(ivlistID);
-  vars      = (field_t **) malloc(nvars*sizeof(field_t *));
-  hist      = (field_t **) malloc(nvars*sizeof(field_t *));
+  vars      = field_calloc(ivlistID, FIELD_PTR);
   if ( operatorID == CONSECTS )
-    periods   = (field_t **) malloc(nvars*sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-  {
-    gridID      = vlistInqVarGrid(ovlistID, varID);
-    gridsize    = gridInqSize(gridID);
-    missval     = vlistInqVarMissval(ovlistID, varID);
-    nlevels     = zaxisInqSize(vlistInqVarZaxis(ovlistID, varID));
-
-    vars[varID] = (field_t *) malloc(nlevels*sizeof(field_t));
-    if ( operatorID == CONSECTS )
     {
-      periods[varID] = (field_t *) malloc(nlevels*sizeof(field_t));
-      hist[varID]    = (field_t *) malloc(nlevels*sizeof(field_t));
+      hist      = field_malloc(ivlistID, FIELD_PTR);
+      periods   = field_malloc(ivlistID, FIELD_PTR);
     }
 
-
-    for ( levelID = 0; levelID < nlevels; levelID++ )
+  for ( varID = 0; varID < nvars; varID++ )
     {
-      vars[varID][levelID].grid    = gridID;
-      vars[varID][levelID].missval = missval;
-      vars[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-      vars[varID][levelID].nmiss   = 0;
-      if ( operatorID == CONSECTS )
-      {
-        hist[varID][levelID].grid       = gridID;
-        hist[varID][levelID].missval    = missval;
-        hist[varID][levelID].ptr        = (double *) malloc(gridsize*sizeof(double));
-        hist[varID][levelID].nmiss      = 0;
-        periods[varID][levelID].grid    = gridID;
-        periods[varID][levelID].missval = missval;
-        periods[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-        periods[varID][levelID].nmiss   = 0;
-      }
+      vlistDefVarUnits(ovlistID, varID, "steps"); /* TODO */
     }
-    vlistDefVarUnits(ovlistID, varID, "steps"); /* TODO */
-  }
 
   ostreamID = streamOpenWrite(cdoStreamName(1), cdoFiletype());
 
@@ -232,7 +203,9 @@ void *Consecstat (void *argument)
       streamReadRecord(istreamID, field.ptr, &field.nmiss);
       field.grid    = vlistInqVarGrid(ovlistID, varID);
       field.missval = vlistInqVarMissval(ovlistID, varID);
+
       farsumtr(&vars[varID][levelID], field, refval);
+
       switch (operatorID)
       {
         case CONSECSUM:
@@ -246,7 +219,7 @@ void *Consecstat (void *argument)
             streamDefRecord(ostreamID, varID, levelID);
             streamWriteRecord(ostreamID, periods[varID][levelID].ptr, periods[varID][levelID].nmiss);
           }
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) schedule(static)
           for ( i = 0; i < gridInqSize(vars[varID][levelID].grid); i++ )
             hist[varID][levelID].ptr[i] = vars[varID][levelID].ptr[i];
@@ -284,28 +257,9 @@ void *Consecstat (void *argument)
     }
   }
   
-  for ( varID = 0; varID < nvars; varID++ )
-  {
-    nlevels = zaxisInqSize(vlistInqVarZaxis(ovlistID, varID));
-    for ( levelID = 0; levelID < nlevels; levelID++ )
-    {
-      if ( vars[varID][levelID].ptr ) free(vars[varID][levelID].ptr);
-      if ( operatorID == CONSECTS )
-      {
-        if ( hist[varID][levelID].ptr ) free(hist[varID][levelID].ptr);
-        if ( periods[varID][levelID].ptr ) free(periods[varID][levelID].ptr);
-      }
-    }
-    free(vars[varID]);
-    if ( operatorID == CONSECTS )
-    {
-      free(hist[varID]);
-      free(periods[varID]);
-    }
-  }
-  if ( vars )    free(vars);
-  if ( hist )    free(hist);
-  if ( periods ) free(periods);
+  if ( vars )    field_free(vars, ivlistID);
+  if ( hist )    field_free(hist, ivlistID);
+  if ( periods ) field_free(periods, ivlistID);
 
   streamClose(istreamID);
   streamClose(ostreamID);
diff --git a/src/Derivepar.c b/src/Derivepar.c
index 4a6a03f..b80e54e 100644
--- a/src/Derivepar.c
+++ b/src/Derivepar.c
@@ -66,10 +66,10 @@ void MakeGeopotHeight(double *geop, double* gt, double *gq, double *ph, int nhor
           gtl   = gt   + nhor*(j-1);
           gql   = gq   + nhor*(j-1);
           phl   = ph   + nhor*(j-1);
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for
 #endif
           for ( i = 0; i < nhor; i++ )
@@ -77,10 +77,10 @@ void MakeGeopotHeight(double *geop, double* gt, double *gq, double *ph, int nhor
                      * log(phl[i+nhor] / phl[i]);
         }
 
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for
 #endif
       for ( i = 0; i < nhor; i++ )
@@ -89,23 +89,23 @@ void MakeGeopotHeight(double *geop, double* gt, double *gq, double *ph, int nhor
   else    /* No humidity */
     {
       for ( j = nlev ; j > 1 ; j-- )
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
         for ( i = nhor * (j-1) ; i < nhor * j ; i++ )
           geop[i] = geop[i+nhor] + RD * gt[i] * log(ph[i+nhor] / ph[i]);
 
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
       for ( i = 0; i < nhor; i++ )
         geop[i] = geop[i+nhor] + RD * gt[i] * z2log2;
     }
 
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for
 #endif
   for ( i = 0; i < nhor * (nlev+1); i++ ) geop[i] *= zrg;
diff --git a/src/Detrend.c b/src/Detrend.c
index 5e20169..7d4969d 100644
--- a/src/Detrend.c
+++ b/src/Detrend.c
@@ -21,7 +21,7 @@
       Detrend    detrend         Detrend
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -145,23 +145,7 @@ void *Detrend(void *argument)
 
       taxisInqDTinfo(taxisID1, &dtinfo[tsID]);
 
-      vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID   = vlistInqVarGrid(vlistID1, varID);
-	  missval  = vlistInqVarMissval(vlistID1, varID);
-	  nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-
-	  vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    {
-	      vars[tsID][varID][levelID].grid    = gridID;
-	      vars[tsID][varID][levelID].missval = missval;
-	      vars[tsID][varID][levelID].ptr     = NULL;
-	    }
-	}
+      vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
 
       for ( recID = 0; recID < nrecs; recID++ )
 	{
@@ -193,12 +177,12 @@ void *Detrend(void *argument)
       nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
       for ( levelID = 0; levelID < nlevel; levelID++ )
 	{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, ompthID, tsID)
 #endif
 	  for ( i = 0; i < gridsize; i++ )
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
               ompthID = omp_get_thread_num();
 #else
               ompthID = 0;
@@ -237,11 +221,12 @@ void *Detrend(void *argument)
 		  streamDefRecord(streamID2, varID, levelID);
 		  streamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
 		  free(vars[tsID][varID][levelID].ptr);
+		  vars[tsID][varID][levelID].ptr = NULL;
 		}
 	    }
-	  free(vars[tsID][varID]);
 	}
-      free(vars[tsID]);
+
+      field_free(vars[tsID], vlistID1);
     }
 
   if ( vars  ) free(vars);
diff --git a/src/Diff.c b/src/Diff.c
index 350fb66..f9e34c1 100644
--- a/src/Diff.c
+++ b/src/Diff.c
@@ -202,10 +202,14 @@ void *Diff(void *argument)
       tsID++;
     }
 
-  fprintf(stdout, "  %d of %d records differ\n", ndrec, ngrec);
-  if ( ndrec != nd2rec )
-    fprintf(stdout, "  %d of %d records differ more than 0.001\n", nd2rec, ngrec);
-  /*  fprintf(stdout, "  %d of %d records differ more then one thousandth\n", nprec, ngrec); */
+  if ( ndrec > 0 )
+    {
+      fprintf(stdout, "  %d of %d records differ\n", ndrec, ngrec);
+      if ( ndrec != nd2rec )
+	fprintf(stdout, "  %d of %d records differ more than 0.001\n", nd2rec, ngrec);
+      /*  fprintf(stdout, "  %d of %d records differ more then one thousandth\n", nprec, ngrec); */
+    }
+
   if ( nrecs == 0 && nrecs2 > 0 )
     cdoWarning("stream2 has more time steps than stream1!");
   if ( nrecs > 0 && nrecs2 == 0 )
diff --git a/src/Duplicate.c b/src/Duplicate.c
index 08d55e5..fd33ba1 100644
--- a/src/Duplicate.c
+++ b/src/Duplicate.c
@@ -39,7 +39,6 @@ void *Duplicate(void *argument)
   int ntsteps;
   int *vdate = NULL, *vtime = NULL;
   int idup, ndup = 1;
-  double missval;
   field_t ***vars = NULL;
 
   cdoInitialize(argument);
@@ -95,23 +94,7 @@ void *Duplicate(void *argument)
       vdate[tsID] = taxisInqVdate(taxisID1);
       vtime[tsID] = taxisInqVtime(taxisID1);
 
-      vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID   = vlistInqVarGrid(vlistID1, varID);
-	  missval  = vlistInqVarMissval(vlistID1, varID);
-	  nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-
-	  vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    {
-	      vars[tsID][varID][levelID].grid    = gridID;
-	      vars[tsID][varID][levelID].missval = missval;
-	      vars[tsID][varID][levelID].ptr     = NULL;
-	    }
-	}
+      vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
 
       for ( recID = 0; recID < nrecs; recID++ )
 	{
@@ -152,19 +135,7 @@ void *Duplicate(void *argument)
 	}
     }
 
-  for ( tsID = 0; tsID < nts; tsID++ )
-    {
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    if ( vars[tsID][varID][levelID].ptr )
-	      free(vars[tsID][varID][levelID].ptr);
-
-	  free(vars[tsID][varID]);
-	}
-      free(vars[tsID]);
-    }
+  for ( tsID = 0; tsID < nts; tsID++ ) field_free(vars[tsID], vlistID1);
 
   if ( vars  ) free(vars);
   if ( vdate ) free(vdate);
diff --git a/src/EOFs.c b/src/EOFs.c
index b44a7ed..f9348db 100644
--- a/src/EOFs.c
+++ b/src/EOFs.c
@@ -340,7 +340,7 @@ void *EOFs(void * argument)
           if ( grid_space )
             {
 	      // This could be done in parallel to save lots of time
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i1,i2) default(shared)
 #endif
               for ( i1 = 0; i1 < gridsize; i1++ )
@@ -491,7 +491,7 @@ void *EOFs(void * argument)
                 cov[j1] = (double*) malloc(nts*sizeof(double));
 	      eigv = (double *) malloc (nts*sizeof(double));
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(j1,j2,i,sum, df1p, df2p) default(shared) schedule(dynamic)
 #endif
               for ( j1 = 0; j1 < nts; j1++ )
@@ -543,7 +543,7 @@ void *EOFs(void * argument)
 		}
               else if ( time_space )
                 {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i2,j,sum) shared(datafieldv,eigenvectors)
 #endif
                   for ( i2 = 0; i2 < npack; i2++ )
@@ -557,7 +557,7 @@ void *EOFs(void * argument)
                   // NORMALIZING
                   sum = 0;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i2) default(none) reduction(+:sum)	\
   shared(eigenvectors,weight,pack,varID,levelID,i,npack)
 #endif
@@ -578,7 +578,7 @@ void *EOFs(void * argument)
                   if ( sum > 0 )
                     {
                       sum = sqrt(sum);
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i2) default(none) \
   shared(npack,varID,levelID,i,pack,sum,eigenvectors)
 #endif
@@ -587,7 +587,7 @@ void *EOFs(void * argument)
                     }
                   else
 		    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i2) default(none) \
   shared(npack,varID,levelID,i,pack,sum,eigenvectors,missval)
 #endif
diff --git a/src/EcaIndices.c b/src/EcaIndices.c
index 48546cb..10b1b18 100755
--- a/src/EcaIndices.c
+++ b/src/EcaIndices.c
@@ -502,6 +502,7 @@ void *EcaGsl(void *argument)
   eca4(&request);
   
   free(longname);
+
   cdoFinish();
   
   return (0);
@@ -539,6 +540,7 @@ void *EcaHd(void *argument)
   request.var2.h3       = NULL; 
    
   eca1(&request);
+
   cdoFinish();
   
   return (0);
diff --git a/src/Echam5ini.c b/src/Echam5ini.c
index dfecd60..a1394cf 100644
--- a/src/Echam5ini.c
+++ b/src/Echam5ini.c
@@ -15,7 +15,7 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -27,7 +27,7 @@
 #include "pstream.h"
 
 
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
 #  include "netcdf.h"
 #endif
 
@@ -99,7 +99,7 @@ void inivars_ml(VAR **vars)
   inivar(&(*vars)[4], GRID_SPECTRAL, ZAXIS_SURFACE, 152, "LSP", "log surface pressure", "");
 }
 
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
 static
 void nce(int istat)
 {
@@ -115,7 +115,7 @@ static
 int import_e5ml(const char *filename, VAR **vars)
 {
   int nvars = 0;
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
   int nc_dim_id, nc_var_id;
   size_t dimlen, nvals;
   size_t start[3];
@@ -275,7 +275,7 @@ int import_e5ml(const char *filename, VAR **vars)
 static
 void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtime, int ntr)
 {
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
   int nc_var_id;
   size_t nvals;
   size_t start[3], count[3];
@@ -360,7 +360,7 @@ void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtim
 
   if ( data_size*8 > 2147000000 )
     {
-#if  defined  (NC_64BIT_OFFSET)
+#if defined(NC_64BIT_OFFSET)
       writemode = NC_CLOBBER | NC_64BIT_OFFSET;
 #else
       cdoWarning("Datasize > 2GB and NC_64BIT_OFFSET not available!");
@@ -606,7 +606,7 @@ void export_e5ml(const char *filename, VAR *vars, int nvars, int vdate, int vtim
 #endif
 }
 
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
 static
 void read_gg3d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxisID)
 {
@@ -644,7 +644,7 @@ void read_gg3d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxis
 }
 #endif
 
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
 static
 void read_fc4d(int nc_file_id, const char *name, VAR *var, int gridID, int zaxisID, int nhgl, int nmp1)
 {
@@ -685,7 +685,7 @@ static
 int import_e5res(const char *filename, VAR **vars, ATTS *atts)
 {
   int nvars = 0;
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
   int nc_var_id;
   int varid;
   size_t nvals;
@@ -1078,7 +1078,7 @@ int import_e5res(const char *filename, VAR **vars, ATTS *atts)
 static
 void export_e5res(const char *filename, VAR *vars, int nvars)
 {
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
   int nc_var_id;
   int varid;
   size_t nvals;
diff --git a/src/Ensstat.c b/src/Ensstat.c
index db3be43..c68d591 100644
--- a/src/Ensstat.c
+++ b/src/Ensstat.c
@@ -30,7 +30,7 @@
       Ensstat    enspctl         Ensemble percentiles
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -113,6 +113,7 @@ void *Ensstat(void *argument)
   field = (field_t *) malloc(ompNumThreads*sizeof(field_t));
   for ( i = 0; i < ompNumThreads; i++ )
     {
+      field_init(&field[i]);
       field[i].size   = nfiles;
       field[i].ptr    = (double *) malloc(nfiles*sizeof(double));
       field[i].weight = (double *) malloc(nfiles*sizeof(double));
@@ -177,7 +178,7 @@ void *Ensstat(void *argument)
 
       for ( recID = 0; recID < nrecs0; recID++ )
 	{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(fileID, streamID, nmiss) \
                                      lastprivate(varID, levelID)
 #endif
@@ -193,12 +194,12 @@ void *Ensstat(void *argument)
 	  missval  = vlistInqVarMissval(vlistID1, varID);
 
 	  nmiss = 0;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, ompthID, fileID)
 #endif
 	  for ( i = 0; i < gridsize; i++ )
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 	      ompthID = omp_get_thread_num();
 #else
 	      ompthID = 0;
@@ -219,7 +220,7 @@ void *Ensstat(void *argument)
 
 	      if ( DBL_IS_EQUAL(array2[i], field[ompthID].missval) )
 		{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
 		  nmiss++;
diff --git a/src/Ensstat3.c b/src/Ensstat3.c
index 7480e54..0d3534c 100644
--- a/src/Ensstat3.c
+++ b/src/Ensstat3.c
@@ -22,7 +22,7 @@
    Ensstat3       ensroccurve      Ensamble Receiver Operating Characteristics
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -128,7 +128,7 @@ void *Ensstat3(void *argument)
   /* ("first touch strategy")                            */
   /* --> #pragma omp parallel for ...                    */
   /* *************************************************** */
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   field = (field_t *) malloc(omp_get_max_threads()*sizeof(field_t));
   for ( i = 0; i < omp_get_max_threads(); i++ )
 #else
@@ -136,6 +136,7 @@ void *Ensstat3(void *argument)
   for ( i = 0; i < 1; i++ )
 #endif
     {
+      field_init(&field[i]);
       field[i].size   = nfiles;
       field[i].ptr    = (double *) malloc(nfiles*sizeof(double));
       field[i].weight = (double *) malloc(nfiles*sizeof(double));
@@ -278,7 +279,7 @@ void *Ensstat3(void *argument)
       
       for ( recID = 0; recID < nrecs0; recID++ )
 	{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(fileID, streamID, nmiss) \
                                      lastprivate(varID, levelID)
 #endif
@@ -298,12 +299,12 @@ void *Ensstat3(void *argument)
 	    for ( binID=0;binID<nfiles;binID++ )
 	      array2[binID][0] = 0;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, binID, ompthID, fileID)
 #endif
 	  for ( i = 0; i < gridsize; i++ )
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 	      ompthID = omp_get_thread_num();
 #else
 	      ompthID = 0;
@@ -333,7 +334,7 @@ void *Ensstat3(void *argument)
 		      /* ************** */
 		      // for ( j=0; j<nfiles; j++ )
 		      //   fprintf(stderr,"%5.2g ",field[ompthID].ptr[j]);
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 		      binID = (int) fldfun(field[ompthID], operfunc);
diff --git a/src/Ensval.c b/src/Ensval.c
index 758e0e0..7ea7619 100644
--- a/src/Ensval.c
+++ b/src/Ensval.c
@@ -50,7 +50,7 @@ void *Ensval(void *argument)
   int gridsize = 0;
   int gridID = -1, gridID2;
   int have_miss = 0;
-  int stream, streamID = 0, *streamID2;
+  int stream, streamID1 = -1, streamID = 0, *streamID2;
   int vlistID, vlistID1, *vlistID2;
   int taxisID1, *taxisID2;
   int zaxisID1, *zaxisID2;
@@ -73,6 +73,7 @@ void *Ensval(void *argument)
   char *ofilename;
   char file_suffix[32];
   char type_suffix[10];
+  const char *refname;
 
   typedef struct
   {
@@ -146,6 +147,7 @@ void *Ensval(void *argument)
   for ( fileID = 0; fileID < nfiles; fileID++ )
     {
       streamID = streamOpenRead(cdoStreamName(fileID));
+      if ( fileID == 0 ) streamID1 = streamID;
 
       vlistID = streamInqVlist(streamID);
       
@@ -177,9 +179,9 @@ void *Ensval(void *argument)
 
   ofilebase = cdoStreamName(nfiles)->args;
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   memset(file_suffix, 0, sizeof(file_suffix) );
-  cdoGenFileSuffix(&file_suffix[0], sizeof(file_suffix), 
-		   cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(file_suffix, sizeof(file_suffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   for ( stream = 0; stream < nostreams; stream++ ) {
     int namelen = strlen(ofilebase) 
diff --git a/src/Eof3d.c b/src/Eof3d.c
index e606793..dffb4ad 100644
--- a/src/Eof3d.c
+++ b/src/Eof3d.c
@@ -28,7 +28,7 @@
  * number of contributing values during summation.
  */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #include <omp.h>
 #endif
 
@@ -128,7 +128,7 @@ void *EOF3d(void * argument)
   if ( cdoVerbose ) 
     cdoPrint("Set eigen_mode to %s\n",eigen_mode == JACOBI? "jacobi" : "danielson_lanczos");
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   if ( omp_get_max_threads() > 1 && eigen_mode == DANIELSON_LANCZOS )  {
     cdoWarning("Requested parallel computation with %i Threads ",omp_get_max_threads());
     cdoWarning("  but environmental setting CDO_SVD_MODE causes sequential ");
@@ -407,7 +407,7 @@ void *EOF3d(void * argument)
       }
 
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(j1,j2,sum,df1p,df2p) default(shared) schedule(static,2000)
 #endif 
       for ( j1 = 0; j1 < nts; j1++)
@@ -449,7 +449,7 @@ void *EOF3d(void * argument)
 
       for ( eofID = 0; eofID < n_eig; eofID++ )
 	{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i,j,sum) shared(datafields, eigenvectors)
 #endif 
 	  for ( i = 0; i < npack; i++ )
@@ -462,7 +462,7 @@ void *EOF3d(void * argument)
 	  // NORMALIZING
 	  sum = 0;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i) default(none) reduction(+:sum) \
   shared(eigenvectors,weight,pack,varID,eofID,npack,gridsize)
 #endif 
@@ -473,7 +473,7 @@ void *EOF3d(void * argument)
 
 	  if ( sum > 0 ) {
 	    sum = sqrt(sum);
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i) default(none) \
   shared(sum,npack,eigenvectors,varID,eofID,pack)
 #endif
@@ -481,7 +481,7 @@ void *EOF3d(void * argument)
 	      eigenvectors[varID][eofID].ptr[pack[i]] /= sum;
 	  }
 	  else
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for private(i) default(none) \
   shared(eigenvectors,varID,eofID,pack,missval,npack)
 #endif
diff --git a/src/Eofcoeff.c b/src/Eofcoeff.c
index 0b64846..7596d0a 100644
--- a/src/Eofcoeff.c
+++ b/src/Eofcoeff.c
@@ -33,6 +33,7 @@
 void *Eofcoeff(void * argument)
 {
   char eof_name[8], oname[1024], filesuffix[32];
+  const char *refname;
   double *w;
   double missval1 = -999, missval2;
   double *xvals, *yvals;  
@@ -96,8 +97,9 @@ void *Eofcoeff(void * argument)
   strcpy(oname, cdoStreamName(2)->args);
   nchars = strlen(oname);
   
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
   
   eof = (field_t ***) malloc (nvars * sizeof(field_t**) );
   for ( varID=0; varID<nvars; varID++)
diff --git a/src/Eofcoeff3d.c b/src/Eofcoeff3d.c
index 54f970c..3049311 100644
--- a/src/Eofcoeff3d.c
+++ b/src/Eofcoeff3d.c
@@ -33,6 +33,7 @@
 void *Eofcoeff3d(void * argument)
 {
   char eof_name[6], oname[1024], filesuffix[32];
+  const char *refname;
   double *w;
   double missval1 = -999, missval2 = -999;
   double *xvals, *yvals, *zvals;  
@@ -94,8 +95,9 @@ void *Eofcoeff3d(void * argument)
   strcpy(oname, cdoStreamName(2)->args);
   nchars = strlen(oname);
   
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
  
   eof = (field_t ***) malloc (nvars * sizeof(field_t**) );
   for ( varID=0; varID<nvars; varID++)
diff --git a/src/Fillmiss.c b/src/Fillmiss.c
index 2e032b2..3dc5a93 100644
--- a/src/Fillmiss.c
+++ b/src/Fillmiss.c
@@ -21,9 +21,11 @@
 */
 
 #include <cdi.h>
+#include <cdi.h>
 #include "cdo.h"
 #include "cdo_int.h"
 #include "pstream.h"
+#include "grid.h"
 
 
 void fillmiss(field_t *field1, field_t *field2, int nfill)
@@ -33,21 +35,26 @@ void fillmiss(field_t *field1, field_t *field2, int nfill)
   int kr, ku, kl, ko;
   int ir, iu, il, io;
   int kh, kv, k1, k2, kk;
-  int globgrid = 1;
+  int globgrid = FALSE,gridtype;
   double s1, s2;
   double xr, xu, xl, xo;
   double missval;
   double *array1, *array2;
   double **matrix1, **matrix2;
 
-  gridID  = field1->grid;
-  nmiss1  = field1->nmiss;
-  missval = field1->missval;
-  array1  = field1->ptr;
-  array2  = field2->ptr;
+  gridID   = field1->grid;
+  nmiss1   = field1->nmiss;
+  missval  = field1->missval;
+  array1   = field1->ptr;
+  array2   = field2->ptr;
 
-  nx  = gridInqXsize(gridID);
-  ny  = gridInqYsize(gridID);
+  nx       = gridInqXsize(gridID);
+  ny       = gridInqYsize(gridID);
+  globgrid = gridIsCircular(gridID);
+
+  gridtype = gridInqType(gridID);
+  if ( !(gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN ) )
+    cdoAbort("Unsupported grid type: %s!", gridNamePtr(gridtype));
 
   matrix1 = (double **) malloc(ny * sizeof(double *));
   matrix2 = (double **) malloc(ny * sizeof(double *));
@@ -137,9 +144,134 @@ void fillmiss(field_t *field1, field_t *field2, int nfill)
   free(matrix1);
 }
 
+void fillmiss_one_step(field_t *field1, field_t *field2, int maxfill)
+{
+  int gridID, nx, ny, i, j;
+  int nmiss2 = 0;
+  int kr, ku, kl, ko;
+  int ir, iu, il, io;
+  int kh, kv, k1, k2, kk;
+  double s1, s2;
+  double xr, xu, xl, xo;
+  double missval;
+  double *array1, *array2;
+  double **matrix1, **matrix2;
+
+  gridID  = field1->grid;
+  missval = field1->missval;
+  array1  = field1->ptr;
+  array2  = field2->ptr;
+
+  nx  = gridInqXsize(gridID);
+  ny  = gridInqYsize(gridID);
+
+  matrix1 = (double **) malloc(ny * sizeof(double *));
+  matrix2 = (double **) malloc(ny * sizeof(double *));
+
+  for ( j = 0; j < ny; j++ ) { matrix1[j] = array1 + j*nx; matrix2[j] = array2 + j*nx; }
+
+  for (int fill_iterations=0; fill_iterations < maxfill; fill_iterations++) {
+  for ( j = 0; j < ny; j++ )
+    for ( i = 0; i < nx; i++ )
+      {
+        if ( DBL_IS_EQUAL(matrix1[j][i], missval) )
+          {
+            nmiss2++;
+
+            kr = ku = kl = ko = 0;
+            xr = xu = xl = xo = 0.;
+
+            for ( ir = i + 1; ir < nx; ir++ )
+              if ( !DBL_IS_EQUAL(matrix1[j][ir], missval) )
+                { kr = ir - i; xr = matrix1[j][ir]; break; }
+
+            for ( il = i-1; il >= 0; il-- )
+              if ( !DBL_IS_EQUAL(matrix1[j][il], missval) )
+                { kl = i - il; xl = matrix1[j][il]; break; }
+
+
+            for ( iu = j + 1; iu < ny; iu++ )
+              if ( !DBL_IS_EQUAL(matrix1[iu][i], missval) )
+                { ku = iu - j; xu = matrix1[iu][i]; break; }
+
+            for ( io = j - 1; io >= 0; io-- )
+              if ( !DBL_IS_EQUAL(matrix1[io][i], missval) )
+                { ko = j - io; xo = matrix1[io][i]; break; }
+
+
+            kh = kl + kr;
+            kv = ko + ku;
+            if      ( kh == 0 ) { s1 = 0.; k1 = 0; }
+            else if ( kl == 0 ) { s1 = xr; k1 = kr; }
+            else if ( kr == 0 ) { s1 = xl; k1 = kl; }
+            else
+              {
+                if ( kl < kr )
+                {
+                  s1 = xl;
+                  k1 = kl;
+                }
+              else
+                {
+                  s1 = xr;
+                  k1 = kr;
+                }
+              }
+
+            if      ( kv == 0 ) { s2 = 0.; k2 = 0; }
+            else if ( ku == 0 ) { s2 = xo; k2 = ko; }
+            else if ( ko == 0 ) { s2 = xu; k2 = ku; }
+            else
+              {
+                if ( ku < ko )
+                  {
+                    s2 = xu;
+                    k2 = ku;
+                  }
+                else
+                  {
+                    s2 = xo;
+                    k2 = ko;
+                  }
+              }
+
+            kk = k1 + k2;
+            if      ( kk == 0 ) matrix2[j][i] = matrix1[j][i];
+            else if ( k1 == 0 ) matrix2[j][i] = s2;
+            else if ( k2 == 0 ) matrix2[j][i] = s1;
+            else
+              {
+                if ( k1 <= k2 )
+                {
+                  matrix2[j][i] = s1;
+                }
+                else
+                {
+                  matrix2[j][i] = s2;
+                }
+
+              }
+
+            //printf("%d %d %2d %2d %2d %2d %2g %2g %2g %2g %2g %2g %2g\n", j,i,kr,kl,ku,ko,xr,xl,xu,xo,s1,s2,matrix2[j][i]);
+            /* matrix1[j][i] = matrix2[j][i]; */
+          }
+        else
+          {
+            matrix2[j][i] = matrix1[j][i];
+          }
+      }
+  for ( j = 0; j < ny; j++ ) for ( i = 0; i < nx; i++ ) matrix1[j][i] = matrix2[j][i];
+  }
+
+  free(matrix2);
+  free(matrix1);
+}
+
 
 void *Fillmiss(void *argument)
 {
+  int FILLMISS,FILLMISSONESTEP;
+  int operatorID;
   int streamID1, streamID2;
   int nrecs, ngrids;
   int index;
@@ -150,17 +282,34 @@ void *Fillmiss(void *argument)
   field_t field1, field2;
   int taxisID1, taxisID2;
   int nmiss, i, nfill = 1;
+  void (*fill_method) (field_t *fin , field_t *fout , int);
 
   cdoInitialize(argument);
 
+  FILLMISS        = cdoOperatorAdd("fillmiss"  ,  0, 0, "nfill");
+  FILLMISSONESTEP = cdoOperatorAdd("fillmiss2" ,  0, 0, "nfill");
+  operatorID      = cdoOperatorID();
+  if ( operatorID == FILLMISS )
+     {
+       fill_method = &fillmiss;
+     }
+  else
+     {
+       fill_method = &fillmiss_one_step;
+     }
+
+  /* Argument handling */
   {
     int oargc = operatorArgc();
     char **oargv = operatorArgv();
 
     if ( oargc == 1 )
       {
-	nfill = atoi(oargv[0]);
-	if ( nfill < 1 || nfill > 4 ) cdoAbort("nfill out of range!");
+        nfill = atoi(oargv[0]);
+        if ( operatorID != FILLMISSONESTEP ) 
+          {
+            if ( nfill < 1 || nfill > 4 ) cdoAbort("nfill out of range!");
+          }
       }
     else if ( oargc > 1 )
       cdoAbort("Too many arguments!");
@@ -190,6 +339,9 @@ void *Fillmiss(void *argument)
   streamDefVlist(streamID2, vlistID2);
 
   gridsize = vlistGridsizeMax(vlistID1);
+
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr   = (double *) malloc(gridsize*sizeof(double));
   field2.ptr   = (double *) malloc(gridsize*sizeof(double));
 
@@ -212,7 +364,7 @@ void *Fillmiss(void *argument)
 	  field2.nmiss   = 0;
 	  field2.missval = field1.missval;
 
-	  fillmiss(&field1, &field2, nfill);
+	  fill_method(&field1, &field2, nfill);
 
 	  gridsize = gridInqSize(field2.grid);
 	  nmiss = 0;
diff --git a/src/Filter.c b/src/Filter.c
index 5e43839..c78fb17 100644
--- a/src/Filter.c
+++ b/src/Filter.c
@@ -23,11 +23,11 @@
       Filter    bandpass
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if defined ( HAVE_LIBFFTW3 ) 
+#if defined( HAVE_LIBFFTW3 ) 
 #include <fftw3.h>
 #endif
 
@@ -137,7 +137,7 @@ void create_fmasc(int nts, double fdata, double fmin, double fmax, int *fmasc)
 }
 
 
-#if defined ( HAVE_LIBFFTW3 ) 
+#if defined( HAVE_LIBFFTW3 ) 
 static
 void filter_fftw(int nts, const int *fmasc, 
                  fftw_complex *fft_in, fftw_complex *fft_out, fftw_plan *p_T2S, fftw_plan *p_S2T)
@@ -198,13 +198,12 @@ void *Filter(void *argument)
   int tunit;
   int incperiod0, incunit0, incunit, dpy, calendar;
   int year0, month0, day0;
-  double missval;
   double *array1 = NULL, *array2 = NULL;
   double fdata = 0;
   field_t ***vars = NULL;
   double fmin = 0, fmax = 0;
   int *fmasc;
-#if defined ( HAVE_LIBFFTW3 ) 
+#if defined( HAVE_LIBFFTW3 ) 
   fftw_plan p_T2S, p_S2T;
   fftw_complex *out_fft;
   fftw_complex *in_fft;
@@ -250,24 +249,8 @@ void *Filter(void *argument)
                        
       taxisInqDTinfo(taxisID1, &dtinfo[tsID]);
    
-      vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-      
-      for ( varID = 0; varID < nvars; varID++ )
-        {
-          gridID   = vlistInqVarGrid(vlistID1, varID);
-          missval  = vlistInqVarMissval(vlistID1, varID);
-          nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-          
-          vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-          
-          for ( levelID = 0; levelID < nlevel; levelID++ )
-            {
-              vars[tsID][varID][levelID].grid    = gridID;
-              vars[tsID][varID][levelID].missval = missval;
-              vars[tsID][varID][levelID].ptr     = NULL;
-            }
-        }
-      
+      vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
+           
       for ( recID = 0; recID < nrecs; recID++ )
         {
           streamInqRecord(streamID1, &varID, &levelID);
@@ -326,7 +309,7 @@ void *Filter(void *argument)
   nts = tsID;
   /*  round up nts to next power of two for (better) performance 
    ** of fast fourier transformation */
-#if defined ( HAVE_LIBFFTW3 ) 
+#if defined( HAVE_LIBFFTW3 ) 
   nts2 = nts;
 
   out_fft = (fftw_complex *) malloc ( nts * sizeof(fftw_complex) );
@@ -383,17 +366,16 @@ void *Filter(void *argument)
   for ( varID = 0; varID < nvars; varID++ )
     {
       gridID   = vlistInqVarGrid(vlistID1, varID);
-      missval  = vlistInqVarMissval(vlistID1, varID);
       gridsize = gridInqSize(gridID);
       nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
 
-#if defined ( HAVE_LIBFFTW3 ) 
+#if defined( HAVE_LIBFFTW3 ) 
       fprintf(stderr," using fftw lib\n");
 #endif
       
       for ( levelID = 0; levelID < nlevel; levelID++ )
         { 
-#if defined ( HAVE_LIBFFTW3 ) 
+#if defined( HAVE_LIBFFTW3 ) 
           for ( i = 0; i < gridsize-1; i++ )
             {
               for ( tsID = 0; tsID < nts; tsID++ )                              
@@ -453,11 +435,12 @@ void *Filter(void *argument)
 		  streamDefRecord(streamID2, varID, levelID);
                   streamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
                   free(vars[tsID][varID][levelID].ptr);
+		  vars[tsID][varID][levelID].ptr = NULL;
                 }
             }
-          free(vars[tsID][varID]);
         }
-      free(vars[tsID]);
+
+      field_free(vars[tsID], vlistID1);
     }
 
   if ( vars   ) free(vars);
diff --git a/src/Fldrms.c b/src/Fldrms.c
index c5339a2..2a874c0 100644
--- a/src/Fldrms.c
+++ b/src/Fldrms.c
@@ -95,6 +95,10 @@ void *Fldrms(void *argument)
 
   streamDefVlist(streamID3, vlistID3);
 
+  field_init(&field1);
+  field_init(&field2);
+  field_init(&field3);
+
   lim = vlistGridsizeMax(vlistID1);
   field1.ptr    = (double *) malloc(lim*sizeof(double));
   field1.weight = NULL;
diff --git a/src/Fldstat.c b/src/Fldstat.c
index 188049c..aa31707 100644
--- a/src/Fldstat.c
+++ b/src/Fldstat.c
@@ -161,6 +161,8 @@ void *Fldstat(void *argument)
 
   streamDefVlist(streamID2, vlistID2);
 
+  field_init(&field);
+
   lim = vlistGridsizeMax(vlistID1);
   field.ptr    = (double *) malloc(lim*sizeof(double));
   field.weight = NULL;
diff --git a/src/Fourier.c b/src/Fourier.c
index b74794d..19b5ac8 100644
--- a/src/Fourier.c
+++ b/src/Fourier.c
@@ -15,7 +15,7 @@
   GNU General Public License for more details.
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -91,23 +91,7 @@ void *Fourier(void *argument)
       vdate[tsID] = taxisInqVdate(taxisID1);
       vtime[tsID] = taxisInqVtime(taxisID1);
 
-      vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID  = vlistInqVarGrid(vlistID1, varID);
-	  missval = vlistInqVarMissval(vlistID1, varID);
-	  nlevel  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-
-	  vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    {
-	      vars[tsID][varID][levelID].grid    = gridID;
-	      vars[tsID][varID][levelID].missval = missval;
-	      vars[tsID][varID][levelID].ptr     = NULL;
-	    }
-	}
+      vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
 
       for ( recID = 0; recID < nrecs; recID++ )
 	{
@@ -146,13 +130,13 @@ void *Fourier(void *argument)
       nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
       for ( levelID = 0; levelID < nlevel; levelID++ )
 	{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, ompthID, tsID)
 #endif
 	  for ( i = 0; i < gridsize; i++ )
 	    {
 	      int lmiss = 0;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
               ompthID = omp_get_thread_num();
 #else
               ompthID = 0;
@@ -219,11 +203,12 @@ void *Fourier(void *argument)
 		  streamDefRecord(streamID2, varID, levelID);
 		  streamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
 		  free(vars[tsID][varID][levelID].ptr);
+		  vars[tsID][varID][levelID].ptr = NULL;
 		}
 	    }
-	  free(vars[tsID][varID]);
 	}
-      free(vars[tsID]);
+
+      field_free(vars[tsID], vlistID1);
     }
 
   if ( vars  ) free(vars);
diff --git a/src/Gather.c b/src/Gather.c
index 2b68618..65c0681 100644
--- a/src/Gather.c
+++ b/src/Gather.c
@@ -413,7 +413,7 @@ void *Gather(void *argument)
 	  missval = vlistInqVarMissval(vlistID1, varID);
 	  for ( i = 0; i < gridsize2; i++ ) array2[i] = missval;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(fileID, streamID, nmiss, i)
 #endif
 	  for ( fileID = 0; fileID < nfiles; fileID++ )
diff --git a/src/Gradsdes.c b/src/Gradsdes.c
index cf63889..c06e577 100644
--- a/src/Gradsdes.c
+++ b/src/Gradsdes.c
@@ -23,7 +23,7 @@
 */
 
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" /* VERSION */
 #endif
 
@@ -1051,7 +1051,7 @@ void *Gradsdes(void *argument)
   gdp = fopen(ctlfile, "w");
   if ( gdp == NULL ) cdoAbort("Open failed on %s", ctlfile);
 
-#if defined (VERSION)
+#if defined(VERSION)
   fprintf(gdp, "* Generated by CDO version %s\n", VERSION);
   fprintf(gdp, "*\n");
 #endif
diff --git a/src/Gridboxstat.c b/src/Gridboxstat.c
index 9777fdb..1f7f3fc 100644
--- a/src/Gridboxstat.c
+++ b/src/Gridboxstat.c
@@ -27,7 +27,7 @@
       Gridboxstat    gridboxvar          Gridbox variance
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -537,7 +537,11 @@ void gridboxstat(field_t *field1, field_t *field2, int xinc, int yinc, int statf
   field_t *field;
   int isize;
   int useWeight = FALSE;
+  /*
+  double findex = 0;
 
+  progressInit();
+  */
   if ( field1->weight ) useWeight = TRUE;
 
   gridsize      = xinc*yinc;
@@ -565,17 +569,27 @@ void gridboxstat(field_t *field1, field_t *field2, int xinc, int yinc, int statf
   nlon2 = gridInqXsize(gridID2);
   nlat2 = gridInqYsize(gridID2);
 
-
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(ig, ilat, ilon, j, jj, i, ii, index, isize, ompthID)
 #endif
   for ( ig = 0; ig < nlat2*nlon2; ++ig )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       ompthID = omp_get_thread_num();
 #else
       ompthID = 0;
 #endif
+      /*
+      int lprogress = 1;
+#if defined(_OPENMP)
+      if ( ompthID != 0 ) lprogress = 0;
+#endif
+#if defined(_OPENMP)
+#pragma omp atomic
+#endif
+      findex++;
+      if ( lprogress ) progressStatus(0, 1, findex/nlat2*nlon2);
+      */
       ilat = ig/nlon2;
       ilon = ig - ilat*nlon2;
 
@@ -682,6 +696,9 @@ void *Gridboxstat(void *argument)
 
   streamDefVlist(streamID2, vlistID2);
 
+  field_init(&field1);
+  field_init(&field2);
+
   gridsize1 = gridInqSize(gridID1);
   field1.ptr    = (double *) malloc(gridsize1*sizeof(double));
   field1.weight = NULL;
diff --git a/src/Harmonic.c b/src/Harmonic.c
index c0b3d66..1236ed7 100644
--- a/src/Harmonic.c
+++ b/src/Harmonic.c
@@ -46,6 +46,7 @@ void *Harmonic(void *argument)
   int n_out, nout, n;
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   double missval;
   double sine, cosine;
   double *array;
@@ -75,8 +76,9 @@ void *Harmonic(void *argument)
   taxisID2 = taxisCreate(TAXIS_ABSOLUTE);
   vlistDefTaxis(vlistID2, taxisID2);
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   streamIDs = (int*) malloc(n_out*sizeof(int));
 
diff --git a/src/Hi.c b/src/Hi.c
index 10604ab..103fe3d 100755
--- a/src/Hi.c
+++ b/src/Hi.c
@@ -120,6 +120,9 @@ void *Hi(void *argument)
   
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field2);
+  field_init(&field3);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
   field3.ptr = (double *) malloc(gridsize*sizeof(double));
@@ -173,8 +176,7 @@ void *Hi(void *argument)
 	  if ( varID1 != varID2 || varID1 != varID3 || levelID1 != levelID2 || levelID1 != levelID3 )
 	    cdoAbort("Input streams have different structure!");
 	    
-          if ( varID1 != FIRST_VAR )
-            continue;
+          if ( varID1 != FIRST_VAR ) continue;
             
 	  field1.grid    = vlistInqVarGrid(vlistID1, varID1);
 	  field1.missval = vlistInqVarMissval(vlistID1, varID1);
diff --git a/src/Importbinary.c b/src/Importbinary.c
index 98636b0..ff07af0 100644
--- a/src/Importbinary.c
+++ b/src/Importbinary.c
@@ -15,7 +15,7 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
diff --git a/src/Importcmsaf.c b/src/Importcmsaf.c
index 79c086d..18c455f 100644
--- a/src/Importcmsaf.c
+++ b/src/Importcmsaf.c
@@ -15,13 +15,13 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
 #define H5_USE_16_API
 
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
 #  include "hdf5.h"
 #endif
 
@@ -70,7 +70,7 @@ datasets_t;
 
 #define  NINT(x)   ((x) < 0 ? (int)((x)-0.5) : (int)((x)+0.5))
 
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
 static
 void print_filter(hid_t dset_id, char *varname)
 {
@@ -1407,7 +1407,7 @@ void dsets_init(datasets_t *dsets)
 
 void *Importcmsaf(void *argument)
 {
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
   int streamID;
   int gridID = -1, zaxisID, taxisID, vlistID;
   int i, offset;
@@ -1429,7 +1429,7 @@ void *Importcmsaf(void *argument)
   if ( cdoDefaultFileType == CDI_UNDEFID )
     cdoDefaultFileType = FILETYPE_NC;
 
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
   dsets_init(&dsets);
 
   /* Open an existing file. */
diff --git a/src/Info.c b/src/Info.c
index e93f865..9dffd93 100644
--- a/src/Info.c
+++ b/src/Info.c
@@ -35,7 +35,7 @@ void printMap(int nlon, int nlat, double *array, double missval, double min, dou
   int ilon, ilat, i;
   double x, a, b;
   double step;
-  double level[9];
+  double level[10];
   int min_n, max_n;
   char c;
 
@@ -264,8 +264,8 @@ void *Info(void *argument)
       if ( vlistNvars(vlistID) == 0 ) continue;
 
       gridsize = vlistGridsizeMax(vlistID);
-
       if ( vlistNumber(vlistID) != CDI_REAL ) gridsize *= 2;
+
       array = (double *) malloc(gridsize*sizeof(double));
 
       indg = 0;
@@ -403,7 +403,7 @@ void *Info(void *argument)
 
 		      if ( nvals_r > 0 ) arrmean_r = arrsum_r / nvals_r;
 		      if ( nvals_i > 0 ) arrmean_i = arrsum_i / nvals_i;
-		      fprintf(stdout, "  -  (%#12.5g,%#12.5g)  -", arrmean_r, arrmean_i);
+		      fprintf(stdout, "   -  (%#12.5g,%#12.5g)  -", arrmean_r, arrmean_i);
 		    }
 		}
 
diff --git a/src/Intgrid.c b/src/Intgrid.c
index 5b94d98..be07400 100644
--- a/src/Intgrid.c
+++ b/src/Intgrid.c
@@ -33,12 +33,11 @@ int genThinoutGrid(int gridID1, int xinc, int yinc)
 {
   int ilon, ilat, olon, olat;
   int gridID2, gridtype;
-  int gridsize1, nlon1, nlat1;
+  int nlon1, nlat1;
   int gridsize2, nlon2, nlat2;
   double *xvals1, *yvals1, *xvals2, *yvals2;
 
   gridtype = gridInqType(gridID1);
-  gridsize1 = gridInqSize(gridID1);
   nlon1 = gridInqXsize(gridID1);
   nlat1 = gridInqYsize(gridID1);
 
@@ -91,14 +90,13 @@ int genBoxavgGrid(int gridID1, int xinc, int yinc)
 {
   int i, j, i1;
   int gridID2, gridtype;
-  int gridsize1, nlon1, nlat1;
+  int nlon1, nlat1;
   int gridsize2, nlon2, nlat2;
   double *xvals1, *yvals1, *xvals2, *yvals2;
   double *grid1_corner_lon = NULL, *grid1_corner_lat = NULL;
   double *grid2_corner_lon = NULL, *grid2_corner_lat = NULL;
 
   gridtype = gridInqType(gridID1);
-  gridsize1 = gridInqSize(gridID1);
   nlon1 = gridInqXsize(gridID1);
   nlat1 = gridInqYsize(gridID1);
 
@@ -415,6 +413,9 @@ void *Intgrid(void *argument)
   gridsize = gridInqSize(gridID2);
   array2   = (double *) malloc(gridsize*sizeof(double));
 
+  field_init(&field1);
+  field_init(&field2);
+
   tsID = 0;
   while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
     {
diff --git a/src/Intgridtraj.c b/src/Intgridtraj.c
index 002e0d5..1507d84 100644
--- a/src/Intgridtraj.c
+++ b/src/Intgridtraj.c
@@ -94,6 +94,9 @@ void *Intgridtraj(void *argument)
 
   vlistID1 = streamInqVlist(streamID1);
 
+  field_init(&field1);
+  field_init(&field2);
+
   nvars    = vlistNvars(vlistID1);
   nrecords = vlistNrecs(vlistID1);
 
diff --git a/src/Intlevel.c b/src/Intlevel.c
index 914b427..eaae403 100644
--- a/src/Intlevel.c
+++ b/src/Intlevel.c
@@ -54,7 +54,7 @@ void interp_lev(int gridsize, double missval, double *vardata1, double *vardata2
       var1L1 = vardata1+gridsize*idx1;
       var1L2 = vardata1+gridsize*idx2;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for shared(gridsize, var2, var1L1, var1L2, wgt1, wgt2, missval) private(i, w1, w2)
 #endif
       for ( i = 0; i < gridsize; ++i )
diff --git a/src/Intyear.c b/src/Intyear.c
index e5e1285..22b6198 100644
--- a/src/Intyear.c
+++ b/src/Intyear.c
@@ -46,6 +46,7 @@ void *Intyear(void *argument)
   int nchars;
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   double fac1, fac2;
   double missval1, missval2;
   double *array1, *array2, *array3;
@@ -84,8 +85,9 @@ void *Intyear(void *argument)
   strcpy(filename, cdoStreamName(2)->args);
   nchars = strlen(filename);
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   for ( iy = 0; iy < nyears; iy++ )
     {
diff --git a/src/Isosurface.c b/src/Isosurface.c
index 2ad316c..0713b54 100644
--- a/src/Isosurface.c
+++ b/src/Isosurface.c
@@ -149,6 +149,7 @@ void *Isosurface(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   nvars = vlistNvars(vlistID1);
@@ -170,6 +171,7 @@ void *Isosurface(void *argument)
       else 
 	liso[varID] = FALSE;
 
+      field_init(&vars1[varID]);
       vars1[varID].grid    = gridID;
       vars1[varID].zaxis   = zaxisID;
       vars1[varID].nmiss   = 0;
diff --git a/src/Maggraph.c b/src/Maggraph.c
index 08ec5d0..b2262a3 100644
--- a/src/Maggraph.c
+++ b/src/Maggraph.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" /* HAVE_LIBMAGICS */
 #endif
 
@@ -10,12 +10,12 @@
 #include "grid.h"
 #include "pstream.h"
 
-#if  defined  (HAVE_LIBMAGICS)
+#if defined(HAVE_LIBMAGICS)
 #include "magics_api.h"
 #endif
 
 
-#if  defined  (HAVE_LIBXML2)
+#if defined(HAVE_LIBXML2)
 
 #include<libxml/parser.h>
 #include<libxml/tree.h>
@@ -489,7 +489,7 @@ void maggraph(const char *plotfile, const char *varname,const char *varunits, lo
 	3. Set the attributes for the magics data and plot
   */  
    
-#if  defined  (HAVE_LIBMAGICS)
+#if defined(HAVE_LIBMAGICS)
 
 
   /* magics_template_parser( magics_node ); */
@@ -755,7 +755,7 @@ int compareDateOrTimeStr( char *datetimestr1, char *datetimestr2, char *sep_char
 }
 
 
-#if  defined  (HAVE_LIBMAGICS)
+#if defined(HAVE_LIBMAGICS)
 
 static
 void init_MAGICS( )
@@ -904,7 +904,7 @@ void *Maggraph(void *argument)
       streamClose(streamID);
     }
   
-#if  defined  (HAVE_LIBXML2)
+#if defined(HAVE_LIBXML2)
   /* HARDCODED THE FILE NAME .. TO BE SENT AS COMMAND LINE ARGUMENT FOR THE MAGICS OPERATOR */
   /*
   init_XMLtemplate_parser( Filename );
@@ -913,7 +913,7 @@ void *Maggraph(void *argument)
 #endif
 
 
-#if  defined  (HAVE_LIBMAGICS)
+#if defined(HAVE_LIBMAGICS)
   init_MAGICS( );
 #endif
 
@@ -927,11 +927,11 @@ void *Maggraph(void *argument)
     }
   maggraph(ofilename, varname, units, nfiles, nts, vdate, vtime, datatab, nparam, pnames);
 
-#if  defined  (HAVE_LIBXML2)
+#if defined(HAVE_LIBXML2)
   /* quit_XMLtemplate_parser( ); */
 #endif
 
-#if  defined  (HAVE_LIBMAGICS)
+#if defined(HAVE_LIBMAGICS)
   quit_MAGICS( );
 #endif
 
@@ -1038,7 +1038,7 @@ void VerifyGraphParameters( int num_param, char **param_names )
 			}
 		      else
 			{
-#if  defined  (HAVE_LIBXML2)
+#if defined(HAVE_LIBXML2)
 			  // HARDCODED THE FILE NAME .. TO BE SENT AS COMMAND LINE ARGUMENT FOR THE MAGICS OPERATOR 
 			  fclose(fp);
 			  init_XMLtemplate_parser( split_str[1] );
diff --git a/src/Magplot.c b/src/Magplot.c
index 3459523..a8ac8d0 100644
--- a/src/Magplot.c
+++ b/src/Magplot.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" /* HAVE_LIBMAGICS */
 #endif
 
diff --git a/src/Magvector.c b/src/Magvector.c
index e927cda..8f2c02a 100644
--- a/src/Magvector.c
+++ b/src/Magvector.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" /* HAVE_LIBMAGICS */
 #endif
 
@@ -129,7 +129,7 @@ void magvector( const char *plotfile, int operatorID, const char *varname, long
 	  }
 
 
-/* #if  defined  (HAVE_LIBMAGICS) */
+/* #if defined(HAVE_LIBMAGICS) */
 
 
         /* magics_template_parser( magics_node ); */
diff --git a/src/Makefile.am b/src/Makefile.am
index 8271018..5d846c0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -204,6 +204,7 @@ cdo_SOURCES += Adisit.c        \
                expr_lex.c      \
                expr_yacc.c     \
                expr_yacc.h     \
+               features.c      \
                field.c         \
                field.h         \
                field2.c        \
@@ -217,9 +218,11 @@ cdo_SOURCES += Adisit.c        \
                gradsdeslib.h   \
                grid.c          \
                grid.h          \
+               grid_area.c     \
                grid_gme.c      \
                grid_lcc.c      \
                grid_rot.c      \
+               gridreference.c \
                griddes.c       \
                griddes.h       \
                griddes_h5.c    \
@@ -266,6 +269,7 @@ cdo_SOURCES += Adisit.c        \
                remap.h         \
                remaplib.c      \
                remapsort.c     \
+               remap_scrip_io.c \
                specspace.c     \
                specspace.h     \
                statistic.c     \
diff --git a/src/Makefile.in b/src/Makefile.in
index 5de8c69..ee1ee48 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -122,24 +122,26 @@ am__cdo_SOURCES_DIST = cdo.c Adisit.c Arith.c Arithc.c Arithdays.c \
 	commandline.c const.h counter.h dmemory.h dtypes.h ecacore.c \
 	ecacore.h ecautil.c ecautil.h error.h etopo.h temp.h mask.h \
 	exception.c expr.c expr.h expr_lex.c expr_yacc.c expr_yacc.h \
-	field.c field.h field2.c fieldc.c fieldmem.c fieldmer.c \
-	fieldzon.c fouriertrans.c functs.h gradsdeslib.c gradsdeslib.h \
-	grid.c grid.h grid_gme.c grid_lcc.c grid_rot.c griddes.c \
-	griddes.h griddes_h5.c griddes_nc.c hetaeta.c hetaeta.h \
-	history.c institution.c interpol.c interpol.h job.c juldate.c \
-	kvlist.c kvlist.h legendre.c list.c list.h merge_sort2.c \
-	merge_sort2.h modules.c modules.h namelist.c namelist.h \
-	normal.c nth_element.c nth_element.h operator_help.h par_io.c \
-	par_io.h percentiles.c percentiles.h pipe.c pipe.h printinfo.h \
-	process.c process.h pstream.c pstream.h pstream_int.h \
-	pthread_debug.c pthread_debug.h readline.c realtime.c remap.h \
-	remaplib.c remapsort.c specspace.c specspace.h statistic.c \
-	statistic.h table.c timebase.h timer.c userlog.c util.c util.h \
-	vinterp.c vinterp.h zaxis.c Magplot.c Magvector.c Maggraph.c \
-	template_parser.h template_parser.c results_template_parser.h \
-	results_template_parser.c magics_template_parser.h \
-	magics_template_parser.c StringUtilities.h StringUtilities.c \
-	CdoMagicsMapper.h CdoMagicsMapper.c
+	features.c field.c field.h field2.c fieldc.c fieldmem.c \
+	fieldmer.c fieldzon.c fouriertrans.c functs.h gradsdeslib.c \
+	gradsdeslib.h grid.c grid.h grid_area.c grid_gme.c grid_lcc.c \
+	grid_rot.c gridreference.c griddes.c griddes.h griddes_h5.c \
+	griddes_nc.c hetaeta.c hetaeta.h history.c institution.c \
+	interpol.c interpol.h job.c juldate.c kvlist.c kvlist.h \
+	legendre.c list.c list.h merge_sort2.c merge_sort2.h modules.c \
+	modules.h namelist.c namelist.h normal.c nth_element.c \
+	nth_element.h operator_help.h par_io.c par_io.h percentiles.c \
+	percentiles.h pipe.c pipe.h printinfo.h process.c process.h \
+	pstream.c pstream.h pstream_int.h pthread_debug.c \
+	pthread_debug.h readline.c realtime.c remap.h remaplib.c \
+	remapsort.c remap_scrip_io.c specspace.c specspace.h \
+	statistic.c statistic.h table.c timebase.h timer.c userlog.c \
+	util.c util.h vinterp.c vinterp.h zaxis.c Magplot.c \
+	Magvector.c Maggraph.c template_parser.h template_parser.c \
+	results_template_parser.h results_template_parser.c \
+	magics_template_parser.h magics_template_parser.c \
+	StringUtilities.h StringUtilities.c CdoMagicsMapper.h \
+	CdoMagicsMapper.c
 @ENABLE_MAGICS_TRUE at am__objects_1 = cdo-Magplot.$(OBJEXT) \
 @ENABLE_MAGICS_TRUE@	cdo-Magvector.$(OBJEXT) \
 @ENABLE_MAGICS_TRUE@	cdo-Maggraph.$(OBJEXT) \
@@ -234,13 +236,14 @@ am_cdo_OBJECTS = cdo-cdo.$(OBJEXT) cdo-Adisit.$(OBJEXT) \
 	cdo-commandline.$(OBJEXT) cdo-ecacore.$(OBJEXT) \
 	cdo-ecautil.$(OBJEXT) cdo-exception.$(OBJEXT) \
 	cdo-expr.$(OBJEXT) cdo-expr_lex.$(OBJEXT) \
-	cdo-expr_yacc.$(OBJEXT) cdo-field.$(OBJEXT) \
-	cdo-field2.$(OBJEXT) cdo-fieldc.$(OBJEXT) \
+	cdo-expr_yacc.$(OBJEXT) cdo-features.$(OBJEXT) \
+	cdo-field.$(OBJEXT) cdo-field2.$(OBJEXT) cdo-fieldc.$(OBJEXT) \
 	cdo-fieldmem.$(OBJEXT) cdo-fieldmer.$(OBJEXT) \
 	cdo-fieldzon.$(OBJEXT) cdo-fouriertrans.$(OBJEXT) \
 	cdo-gradsdeslib.$(OBJEXT) cdo-grid.$(OBJEXT) \
-	cdo-grid_gme.$(OBJEXT) cdo-grid_lcc.$(OBJEXT) \
-	cdo-grid_rot.$(OBJEXT) cdo-griddes.$(OBJEXT) \
+	cdo-grid_area.$(OBJEXT) cdo-grid_gme.$(OBJEXT) \
+	cdo-grid_lcc.$(OBJEXT) cdo-grid_rot.$(OBJEXT) \
+	cdo-gridreference.$(OBJEXT) cdo-griddes.$(OBJEXT) \
 	cdo-griddes_h5.$(OBJEXT) cdo-griddes_nc.$(OBJEXT) \
 	cdo-hetaeta.$(OBJEXT) cdo-history.$(OBJEXT) \
 	cdo-institution.$(OBJEXT) cdo-interpol.$(OBJEXT) \
@@ -253,10 +256,11 @@ am_cdo_OBJECTS = cdo-cdo.$(OBJEXT) cdo-Adisit.$(OBJEXT) \
 	cdo-process.$(OBJEXT) cdo-pstream.$(OBJEXT) \
 	cdo-pthread_debug.$(OBJEXT) cdo-readline.$(OBJEXT) \
 	cdo-realtime.$(OBJEXT) cdo-remaplib.$(OBJEXT) \
-	cdo-remapsort.$(OBJEXT) cdo-specspace.$(OBJEXT) \
-	cdo-statistic.$(OBJEXT) cdo-table.$(OBJEXT) \
-	cdo-timer.$(OBJEXT) cdo-userlog.$(OBJEXT) cdo-util.$(OBJEXT) \
-	cdo-vinterp.$(OBJEXT) cdo-zaxis.$(OBJEXT) $(am__objects_1)
+	cdo-remapsort.$(OBJEXT) cdo-remap_scrip_io.$(OBJEXT) \
+	cdo-specspace.$(OBJEXT) cdo-statistic.$(OBJEXT) \
+	cdo-table.$(OBJEXT) cdo-timer.$(OBJEXT) cdo-userlog.$(OBJEXT) \
+	cdo-util.$(OBJEXT) cdo-vinterp.$(OBJEXT) cdo-zaxis.$(OBJEXT) \
+	$(am__objects_1)
 cdo_OBJECTS = $(am_cdo_OBJECTS)
 cdo_DEPENDENCIES = $(top_builddir)/libcdi/src/libcdi.la
 cdo_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -306,6 +310,8 @@ CLDFLAGS = @CLDFLAGS@
 CLIBS = @CLIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CURL_INCLUDE = @CURL_INCLUDE@
+CURL_LDFLAGS = @CURL_LDFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -488,21 +494,22 @@ cdo_SOURCES = cdo.c Adisit.c Arith.c Arithc.c Arithdays.c Arithlat.c \
 	cdo_vlist.c color.c color.h commandline.c const.h counter.h \
 	dmemory.h dtypes.h ecacore.c ecacore.h ecautil.c ecautil.h \
 	error.h etopo.h temp.h mask.h exception.c expr.c expr.h \
-	expr_lex.c expr_yacc.c expr_yacc.h field.c field.h field2.c \
-	fieldc.c fieldmem.c fieldmer.c fieldzon.c fouriertrans.c \
-	functs.h gradsdeslib.c gradsdeslib.h grid.c grid.h grid_gme.c \
-	grid_lcc.c grid_rot.c griddes.c griddes.h griddes_h5.c \
-	griddes_nc.c hetaeta.c hetaeta.h history.c institution.c \
-	interpol.c interpol.h job.c juldate.c kvlist.c kvlist.h \
-	legendre.c list.c list.h merge_sort2.c merge_sort2.h modules.c \
-	modules.h namelist.c namelist.h normal.c nth_element.c \
-	nth_element.h operator_help.h par_io.c par_io.h percentiles.c \
-	percentiles.h pipe.c pipe.h printinfo.h process.c process.h \
-	pstream.c pstream.h pstream_int.h pthread_debug.c \
-	pthread_debug.h readline.c realtime.c remap.h remaplib.c \
-	remapsort.c specspace.c specspace.h statistic.c statistic.h \
-	table.c timebase.h timer.c userlog.c util.c util.h vinterp.c \
-	vinterp.h zaxis.c $(am__append_1)
+	expr_lex.c expr_yacc.c expr_yacc.h features.c field.c field.h \
+	field2.c fieldc.c fieldmem.c fieldmer.c fieldzon.c \
+	fouriertrans.c functs.h gradsdeslib.c gradsdeslib.h grid.c \
+	grid.h grid_area.c grid_gme.c grid_lcc.c grid_rot.c \
+	gridreference.c griddes.c griddes.h griddes_h5.c griddes_nc.c \
+	hetaeta.c hetaeta.h history.c institution.c interpol.c \
+	interpol.h job.c juldate.c kvlist.c kvlist.h legendre.c list.c \
+	list.h merge_sort2.c merge_sort2.h modules.c modules.h \
+	namelist.c namelist.h normal.c nth_element.c nth_element.h \
+	operator_help.h par_io.c par_io.h percentiles.c percentiles.h \
+	pipe.c pipe.h printinfo.h process.c process.h pstream.c \
+	pstream.h pstream_int.h pthread_debug.c pthread_debug.h \
+	readline.c realtime.c remap.h remaplib.c remapsort.c \
+	remap_scrip_io.c specspace.c specspace.h statistic.c \
+	statistic.h table.c timebase.h timer.c userlog.c util.c util.h \
+	vinterp.c vinterp.h zaxis.c $(am__append_1)
 cdo_CPPFLAGS = -I$(top_srcdir)/libcdi/src
 cdo_LDADD = $(top_builddir)/libcdi/src/libcdi.la
 cdo_LDFLAGS = $(am__append_2)
@@ -824,6 +831,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-expr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-expr_lex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-expr_yacc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-features.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-field.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-field2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-fieldc.Po at am__quote@
@@ -833,12 +841,14 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-fouriertrans.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-gradsdeslib.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-grid_area.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-grid_gme.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-grid_lcc.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-grid_rot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-griddes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-griddes_h5.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-griddes_nc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-gridreference.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-hetaeta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-history.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-institution.Po at am__quote@
@@ -862,6 +872,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-pthread_debug.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-readline.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-realtime.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-remap_scrip_io.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-remaplib.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-remapsort.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdo-results_template_parser.Po at am__quote@
@@ -3515,6 +3526,20 @@ cdo-expr_yacc.obj: expr_yacc.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-expr_yacc.obj `if test -f 'expr_yacc.c'; then $(CYGPATH_W) 'expr_yacc.c'; else $(CYGPATH_W) '$(srcdir)/expr_yacc.c'; fi`
 
+cdo-features.o: features.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-features.o -MD -MP -MF $(DEPDIR)/cdo-features.Tpo -c -o cdo-features.o `test -f 'features.c' || echo '$(srcdir)/'`features.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-features.Tpo $(DEPDIR)/cdo-features.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='features.c' object='cdo-features.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-features.o `test -f 'features.c' || echo '$(srcdir)/'`features.c
+
+cdo-features.obj: features.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-features.obj -MD -MP -MF $(DEPDIR)/cdo-features.Tpo -c -o cdo-features.obj `if test -f 'features.c'; then $(CYGPATH_W) 'features.c'; else $(CYGPATH_W) '$(srcdir)/features.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-features.Tpo $(DEPDIR)/cdo-features.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='features.c' object='cdo-features.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-features.obj `if test -f 'features.c'; then $(CYGPATH_W) 'features.c'; else $(CYGPATH_W) '$(srcdir)/features.c'; fi`
+
 cdo-field.o: field.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-field.o -MD -MP -MF $(DEPDIR)/cdo-field.Tpo -c -o cdo-field.o `test -f 'field.c' || echo '$(srcdir)/'`field.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-field.Tpo $(DEPDIR)/cdo-field.Po
@@ -3641,6 +3666,20 @@ cdo-grid.obj: grid.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-grid.obj `if test -f 'grid.c'; then $(CYGPATH_W) 'grid.c'; else $(CYGPATH_W) '$(srcdir)/grid.c'; fi`
 
+cdo-grid_area.o: grid_area.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-grid_area.o -MD -MP -MF $(DEPDIR)/cdo-grid_area.Tpo -c -o cdo-grid_area.o `test -f 'grid_area.c' || echo '$(srcdir)/'`grid_area.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-grid_area.Tpo $(DEPDIR)/cdo-grid_area.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='grid_area.c' object='cdo-grid_area.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-grid_area.o `test -f 'grid_area.c' || echo '$(srcdir)/'`grid_area.c
+
+cdo-grid_area.obj: grid_area.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-grid_area.obj -MD -MP -MF $(DEPDIR)/cdo-grid_area.Tpo -c -o cdo-grid_area.obj `if test -f 'grid_area.c'; then $(CYGPATH_W) 'grid_area.c'; else $(CYGPATH_W) '$(srcdir)/grid_area.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-grid_area.Tpo $(DEPDIR)/cdo-grid_area.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='grid_area.c' object='cdo-grid_area.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-grid_area.obj `if test -f 'grid_area.c'; then $(CYGPATH_W) 'grid_area.c'; else $(CYGPATH_W) '$(srcdir)/grid_area.c'; fi`
+
 cdo-grid_gme.o: grid_gme.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-grid_gme.o -MD -MP -MF $(DEPDIR)/cdo-grid_gme.Tpo -c -o cdo-grid_gme.o `test -f 'grid_gme.c' || echo '$(srcdir)/'`grid_gme.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-grid_gme.Tpo $(DEPDIR)/cdo-grid_gme.Po
@@ -3683,6 +3722,20 @@ cdo-grid_rot.obj: grid_rot.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-grid_rot.obj `if test -f 'grid_rot.c'; then $(CYGPATH_W) 'grid_rot.c'; else $(CYGPATH_W) '$(srcdir)/grid_rot.c'; fi`
 
+cdo-gridreference.o: gridreference.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-gridreference.o -MD -MP -MF $(DEPDIR)/cdo-gridreference.Tpo -c -o cdo-gridreference.o `test -f 'gridreference.c' || echo '$(srcdir)/'`gridreference.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-gridreference.Tpo $(DEPDIR)/cdo-gridreference.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gridreference.c' object='cdo-gridreference.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-gridreference.o `test -f 'gridreference.c' || echo '$(srcdir)/'`gridreference.c
+
+cdo-gridreference.obj: gridreference.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-gridreference.obj -MD -MP -MF $(DEPDIR)/cdo-gridreference.Tpo -c -o cdo-gridreference.obj `if test -f 'gridreference.c'; then $(CYGPATH_W) 'gridreference.c'; else $(CYGPATH_W) '$(srcdir)/gridreference.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-gridreference.Tpo $(DEPDIR)/cdo-gridreference.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gridreference.c' object='cdo-gridreference.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-gridreference.obj `if test -f 'gridreference.c'; then $(CYGPATH_W) 'gridreference.c'; else $(CYGPATH_W) '$(srcdir)/gridreference.c'; fi`
+
 cdo-griddes.o: griddes.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-griddes.o -MD -MP -MF $(DEPDIR)/cdo-griddes.Tpo -c -o cdo-griddes.o `test -f 'griddes.c' || echo '$(srcdir)/'`griddes.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-griddes.Tpo $(DEPDIR)/cdo-griddes.Po
@@ -4061,6 +4114,20 @@ cdo-remapsort.obj: remapsort.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-remapsort.obj `if test -f 'remapsort.c'; then $(CYGPATH_W) 'remapsort.c'; else $(CYGPATH_W) '$(srcdir)/remapsort.c'; fi`
 
+cdo-remap_scrip_io.o: remap_scrip_io.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-remap_scrip_io.o -MD -MP -MF $(DEPDIR)/cdo-remap_scrip_io.Tpo -c -o cdo-remap_scrip_io.o `test -f 'remap_scrip_io.c' || echo '$(srcdir)/'`remap_scrip_io.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-remap_scrip_io.Tpo $(DEPDIR)/cdo-remap_scrip_io.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='remap_scrip_io.c' object='cdo-remap_scrip_io.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-remap_scrip_io.o `test -f 'remap_scrip_io.c' || echo '$(srcdir)/'`remap_scrip_io.c
+
+cdo-remap_scrip_io.obj: remap_scrip_io.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-remap_scrip_io.obj -MD -MP -MF $(DEPDIR)/cdo-remap_scrip_io.Tpo -c -o cdo-remap_scrip_io.obj `if test -f 'remap_scrip_io.c'; then $(CYGPATH_W) 'remap_scrip_io.c'; else $(CYGPATH_W) '$(srcdir)/remap_scrip_io.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-remap_scrip_io.Tpo $(DEPDIR)/cdo-remap_scrip_io.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='remap_scrip_io.c' object='cdo-remap_scrip_io.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdo-remap_scrip_io.obj `if test -f 'remap_scrip_io.c'; then $(CYGPATH_W) 'remap_scrip_io.c'; else $(CYGPATH_W) '$(srcdir)/remap_scrip_io.c'; fi`
+
 cdo-specspace.o: specspace.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cdo_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdo-specspace.o -MD -MP -MF $(DEPDIR)/cdo-specspace.Tpo -c -o cdo-specspace.o `test -f 'specspace.c' || echo '$(srcdir)/'`specspace.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/cdo-specspace.Tpo $(DEPDIR)/cdo-specspace.Po
diff --git a/src/Mastrfu.c b/src/Mastrfu.c
index 801ab2d..ccff3bd 100644
--- a/src/Mastrfu.c
+++ b/src/Mastrfu.c
@@ -30,7 +30,7 @@
 
 
 static
-void mastrfu(int gridID, int zaxisID, double *array1, double *array2)
+void mastrfu(int gridID, int zaxisID, double *array1, double *array2, int nmiss, double missval)
 {
   int nlev;
   int nlat;
@@ -74,14 +74,30 @@ void mastrfu(int gridID, int zaxisID, double *array1, double *array2)
     for ( ilat = 0; ilat < nlat; ilat++ )
       field2[ilev][ilat] = 0.0;
 
-  for ( ilev = nlev-1; ilev >= 0; ilev-- )
-    for ( n = ilev; n < nlev-1; n++ )
+  if ( nmiss == 0 )
+    {
+      for ( ilev = nlev-1; ilev >= 0; ilev-- )
+	for ( n = ilev; n < nlev-1; n++ )
+	  for ( ilat = 0; ilat < nlat; ilat++ )
+	    {
+	      field2[ilev][ilat] += fact*(field1[n][ilat]+field1[n+1][ilat])*cosphi[ilat]*(plevel[n]-plevel[n+1]);
+	    }
+    }
+  else
+    {
       for ( ilat = 0; ilat < nlat; ilat++ )
-	{
-	  field2[ilev][ilat] = field2[ilev][ilat] +
-	                       fact*(field1[n][ilat]+field1[n+1][ilat])*
-	                       cosphi[ilat]*(plevel[n]-plevel[n+1]);
-	}
+	for ( ilev = nlev-1; ilev >= 0; ilev-- )
+	  for ( n = ilev; n < nlev-1; n++ )
+	    {
+	      if ( DBL_IS_EQUAL(field1[n][ilat], missval) )
+		{
+		  field2[ilev][ilat] = missval;
+		  break;
+		}
+	      else
+		field2[ilev][ilat] += fact*(field1[n][ilat]+field1[n+1][ilat])*cosphi[ilat]*(plevel[n]-plevel[n+1]);
+	    }
+    }
 
   free(field2);
   free(field1);
@@ -101,7 +117,8 @@ void *Mastrfu(void *argument)
   int nvars, code, gridID, zaxisID, nlev;
   int vlistID1, vlistID2;
   int offset;
-  int nmiss;
+  int nmiss, nmiss1;
+  double missval;
   double *array1, *array2;
   int taxisID1, taxisID2;
 
@@ -117,6 +134,8 @@ void *Mastrfu(void *argument)
   code = vlistInqVarCode(vlistID1, 0);
   if ( code > 0 && code != 132 ) cdoWarning("Unexpected code %d!", code);
 
+  missval = vlistInqVarMissval(vlistID1, 0);
+
   zaxisID = vlistInqVarZaxis(vlistID1, 0);
   if ( zaxisInqType(zaxisID) != ZAXIS_PRESSURE &&
        zaxisInqType(zaxisID) != ZAXIS_GENERIC )
@@ -157,16 +176,17 @@ void *Mastrfu(void *argument)
       taxisCopyTimestep(taxisID2, taxisID1);
 
       streamDefTimestep(streamID2, tsID);
-	       
+
+      nmiss = 0;
       for ( recID = 0; recID < nrecs; recID++ )
 	{
 	  streamInqRecord(streamID1, &varID, &levelID);
 	  offset  = gridsize*levelID;
-	  streamReadRecord(streamID1, array1+offset, &nmiss);
-	  if ( nmiss ) cdoAbort("Missing values unsupported for this operator!");
+	  streamReadRecord(streamID1, array1+offset, &nmiss1);
+	  nmiss += nmiss1;
 	}
 
-      mastrfu(gridID, zaxisID, array1, array2);
+      mastrfu(gridID, zaxisID, array1, array2, nmiss, missval);
 
       for ( recID = 0; recID < nrecs; recID++ )
 	{
diff --git a/src/Merge.c b/src/Merge.c
index c26f4d5..629874c 100644
--- a/src/Merge.c
+++ b/src/Merge.c
@@ -134,11 +134,28 @@ void *Merge(void *argument)
   int gridsize;
   int nmiss;
   int taxisID1, taxisID2;
+  int skip_same_var = FALSE;
   const char *ofilename;
   double *array = NULL;
 
   cdoInitialize(argument);
 
+  {
+    char *envstr;
+    envstr = getenv("SKIP_SAME_VAR");
+    if ( envstr )
+      {
+	int ival;
+	ival = atoi(envstr);
+	if ( ival == 1 )
+	  {
+	    skip_same_var = TRUE;
+	    if ( cdoVerbose )
+	      cdoPrint("Set SKIP_SAME_VAR to %d", ival);
+	  }
+      }
+  }
+
   if ( UNCHANGED_RECORD ) lcopy = TRUE;
 
   streamCnt = cdoStreamCnt();
diff --git a/src/Mergetime.c b/src/Mergetime.c
index 3b6dc55..be49041 100644
--- a/src/Mergetime.c
+++ b/src/Mergetime.c
@@ -43,7 +43,7 @@ void *Mergetime(void *argument)
   int last_vdate = -1, last_vtime = -1;
   int next_fileID;
   int skip_same_time = FALSE;
-  char *envstr;
+  int process_timestep;
   const char *ofilename;
   double *array = NULL;
   typedef struct
@@ -60,18 +60,21 @@ void *Mergetime(void *argument)
 
   cdoInitialize(argument);
 
-  envstr = getenv("SKIP_SAME_TIME");
-  if ( envstr )
-    {
-      int ival;
-      ival = atoi(envstr);
-      if ( ival == 1 )
-	{
-	  skip_same_time = TRUE;
-	  if ( cdoVerbose )
-	    cdoPrint("Set SKIP_SAME_TIME to %d", ival);
-	}
-    }
+  {
+    char *envstr;
+    envstr = getenv("SKIP_SAME_TIME");
+    if ( envstr )
+      {
+	int ival;
+	ival = atoi(envstr);
+	if ( ival == 1 )
+	  {
+	    skip_same_time = TRUE;
+	    if ( cdoVerbose )
+	      cdoPrint("Set SKIP_SAME_TIME to %d", ival);
+	  }
+      }
+  }
 
   if ( UNCHANGED_RECORD ) lcopy = TRUE;
 
@@ -132,6 +135,8 @@ void *Mergetime(void *argument)
 
   while ( TRUE )
     {
+      process_timestep = TRUE;
+
       next_fileID = -1;
       vdate = 0;
       vtime = 0;
@@ -162,46 +167,47 @@ void *Mergetime(void *argument)
 	    time2str(vtime, vtimestr, sizeof(vtimestr));
 	    cdoPrint("Timestep %4d in stream %d (%s %s) already exists, skipped!",
 		     sf[fileID].tsID+1, sf[fileID].streamID, vdatestr, vtimestr);
-	    goto SKIP_TIMESTEP;
+	    process_timestep = FALSE;
 	  }
 
-      if ( tsID2 == 0 )
+      if ( process_timestep )
 	{
-	  vlistID1 = sf[0].vlistID;
-	  vlistID2 = vlistDuplicate(vlistID1);
-	  taxisID1 = vlistInqTaxis(vlistID1);
-	  taxisID2 = taxisDuplicate(taxisID1);
-	  vlistDefTaxis(vlistID2, taxisID2);
+	  if ( tsID2 == 0 )
+	    {
+	      vlistID1 = sf[0].vlistID;
+	      vlistID2 = vlistDuplicate(vlistID1);
+	      taxisID1 = vlistInqTaxis(vlistID1);
+	      taxisID2 = taxisDuplicate(taxisID1);
+	      vlistDefTaxis(vlistID2, taxisID2);
 	      
-	  streamDefVlist(streamID2, vlistID2);
-	}
+	      streamDefVlist(streamID2, vlistID2);
+	    }
 
-      last_vdate = vdate;
-      last_vtime = vtime;
+	  last_vdate = vdate;
+	  last_vtime = vtime;
 
-      taxisCopyTimestep(taxisID2, sf[fileID].taxisID);
+	  taxisCopyTimestep(taxisID2, sf[fileID].taxisID);
 
-      streamDefTimestep(streamID2, tsID2);
+	  streamDefTimestep(streamID2, tsID2);
 	       
-      for ( recID = 0; recID < sf[fileID].nrecs; recID++ )
-	{
-	  streamInqRecord(sf[fileID].streamID, &varID, &levelID);
-	  streamDefRecord(streamID2,  varID,  levelID);
-	  
-	  if ( lcopy )
-	    {
-	      streamCopyRecord(streamID2, sf[fileID].streamID); 
-	    }
-	  else
+	  for ( recID = 0; recID < sf[fileID].nrecs; recID++ )
 	    {
-	      streamReadRecord(sf[fileID].streamID, array, &nmiss);
-	      streamWriteRecord(streamID2, array, nmiss);
+	      streamInqRecord(sf[fileID].streamID, &varID, &levelID);
+	      streamDefRecord(streamID2,  varID,  levelID);
+	  
+	      if ( lcopy )
+		{
+		  streamCopyRecord(streamID2, sf[fileID].streamID); 
+		}
+	      else
+		{
+		  streamReadRecord(sf[fileID].streamID, array, &nmiss);
+		  streamWriteRecord(streamID2, array, nmiss);
+		}
 	    }
-	}
 
-      tsID2++;
-
-    SKIP_TIMESTEP:
+	  tsID2++;
+	}
 
       sf[fileID].nrecs = streamInqTimestep(sf[fileID].streamID, ++sf[fileID].tsID);
       if ( sf[fileID].nrecs == 0 )
diff --git a/src/Merstat.c b/src/Merstat.c
index 5955bae..aad2472 100644
--- a/src/Merstat.c
+++ b/src/Merstat.c
@@ -129,6 +129,9 @@ void *Merstat(void *argument)
   gridID1 = vlistInqVarGrid(vlistID1, 0);
   nlonmax = gridInqXsize(gridID1); /* max nlon ? */
 
+  field_init(&field1);
+  field_init(&field2);
+
   lim = vlistGridsizeMax(vlistID1);
   field1.ptr    = (double *) malloc(lim*sizeof(double));
   field1.weight = NULL;
diff --git a/src/Monarith.c b/src/Monarith.c
index 2a45f7a..4db6c00 100644
--- a/src/Monarith.c
+++ b/src/Monarith.c
@@ -69,6 +69,9 @@ void *Monarith(void *argument)
   
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field2);
+
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
diff --git a/src/Output.c b/src/Output.c
index 335457c..878a23d 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -53,7 +53,7 @@ void *Output(void *argument)
   int vlistID;
   int nmiss, nout;
   int nlon, nlat;
-  int nelem = 0;
+  int nelem = 1;
   int index;
   int ndiffgrids;
   const char *format = NULL;
@@ -94,10 +94,12 @@ void *Output(void *argument)
 
   if ( operatorID == OUTPUTF )
     {
-      operatorInputArg("format and number of elements");
-      operatorCheckArgc(2);
+      operatorInputArg("format and number of elements [optional]");
+
+      if ( operatorArgc() < 1 ) cdoAbort("Too few arguments!");
+
       format = operatorArgv()[0];
-      nelem  = atoi(operatorArgv()[1]);
+      if ( operatorArgc() == 2 ) nelem  = atoi(operatorArgv()[1]);
     }
   else if ( operatorID == OUTPUTTAB )
     {
diff --git a/src/Outputgmt.c b/src/Outputgmt.c
index 15e4911..399469a 100644
--- a/src/Outputgmt.c
+++ b/src/Outputgmt.c
@@ -30,7 +30,7 @@
     - outputvector
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" /* VERSION */
 #endif
 
@@ -840,7 +840,7 @@ void *Outputgmt(void *argument)
 	{
 	  if ( operatorID == OUTPUTVRML )
 	    printf("#VRML V2.0 utf8\n\n");
-#if defined (VERSION)
+#if defined(VERSION)
 	  fprintf(stdout, "# Generated by CDO version %s\n", VERSION);
 	  fprintf(stdout, "#\n");
 #endif
diff --git a/src/Pack.c b/src/Pack.c
index 94caef3..b4c299a 100644
--- a/src/Pack.c
+++ b/src/Pack.c
@@ -21,7 +21,7 @@
       Pack    pack         Pack
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -122,23 +122,7 @@ void *Pack(void *argument)
 
       taxisInqDTinfo(taxisID1, &dtinfo[tsID]);
 
-      vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID   = vlistInqVarGrid(vlistID1, varID);
-	  missval1 = vlistInqVarMissval(vlistID1, varID);
-	  nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-
-	  vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    {
-	      vars[tsID][varID][levelID].grid    = gridID;
-	      vars[tsID][varID][levelID].missval = missval1;
-	      vars[tsID][varID][levelID].ptr     = NULL;
-	    }
-	}
+      vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
 
       for ( recID = 0; recID < nrecs; recID++ )
 	{
@@ -271,11 +255,12 @@ void *Pack(void *argument)
 		  streamDefRecord(streamID2, varID, levelID);
 		  streamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
 		  free(vars[tsID][varID][levelID].ptr);
+		  vars[tsID][varID][levelID].ptr = NULL;
 		}
 	    }
-	  free(vars[tsID][varID]);
 	}
-      free(vars[tsID]);
+
+      field_free(vars[tsID], vlistID1);
     }
 
   if ( vars  ) free(vars);
diff --git a/src/Regres.c b/src/Regres.c
index ffb117c..7b8c9a3 100644
--- a/src/Regres.c
+++ b/src/Regres.c
@@ -40,7 +40,6 @@ void *Regres(void *argument)
   int streamID1,/* streamID2, */streamID3;
   int vlistID1, vlistID2, taxisID1, taxisID2;
   int nmiss;
-  int nvars, nlevel;
   int *recVarID, *recLevelID;
   int nwork = 5;
   double temp1, temp2;
@@ -69,7 +68,6 @@ void *Regres(void *argument)
 
   streamDefVlist(streamID3, vlistID2);
 
-  nvars    = vlistNvars(vlistID1);
   nrecords = vlistNrecs(vlistID1);
 
   recVarID   = (int *) malloc(nrecords*sizeof(int));
@@ -77,31 +75,13 @@ void *Regres(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
   for ( w = 0; w < nwork; w++ )
-    work[w] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
-      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
-
-      for ( w = 0; w < nwork; w++ )
-	work[w][varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  for ( w = 0; w < nwork; w++ )
-	    {
-	      work[w][varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
-	      for ( i = 0; i < gridsize; i++ ) work[w][varID][levelID].ptr[i] = 0;
-	    }
-	}
-    }
+    work[w] = field_calloc(vlistID1, FIELD_PTR);
 
   tsID    = 0;
   while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
@@ -185,20 +165,8 @@ void *Regres(void *argument)
       streamWriteRecord(streamID3, field2.ptr, nmiss);
     }
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  for ( w = 0; w < nwork; w++ )
-	    free(work[w][varID][levelID].ptr);
-	}
-
-      for ( w = 0; w < nwork; w++ )
-	free(work[w][varID]);
-    }
 
-  for ( w = 0; w < nwork; w++ ) free(work[w]);
+  for ( w = 0; w < nwork; w++ ) field_free(work[w], vlistID1);
 
   if ( field1.ptr ) free(field1.ptr);
   if ( field2.ptr ) free(field2.ptr);
diff --git a/src/Remap.c b/src/Remap.c
index d9fcd79..766fb83 100644
--- a/src/Remap.c
+++ b/src/Remap.c
@@ -221,7 +221,7 @@ void get_remap_env(void)
 	}
     }
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   if ( ompNumThreads == 1 )
     sort_mode = HEAP_SORT;
   else
@@ -327,8 +327,6 @@ void get_remap_env(void)
   envstr = getenv("REMAP_EXTRAPOLATE");
   if ( envstr )
     {
-      int ival;
-      ival = atoi(envstr);
       if ( *envstr )
 	{
 	  if ( memcmp(envstr, "ON", 2) == 0 || memcmp(envstr, "on", 2) == 0 )
@@ -505,7 +503,6 @@ void *Remap(void *argument)
 	   gridtype != GRID_LAEA        &&
 	   gridtype != GRID_SINUSOIDAL  &&
 	   gridtype != GRID_GME         &&
-	   gridtype != GRID_REFERENCE   &&
 	   gridtype != GRID_CURVILINEAR &&
 	   gridtype != GRID_UNSTRUCTURED )
 	{
diff --git a/src/Rhopot.c b/src/Rhopot.c
index 7291f4b..9121f2d 100644
--- a/src/Rhopot.c
+++ b/src/Rhopot.c
@@ -261,6 +261,9 @@ void *Rhopot(void *argument)
 	cdoPrint("%5d  %g", i+1, pressure[i]);
     }
 
+  field_init(&to);
+  field_init(&sao);
+  field_init(&rho);
   to.ptr = (double *) malloc(gridsize*nlevel*sizeof(double));
   sao.ptr = (double *) malloc(gridsize*nlevel*sizeof(double));
   rho.ptr = (double *) malloc(gridsize*nlevel*sizeof(double));
diff --git a/src/Runpctl.c b/src/Runpctl.c
index ae48eab..86e2164 100644
--- a/src/Runpctl.c
+++ b/src/Runpctl.c
@@ -91,25 +91,7 @@ void *Runpctl(void *argument)
   
   for ( its = 0; its < ndates; its++ )
     {
-      vars1[its] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-        {
-          gridID   = vlistInqVarGrid(vlistID1, varID);
-          gridsize = gridInqSize(gridID);
-          nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-          missval  = vlistInqVarMissval(vlistID1, varID);
-
-          vars1[its][varID] = (field_t *)  malloc(nlevels*sizeof(field_t));
-
-          for ( levelID = 0; levelID < nlevels; levelID++ )
-            {
-              vars1[its][varID][levelID].grid    = gridID;
-              vars1[its][varID][levelID].nmiss   = 0;
-              vars1[its][varID][levelID].missval = missval;
-              vars1[its][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-            }
-        }
+      vars1[its] = field_malloc(vlistID1, FIELD_PTR);
     }
 
   for ( tsID = 0; tsID < ndates; tsID++ )
@@ -223,14 +205,7 @@ void *Runpctl(void *argument)
 
   for ( its = 0; its < ndates; its++ )
     {
-      for ( varID = 0; varID < nvars; varID++ )
-        {
-          nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-          for ( levelID = 0; levelID < nlevels; levelID++ )
-            free(vars1[its][varID][levelID].ptr);
-          free(vars1[its][varID]);
-        }
-      free(vars1[its]);
+      field_free(vars1[its], vlistID1);
     }
 
   free(vars1);
diff --git a/src/Runstat.c b/src/Runstat.c
index 218d00f..8c99d3a 100644
--- a/src/Runstat.c
+++ b/src/Runstat.c
@@ -285,7 +285,7 @@ void *Runstat(void *argument)
 	      for ( i = 0; i < gridsize; i++ )
 		samp1[tsID][varID][levelID].ptr[i] = (double) imask[i];
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, inp)
 #endif
 	      for ( inp = 0; inp < tsID; inp++ )
@@ -299,7 +299,7 @@ void *Runstat(void *argument)
 	  if ( lvarstd )
 	    {
 	      farmoq(&vars2[tsID][varID][levelID], vars1[tsID][varID][levelID]);
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
 	      for ( inp = 0; inp < tsID; inp++ )
@@ -310,7 +310,7 @@ void *Runstat(void *argument)
 	    }
 	  else
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
 	      for ( inp = 0; inp < tsID; inp++ )
@@ -432,7 +432,7 @@ void *Runstat(void *argument)
 	      for ( i = 0; i < gridsize; i++ )
 		samp1[ndates-1][varID][levelID].ptr[i] = (double) imask[i];
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, inp)
 #endif
 	      for ( inp = 0; inp < ndates-1; inp++ )
@@ -446,7 +446,7 @@ void *Runstat(void *argument)
 	  if ( lvarstd )
 	    {
 	      farmoq(&vars2[ndates-1][varID][levelID], vars1[ndates-1][varID][levelID]);
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
 	      for ( inp = 0; inp < ndates-1; inp++ )
@@ -457,7 +457,7 @@ void *Runstat(void *argument)
 	    }
 	  else
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
 	      for ( inp = 0; inp < ndates-1; inp++ )
diff --git a/src/Scatter.c b/src/Scatter.c
index 1ca7f3f..9230aab 100644
--- a/src/Scatter.c
+++ b/src/Scatter.c
@@ -129,6 +129,7 @@ void *Scatter(void *argument)
   char *rstr;
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   int index;
   int nsplit;
   int xinc = 1, yinc = 1;
@@ -250,8 +251,9 @@ void *Scatter(void *argument)
   strcpy(filename, cdoStreamName(1)->args);
   nchars = strlen(filename);
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   for ( index = 0; index < nsplit; index++ )
     {
diff --git a/src/Seascount.c b/src/Seascount.c
index 0e88152..028c352 100644
--- a/src/Seascount.c
+++ b/src/Seascount.c
@@ -31,13 +31,11 @@
 
 void *Seascount(void *argument)
 {
-  int operatorID;
-  int operfunc;
   int gridsize;
   int vdate = 0, vtime = 0;
   int vdate0 = 0, vtime0 = 0;
   int nrecs, nrecords;
-  int gridID, varID, levelID, recID;
+  int varID, levelID, recID;
   int tsID;
   int otsID;
   long nsets;
@@ -45,10 +43,9 @@ void *Seascount(void *argument)
   int year, month, day, seas, seas0 = 0;
   int streamID1, streamID2;
   int vlistID1, vlistID2, taxisID1, taxisID2;
-  int nvars, nlevel;
+  int nwpv; // number of words per value; real:1  complex:2
   int *recVarID, *recLevelID;
   int newseas, oldmon = 0, newmon;
-  double missval;
   field_t **vars1 = NULL;
   field_t field;
   int season_start;
@@ -57,9 +54,6 @@ void *Seascount(void *argument)
 
   cdoOperatorAdd("seascount", 0, 0, NULL);
 
-  operatorID = cdoOperatorID();
-  operfunc = cdoOperatorF1(operatorID);
-
   season_start = get_season_start();
 
   streamID1 = streamOpenRead(cdoStreamName(0));
@@ -75,35 +69,18 @@ void *Seascount(void *argument)
 
   streamDefVlist(streamID2, vlistID2);
 
-  nvars    = vlistNvars(vlistID1);
   nrecords = vlistNrecs(vlistID1);
 
   recVarID   = (int *) malloc(nrecords*sizeof(int));
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  if ( vlistNumber(vlistID1) != CDI_REAL ) gridsize *= 2;
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
-  vars1 = (field_t **) malloc(nvars*sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
-      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
-
-      vars1[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-        {
-          vars1[varID][levelID].grid    = gridID;
-          vars1[varID][levelID].nmiss   = 0;
-          vars1[varID][levelID].missval = missval;
-          vars1[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-        }
-    }
+  vars1 = field_malloc(vlistID1, FIELD_PTR);
 
   tsID    = 0;
   otsID   = 0;
@@ -163,11 +140,12 @@ void *Seascount(void *argument)
                   recLevelID[recID] = levelID;
                 }
 
+	      nwpv     = vars1[varID][levelID].nwpv;
               gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
 
               if ( nsets == 0 )
                 {
-                  for ( i = 0; i < gridsize; i++ )
+                  for ( i = 0; i < nwpv*gridsize; i++ )
                     vars1[varID][levelID].ptr[i] = vars1[varID][levelID].missval;
 		  vars1[varID][levelID].nmiss = gridsize;
                 }
@@ -206,18 +184,7 @@ void *Seascount(void *argument)
       otsID++;
     }
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-        {
-          free(vars1[varID][levelID].ptr);
-        }
-
-      free(vars1[varID]);
-    }
-
-  free(vars1);
+  field_free(vars1, vlistID1);
 
   if ( field.ptr ) free(field.ptr);
 
diff --git a/src/Seasstat.c b/src/Seasstat.c
index 1328472..58b4b8d 100644
--- a/src/Seasstat.c
+++ b/src/Seasstat.c
@@ -44,7 +44,7 @@ void *Seasstat(void *argument)
   int vdate0 = 0, vtime0 = 0;
   int vdate1 = 0, vtime1 = 0;
   int nrecs, nrecords;
-  int gridID, varID, levelID, recID;
+  int varID, levelID, recID;
   int tsID;
   int otsID;
   long nsets;
@@ -57,7 +57,6 @@ void *Seasstat(void *argument)
   int *recVarID, *recLevelID;
   int newseas, oldmon = 0, newmon;
   int nseason = 0;
-  double missval;
   field_t **vars1 = NULL, **vars2 = NULL, **samp1 = NULL;
   field_t field;
   int season_start;
@@ -100,44 +99,13 @@ void *Seasstat(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
-  vars1 = (field_t **) malloc(nvars*sizeof(field_t *));
-  samp1 = (field_t **) malloc(nvars*sizeof(field_t *));
+  vars1 = field_malloc(vlistID1, FIELD_PTR);
+  samp1 = field_malloc(vlistID1, FIELD_NONE);
   if ( operfunc == func_std || operfunc == func_var )
-    vars2 = (field_t **) malloc(nvars*sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
-      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
-
-      vars1[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-      samp1[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-      if ( operfunc == func_std || operfunc == func_var )
-	vars2[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  vars1[varID][levelID].grid    = gridID;
-	  vars1[varID][levelID].nmiss   = 0;
-	  vars1[varID][levelID].missval = missval;
-	  vars1[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-	  samp1[varID][levelID].grid    = gridID;
-	  samp1[varID][levelID].nmiss   = 0;
-	  samp1[varID][levelID].missval = missval;
-	  samp1[varID][levelID].ptr     = NULL;
-	  if ( operfunc == func_std || operfunc == func_var )
-	    {
-	      vars2[varID][levelID].grid    = gridID;
-	      vars2[varID][levelID].nmiss   = 0;
-	      vars2[varID][levelID].missval = missval;
-	      vars2[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-	    }
-	}
-    }
+    vars2 = field_malloc(vlistID1, FIELD_PTR);
 
   tsID    = 0;
   otsID   = 0;
@@ -347,24 +315,10 @@ void *Seasstat(void *argument)
       otsID++;
     }
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  free(vars1[varID][levelID].ptr);
-	  if ( samp1[varID][levelID].ptr ) free(samp1[varID][levelID].ptr);
-	  if ( operfunc == func_std || operfunc == func_var ) free(vars2[varID][levelID].ptr);
-	}
-
-      free(vars1[varID]);
-      free(samp1[varID]);
-      if ( operfunc == func_std || operfunc == func_var ) free(vars2[varID]);
-    }
 
-  free(vars1);
-  free(samp1);
-  if ( operfunc == func_std || operfunc == func_var ) free(vars2);
+  field_free(vars1, vlistID1);
+  field_free(samp1, vlistID1);
+  if ( operfunc == func_std || operfunc == func_var ) field_free(vars2, vlistID1);
 
   if ( field.ptr ) free(field.ptr);
 
diff --git a/src/Selbox.c b/src/Selbox.c
index 08320bd..9119f58 100644
--- a/src/Selbox.c
+++ b/src/Selbox.c
@@ -896,7 +896,7 @@ void *Selbox(void *argument)
 	    if ( gridID1 == vlistInqVarGrid(vlistID1, varID) )
 	      vars[varID] = TRUE;
 	}
-      else if ( gridtype == GRID_GENERIC && gridInqXsize(gridID1) == 0 && gridInqYsize(gridID1) == 0 )
+      else if ( gridtype == GRID_GENERIC && gridInqXsize(gridID1) <= 1 && gridInqYsize(gridID1) <=1 )
 	{
 	}
       else
@@ -947,11 +947,7 @@ void *Selbox(void *argument)
 
 	  if ( vars[varID] )
 	    {
-	      if ( vlistInqVarDatatype(vlistID1, varID) == DATATYPE_CPX32 || 
-		   vlistInqVarDatatype(vlistID1, varID) == DATATYPE_CPX64 )
-		nwpv = 2;
-	      else
-		nwpv = 1;
+	      nwpv    = vlistInqNWPV(vlistID1, varID);
 	      
 	      gridID1 = vlistInqVarGrid(vlistID1, varID);
 
diff --git a/src/Select.c b/src/Select.c
index 4f8cef0..d0e6b85 100644
--- a/src/Select.c
+++ b/src/Select.c
@@ -470,6 +470,7 @@ void *Select(void *argument)
   int iparam;
   int nsel;
   int vdate, vtime;
+  int last_year = -999999999;
   int copytimestep;
   char paramstr[32];
   char varname[CDI_MAX_NAME];
@@ -486,22 +487,25 @@ void *Select(void *argument)
   int taxisID1, taxisID2 = CDI_UNDEFID;
   int ntsteps;
   int ltimsel = FALSE;
+  int second;
   int npar;
   int *vars = NULL;
   pml_t *pml;
-  PML_DEF_INT(timestep, 4096, "Timestep");
-  PML_DEF_INT(year,     1024, "Year");
-  PML_DEF_INT(month,      32, "Month");
-  PML_DEF_INT(day,        32, "Day");
-  PML_DEF_INT(hour,       24, "Hour");
-  PML_DEF_INT(minute,     60, "Minute");
-  PML_DEF_INT(code,     1024, "Code number");
-  PML_DEF_INT(ltype,    1024, "Level type");
-  PML_DEF_INT(levidx,   1024, "Level index");
-  PML_DEF_FLT(level,    1024, "Level");
-  PML_DEF_WORD(name,    1024, "Variable name");
-  PML_DEF_WORD(param,   1024, "Parameter");
-
+  PML_DEF_INT(timestep_of_year, 4096, "Timestep of year");
+  PML_DEF_INT(timestep,         4096, "Timestep");
+  PML_DEF_INT(year,             1024, "Year");
+  PML_DEF_INT(month,              32, "Month");
+  PML_DEF_INT(day,                32, "Day");
+  PML_DEF_INT(hour,               24, "Hour");
+  PML_DEF_INT(minute,             60, "Minute");
+  PML_DEF_INT(code,             1024, "Code number");
+  PML_DEF_INT(ltype,            1024, "Level type");
+  PML_DEF_INT(levidx,           1024, "Level index");
+  PML_DEF_FLT(level,            1024, "Level");
+  PML_DEF_WORD(name,            1024, "Variable name");
+  PML_DEF_WORD(param,           1024, "Parameter");
+
+  PML_INIT_INT(timestep_of_year);
   PML_INIT_INT(timestep);
   PML_INIT_INT(year);
   PML_INIT_INT(month);
@@ -535,6 +539,7 @@ void *Select(void *argument)
 
   pml = pmlNew("SELECT");
 
+  PML_ADD_INT(pml, timestep_of_year);
   PML_ADD_INT(pml, timestep);
   PML_ADD_INT(pml, year);
   PML_ADD_INT(pml, month);
@@ -552,6 +557,7 @@ void *Select(void *argument)
 
   if ( cdoVerbose ) pmlPrint(pml);
 
+  PML_NUM(pml, timestep_of_year);
   PML_NUM(pml, timestep);
   PML_NUM(pml, year);
   PML_NUM(pml, month);
@@ -704,7 +710,7 @@ void *Select(void *argument)
 	  PAR_CHECK_WORD_FLAG(name);
 	  PAR_CHECK_WORD_FLAG(param);
 
-	  if ( npar_timestep || npar_year || npar_month || npar_day || npar_hour || npar_minute ) ltimsel = TRUE;
+	  if ( npar_timestep_of_year || npar_timestep || npar_year || npar_month || npar_day || npar_hour || npar_minute ) ltimsel = TRUE;
 
 	  npar = 0;
 	  for ( varID = 0; varID < nvars; varID++ )
@@ -779,10 +785,6 @@ void *Select(void *argument)
 		vlistDefVarTsteptype(vlistID2, varID, TSTEP_INSTANT);
 	    }
 
-	  streamID2 = streamOpenWrite(cdoStreamName(nfiles), cdoFiletype());
-
-	  streamDefVlist(streamID2, vlistID2);
-
 	  if ( ! lcopy )
 	    {
 	      gridsize = vlistGridsizeMax(vlistID1);
@@ -804,17 +806,25 @@ void *Select(void *argument)
 	      copytimestep = FALSE;
 	      timestep = tsID1 + 1;
 
+	      vdate = taxisInqVdate(taxisID1);
+	      vtime = taxisInqVtime(taxisID1);
+	      cdiDecodeDate(vdate, &year, &month, &day);
+	      cdiDecodeTime(vtime, &hour, &minute, &second);
+
+	      if ( year != last_year )
+		{
+		  timestep_of_year = 0;
+		  last_year = year;
+		}
+
+	      timestep_of_year++;
+
 	      if ( npar_timestep && PAR_CHECK_INT(timestep) ) copytimestep = TRUE;
+	      if ( npar_timestep_of_year && PAR_CHECK_INT(timestep_of_year) ) copytimestep = TRUE;
 
-	      if ( !copytimestep && npar_timestep == 0 )
+	      if ( !copytimestep && npar_timestep == 0 && npar_timestep_of_year == 0 )
 		{
 		  int lyear = 0, lmonth = 0, lday = 0, lhour = 0, lminute = 0;
-		  int second;
-
-		  vdate = taxisInqVdate(taxisID1);
-		  vtime = taxisInqVtime(taxisID1);
-		  cdiDecodeDate(vdate, &year, &month, &day);
-		  cdiDecodeTime(vtime, &hour, &minute, &second);
 
 		  if ( npar_year   == 0 || (npar_year   && PAR_CHECK_INT(year))   ) lyear   = TRUE;
 		  if ( npar_month  == 0 || (npar_month  && PAR_CHECK_INT(month))  ) lmonth  = TRUE;
@@ -834,6 +844,13 @@ void *Select(void *argument)
 
 	  if ( copytimestep == TRUE )
 	    {
+	      if ( streamID2 == CDI_UNDEFID )
+		{
+		  streamID2 = streamOpenWrite(cdoStreamName(nfiles), cdoFiletype());
+
+		  streamDefVlist(streamID2, vlistID2);
+		}
+
 	      taxisCopyTimestep(taxisID2, taxisID1);
 
 	      streamDefTimestep(streamID2, tsID2);
@@ -867,6 +884,7 @@ void *Select(void *argument)
       streamClose(streamID1);
     }
 
+  PAR_CHECK_INT_FLAG(timestep_of_year);
   PAR_CHECK_INT_FLAG(timestep);
   PAR_CHECK_INT_FLAG(year);
   PAR_CHECK_INT_FLAG(month);
@@ -874,7 +892,7 @@ void *Select(void *argument)
   PAR_CHECK_INT_FLAG(hour);
   PAR_CHECK_INT_FLAG(minute);
 
-  streamClose(streamID2);
+  if ( streamID2 != CDI_UNDEFID ) streamClose(streamID2);
 
   vlistDestroy(vlistID0);
   vlistDestroy(vlistID2);
diff --git a/src/Seltime.c b/src/Seltime.c
index 96fcf1b..c761301 100644
--- a/src/Seltime.c
+++ b/src/Seltime.c
@@ -215,7 +215,6 @@ void *Seltime(void *argument)
   int nconst, lconstout = FALSE;
   int process_nts1 = FALSE, process_nts2 = FALSE;
   int *vdate_list = NULL, *vtime_list = NULL;
-  double missval;
   double *single;
   field_t ***vars = NULL;
 
@@ -357,24 +356,19 @@ void *Seltime(void *argument)
 
       for ( tsID = 0; tsID < nts1; tsID++ )
 	{
-	  vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
+	  vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
 
 	  for ( varID = 0; varID < nvars; varID++ )
 	    {
 	      if ( lnts1 || (vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT) )
 		{
 		  gridID  = vlistInqVarGrid(vlistID1, varID);
-		  missval = vlistInqVarMissval(vlistID1, varID);
 		  nlevel  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
 		  gridsize = gridInqSize(gridID);
 		  
-		  vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
 		  for ( levelID = 0; levelID < nlevel; levelID++ )
 		    {
-		      vars[tsID][varID][levelID].grid    = gridID;
-		      vars[tsID][varID][levelID].missval = missval;
-		      vars[tsID][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
+		      vars[tsID][varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
 		    }
 		}
 	    }
@@ -399,7 +393,6 @@ void *Seltime(void *argument)
       else if ( operfunc == func_date )
 	{
 	  selival = (vdate/intval)%moddat[operatorID];
-	  if ( selival < 0 ) selival = -selival;
 	}
       else if ( operfunc == func_time )
 	{
@@ -671,22 +664,7 @@ void *Seltime(void *argument)
 
   if ( lnts1 || nconst )
     {
-      for ( tsID = 0; tsID < nts1; tsID++ )
-	{
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      if ( lnts1 || (vlistInqVarTsteptype(vlistID2, varID) == TSTEP_CONSTANT) )
-		{
-		  nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID2, varID));
-		  for ( levelID = 0; levelID < nlevel; levelID++ )
-		    if ( vars[tsID][varID][levelID].ptr )
-		      free(vars[tsID][varID][levelID].ptr);
-
-		  free(vars[tsID][varID]);
-		}
-	    }
-	  free(vars[tsID]);
-	}
+      for ( tsID = 0; tsID < nts1; tsID++ ) field_free(vars[tsID], vlistID2);
 
       if ( vars  ) free(vars);
       if ( vdate_list ) free(vdate_list);
diff --git a/src/Setgrid.c b/src/Setgrid.c
index 41a3114..9801a35 100644
--- a/src/Setgrid.c
+++ b/src/Setgrid.c
@@ -33,7 +33,7 @@
 
 void *Setgrid(void *argument)
 {
-  int SETGRID, SETGRIDTYPE, SETGRIDAREA, SETGRIDMASK, UNSETGRIDMASK, SETGRIDNUMBER;
+  int SETGRID, SETGRIDTYPE, SETGRIDAREA, SETGRIDMASK, UNSETGRIDMASK, SETGRIDNUMBER, SETGRIDURI;
   int operatorID;
   int streamID1, streamID2 = CDI_UNDEFID;
   int nrecs;
@@ -49,11 +49,13 @@ void *Setgrid(void *argument)
   long areasize = 0;
   long masksize = 0;
   int lregular = 0;
+  int ldereference = 0;
   int ligme = 0;
   int number = 0, position = 0;
   int grid2_nvgp;
   int *grid2_vgpm = NULL;
   char *gridname = NULL;
+  char *griduri = NULL;
   double *gridmask = NULL;
   double *areaweight = NULL;
   double *array = NULL;
@@ -66,6 +68,7 @@ void *Setgrid(void *argument)
   SETGRIDMASK   = cdoOperatorAdd("setgridmask",   0, 0, "filename with grid mask");
   UNSETGRIDMASK = cdoOperatorAdd("unsetgridmask", 0, 0, NULL);
   SETGRIDNUMBER = cdoOperatorAdd("setgridnumber", 0, 0, "grid number and optionally grid position");
+  SETGRIDURI    = cdoOperatorAdd("setgriduri",    0, 0, "reference URI of the horizontal grid");
 
   operatorID = cdoOperatorID();
 
@@ -85,7 +88,7 @@ void *Setgrid(void *argument)
       if      ( strcmp(gridname, "curvilinear") == 0 )   gridtype = GRID_CURVILINEAR;
       else if ( strcmp(gridname, "cell") == 0 )          gridtype = GRID_UNSTRUCTURED;
       else if ( strcmp(gridname, "unstructured") == 0 )  gridtype = GRID_UNSTRUCTURED;
-      else if ( strcmp(gridname, "dereference") == 0 )   gridtype = GRID_REFERENCE;
+      else if ( strcmp(gridname, "dereference") == 0 )   ldereference = 1;
       else if ( strcmp(gridname, "lonlat") == 0 )        gridtype = GRID_LONLAT;
       else if ( strcmp(gridname, "gaussian") == 0 )      gridtype = GRID_GAUSSIAN;
       else if ( strcmp(gridname, "regular") == 0 )      {gridtype = GRID_GAUSSIAN; lregular = 1;}
@@ -175,6 +178,11 @@ void *Setgrid(void *argument)
 	  operatorCheckArgc(1);
 	}
     }
+  else if ( operatorID == SETGRIDURI )
+    {
+      operatorCheckArgc(1);
+      griduri = operatorArgv()[0];
+    }
 
   streamID1 = streamOpenRead(cdoStreamName(0));
 
@@ -203,12 +211,21 @@ void *Setgrid(void *argument)
 	}
       if ( ! found ) cdoWarning("No grid with %d points found!", gridInqSize(gridID2));
     }
-  else if ( operatorID == SETGRIDNUMBER )
+  else if ( operatorID == SETGRIDNUMBER || operatorID == SETGRIDURI )
     {
       gridID1 = vlistGrid(vlistID1, 0);
-      gridID2 = gridCreate(GRID_REFERENCE, gridInqSize(gridID1));
-      gridDefNumber(gridID2, number);
-      gridDefPosition(gridID2, position);
+
+      if ( operatorID == SETGRIDNUMBER )
+	{
+	  gridID2 = gridCreate(GRID_UNSTRUCTURED, gridInqSize(gridID1));
+	  gridDefNumber(gridID2, number);
+	  gridDefPosition(gridID2, position);
+	}
+      else
+	{
+	  gridID2 = gridDuplicate(gridID1);
+	  gridDefReference(gridID2, griduri);
+	}
 
       found = 0;
       ngrids = vlistNgrids(vlistID1);
@@ -222,7 +239,7 @@ void *Setgrid(void *argument)
 	      found++;
 	    }
 	}
-      if ( ! found ) cdoWarning("No grid with %d points found!", gridInqSize(gridID2));
+      if ( ! found ) cdoWarning("No horizontal grid with %d cells found!", gridInqSize(gridID2));
     }
   else if ( operatorID == SETGRIDTYPE )
     {
@@ -239,6 +256,11 @@ void *Setgrid(void *argument)
 		  gridID2 = gridToRegular(gridID1);
 		}
 	    }
+	  else if ( ldereference    )
+	    {
+	      gridID2 = referenceToGrid(gridID1);
+	      if ( gridID2 == -1 ) cdoAbort("Reference to horizontal grid not found!");
+	    }
 	  else
 	    {
 	      if      ( gridtype == GRID_CURVILINEAR  )
@@ -258,11 +280,6 @@ void *Setgrid(void *argument)
 		      gridCompress(gridID2);
 		    }
 		}
-	      else if ( gridtype == GRID_REFERENCE    )
-		{
-		  gridID2 = referenceToGrid(gridID1);
-		  if ( gridID2 == -1 ) cdoAbort("Grid reference not found!");
- 		}
 	      else if ( gridtype == GRID_LONLAT && gridInqType(gridID1) == GRID_CURVILINEAR )
 		{
 		  gridID2 = gridCurvilinearToRegular(gridID1);
diff --git a/src/Setmiss.c b/src/Setmiss.c
index 886dc9b..39738e9 100644
--- a/src/Setmiss.c
+++ b/src/Setmiss.c
@@ -26,11 +26,11 @@
 */
 
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if  defined  (HAVE_ISNAN) && ! defined(__cplusplus)
+#if defined(HAVE_ISNAN) && ! defined(__cplusplus)
 int isnan(const double x);
 #endif
 
@@ -80,7 +80,7 @@ void *Setmiss(void *argument)
       /*
       if ( operatorArgv()[0][0] == 'n' || operatorArgv()[0][0] == 'N' )
 	{
-#if ! defined  (HAVE_ISNAN)
+#if ! defined(HAVE_ISNAN)
 	  cdoWarning("Function >isnan< not available!");
 #endif
 	  rconst = 0.0/0.0;
@@ -162,7 +162,7 @@ void *Setmiss(void *argument)
 	    }
 	  else if ( operatorID == SETCTOMISS )
 	    {
-#if  defined  (HAVE_ISNAN)
+#if defined(HAVE_ISNAN)
 	      if ( isnan(rconst) )
 		{
 		  for ( i = 0; i < gridsize; i++ )
diff --git a/src/Setpartab.c b/src/Setpartab.c
index a90baf3..e11e946 100644
--- a/src/Setpartab.c
+++ b/src/Setpartab.c
@@ -21,13 +21,21 @@
       Setpartab  setpartab       Set parameter table
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if  defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if defined (HAVE_LIBUDUNITS2)
+#if defined(HAVE_LIBUDUNITS2) && (defined(HAVE_UDUNITS2_H) || defined(HAVE_UDUNITS2_UDUNITS2_H))
+#define HAVE_UDUNITS2
+#endif
+
+#if defined(HAVE_UDUNITS2)
+#if defined(HAVE_UDUNITS2_UDUNITS2_H)
+#  include <udunits2/udunits2.h>
+#else
 #  include <udunits2.h>
 #endif
+#endif
 
 #include <errno.h>
 #include <cdi.h>
@@ -40,12 +48,12 @@
 
 typedef enum {CODE_NUMBER, PARAMETER_ID, VARIABLE_NAME, STANDARD_NAME} pt_mode_t;
 
-#if defined (HAVE_LIBUDUNITS2)
+#if defined(HAVE_UDUNITS2)
 
 static void udunitsInitialize(void);
 static int udunitsInit = 0;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 #  include <pthread.h>
 
 static pthread_once_t  udunitsInitThread = PTHREAD_ONCE_INIT;
@@ -69,7 +77,7 @@ ut_system *ut_read = NULL;
 static
 void udunitsInitialize(void)
 {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   /* initialize global API mutex lock */
   pthread_mutex_init(&udunitsMutex, NULL);
 #endif
@@ -218,7 +226,7 @@ void defineVarUnits(var_t *vars, int vlistID2, int varID, char *units, char *nam
 	  vars[varID].changeunits = TRUE;
 	  strcpy(vars[varID].units_old, units_old);
 	  strcpy(vars[varID].units, units);
-#if defined (HAVE_LIBUDUNITS2)
+#if defined(HAVE_UDUNITS2)
 	  int status;
 	  UDUNITS_INIT();
 	  UDUNITS_LOCK();
@@ -764,7 +772,7 @@ void *Setpartab(void *argument)
 		}
 	    }
 
-#if defined (HAVE_LIBUDUNITS2)
+#if defined(HAVE_UDUNITS2)
 	  if ( vars[varID].changeunits == TRUE )
 	    {
 	      int nerr = 0;
@@ -796,7 +804,7 @@ void *Setpartab(void *argument)
   streamClose(streamID2);
   streamClose(streamID1);
 
-#if defined (HAVE_LIBUDUNITS2)
+#if defined(HAVE_UDUNITS2)
   UDUNITS_LOCK();
 
   for ( varID = 0; varID < nvars; varID++ )
diff --git a/src/Sinfo.c b/src/Sinfo.c
index 24cee62..55bf7e3 100644
--- a/src/Sinfo.c
+++ b/src/Sinfo.c
@@ -238,13 +238,13 @@ void *Sinfo(void *argument)
 	  levelsize = zaxisInqSize(zaxisID);
 	  /* zaxisInqLongname(zaxisID, longname); */
 	  zaxisName(zaxistype, longname);
-	  longname[17] = 0;
+	  longname[18] = 0;
 	  zaxisInqUnits(zaxisID, units);
 	  units[12] = 0;
 	  if ( zaxistype == ZAXIS_GENERIC && ltype != 0 )
 	    nbyte0    = fprintf(stdout, "  %4d : %-11s  (ltype=%3d) : ", vlistZaxisIndex(vlistID, zaxisID)+1, longname, ltype);
 	  else
-	    nbyte0    = fprintf(stdout, "  %4d : %-17s  %5s : ", vlistZaxisIndex(vlistID, zaxisID)+1, longname, units);
+	    nbyte0    = fprintf(stdout, "  %4d : %-18s %5s : ", vlistZaxisIndex(vlistID, zaxisID)+1, longname, units);
 	  nbyte = nbyte0;
 	  for ( levelID = 0; levelID < levelsize; levelID++ )
 	    {
@@ -262,7 +262,7 @@ void *Sinfo(void *argument)
 	    {
 	      double level1, level2;
 	      nbyte = nbyte0;
-	      nbyte0 = fprintf(stdout, "%33s : ", "bounds");
+	      fprintf(stdout, "%33s : ", "bounds");
 	      for ( levelID = 0; levelID < levelsize; levelID++ )
 		{
 		  if ( nbyte > MAXCHARS )
@@ -277,6 +277,30 @@ void *Sinfo(void *argument)
 		}
 	      fprintf(stdout, "\n");
 	    }
+
+          if ( zaxistype == ZAXIS_REFERENCE )
+            {
+              int number   = zaxisInqNumber(zaxisID);
+
+              if ( number > 0 )
+                {
+                  fprintf(stdout, "%33s : ", "zaxis");
+                  fprintf(stdout, "number = %d\n", number);
+                }
+
+              char uuidOfVGrid[17];
+              zaxisInqUUID(zaxisID, uuidOfVGrid);
+              if ( uuidOfVGrid[0] != 0 )
+                {
+                  char uuidOfVGridStr[37];
+                  uuid2str(uuidOfVGrid, uuidOfVGridStr);
+                  if ( uuidOfVGridStr[0] != 0  && strlen(uuidOfVGridStr) == 36 )
+                    {
+                      fprintf(stdout, "%33s : ", "uuid");
+                      fprintf(stdout, "%s\n", uuidOfVGridStr);
+                    }
+                }
+            }
 	}
 
       taxisID = vlistInqTaxis(vlistID);
diff --git a/src/Sort.c b/src/Sort.c
index 9a9fc29..73688e4 100644
--- a/src/Sort.c
+++ b/src/Sort.c
@@ -29,21 +29,28 @@
 
 typedef struct
 {
-  int      recID;
-  int      varID;
-  int      levelID;
-  int      code;
-  double   level;
-  char     name[CDI_MAX_NAME];
+  int        nmiss;
+  int        levelID;
+  double     level;
 }
-recinfo_t;
+levinfo_t;
+
+typedef struct
+{
+  int        varID;
+  int        nlevs;
+  int        code;
+  char       name[CDI_MAX_NAME];
+  levinfo_t *levInfo;
+}
+varinfo_t;
 
 static
-int cmpreccode(const void *s1, const void *s2)
+int cmpvarcode(const void *s1, const void *s2)
 {
   int cmp = 0;
-  recinfo_t *x = (recinfo_t *) s1;
-  recinfo_t *y = (recinfo_t *) s2;
+  varinfo_t *x = (varinfo_t *) s1;
+  varinfo_t *y = (varinfo_t *) s2;
   /*
   printf("%d %d  %d %d\n", x->code, y->code, x, y);
   */
@@ -54,14 +61,21 @@ int cmpreccode(const void *s1, const void *s2)
 }
 
 static
-int cmpreclevel(const void *s1, const void *s2)
+int cmpvarname(const void *s1, const void *s2)
+{
+  varinfo_t *x = (varinfo_t *) s1;
+  varinfo_t *y = (varinfo_t *) s2;
+
+  return (strcmp(x->name, y->name));
+}
+
+static
+int cmpvarlevel(const void *s1, const void *s2)
 {
   int cmp = 0;
-  recinfo_t *x = (recinfo_t *) s1;
-  recinfo_t *y = (recinfo_t *) s2;
-  /*
-  printf("%g %g  %d %d\n", x->level, y->level, x, y);
-  */
+  levinfo_t *x = (levinfo_t *) s1;
+  levinfo_t *y = (levinfo_t *) s2;
+
   if      ( x->level < y->level ) cmp = -1;
   else if ( x->level > y->level ) cmp =  1;
 
@@ -69,27 +83,36 @@ int cmpreclevel(const void *s1, const void *s2)
 }
 
 static
-int cmprecname(const void *s1, const void *s2)
+int cmpvarlevelrev(const void *s1, const void *s2)
 {
-  recinfo_t *x = (recinfo_t *) s1;
-  recinfo_t *y = (recinfo_t *) s2;
+  int cmp = 0;
+  levinfo_t *x = (levinfo_t *) s1;
+  levinfo_t *y = (levinfo_t *) s2;
 
-  return (strcmp(x->name, y->name));
+  if      ( x->level > y->level ) cmp = -1;
+  else if ( x->level < y->level ) cmp =  1;
+
+  return (cmp);
 }
 
 static
-int findrec(recinfo_t *recInfo[], int nrecords, int varID, int levelID)
+void setNmiss(int varID, int levelID, int nvars, varinfo_t *varInfo, int nmiss)
 {
-  int index;
+  int vindex, lindex;
+  int nlevs;
+
+  for ( vindex = 0; vindex < nvars; vindex++ )
+    if ( varInfo[vindex].varID == varID ) break;
 
-  for ( index = 0; index < nrecords; index++ )
-    if ( recInfo[index]->varID == varID && recInfo[index]->levelID == levelID )
-      break;
+  if ( vindex == nvars ) cdoAbort("Internal problem; varID not found!");
 
-  if ( index == nrecords )
-    cdoAbort("Internal problem! Record not found.");
+  nlevs = varInfo[vindex].nlevs; 
+  for ( lindex = 0; lindex < nlevs; lindex++ )
+    if ( varInfo[vindex].levInfo[lindex].levelID == levelID ) break;
 
-  return (index);
+  if ( lindex == nlevs ) cdoAbort("Internal problem; levelID not found!");
+
+  varInfo[vindex].levInfo[lindex].nmiss = nmiss;
 }
 
 
@@ -100,14 +123,14 @@ void *Sort(void *argument)
   int streamID1, streamID2;
   int nrecs;
   int tsID, recID, varID, levelID, zaxisID;
-  int nvars, nrecords, nlevel, offset, index;
+  int vindex, lindex;
+  int nvars, nlevs, offset;
   int vlistID1, vlistID2;
   int gridsize;
   int nmiss;
-  int *recNmiss;
   double *single;
   double **vardata = NULL;
-  recinfo_t **recInfo;
+  varinfo_t *varInfo;
   int taxisID1, taxisID2;
 
   cdoInitialize(argument);
@@ -139,24 +162,23 @@ void *Sort(void *argument)
 
   streamDefVlist(streamID2, vlistID2);
 
-  nvars    = vlistNvars(vlistID1);
-  nrecords = vlistNrecs(vlistID1);
-
-  recNmiss   = (int *) malloc(nrecords*sizeof(int));
+  nvars   = vlistNvars(vlistID1);
 
-  recInfo    = (recinfo_t **) malloc(nrecords*sizeof(recinfo_t *));
-  recInfo[0] = (recinfo_t *) malloc(nrecords*sizeof(recinfo_t));
-
-  for ( index = 1; index < nrecords; index++ )
-    recInfo[index] = recInfo[0] + index;
+  varInfo = (varinfo_t *) malloc(nvars*sizeof(varinfo_t));
+  for ( varID = 0; varID < nvars; ++varID )
+    {
+      nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
+      varInfo[varID].nlevs = nlevs;
+      varInfo[varID].levInfo = (levinfo_t *) malloc(nlevs*sizeof(levinfo_t));
+    }
 
   vardata = (double **) malloc(nvars*sizeof(double*));
 
   for ( varID = 0; varID < nvars; varID++ )
     {
       gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
-      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      vardata[varID] = (double *) malloc(gridsize*nlevel*sizeof(double));
+      nlevs    = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
+      vardata[varID] = (double *) malloc(gridsize*nlevs*sizeof(double));
     }
 
   tsID = 0;
@@ -172,13 +194,12 @@ void *Sort(void *argument)
 
 	  if ( tsID == 0 )
 	    {
-	      recInfo[recID]->recID   = recID;
-	      recInfo[recID]->varID   = varID;
-	      recInfo[recID]->levelID = levelID;
-	      recInfo[recID]->code    = vlistInqVarCode(vlistID1, varID);
+	      varInfo[varID].varID = varID;
+	      varInfo[varID].code  = vlistInqVarCode(vlistID1, varID);
+	      vlistInqVarName(vlistID1, varID, varInfo[varID].name);
 	      zaxisID = vlistInqVarZaxis(vlistID1, varID);
-	      recInfo[recID]->level   = zaxisInqLevel(zaxisID, levelID);
-	      vlistInqVarName(vlistID1, varID, recInfo[recID]->name);
+	      varInfo[varID].levInfo[levelID].levelID = levelID;
+	      varInfo[varID].levInfo[levelID].level   = zaxisInqLevel(zaxisID, levelID);
 	    }
 
 	  gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
@@ -187,37 +208,62 @@ void *Sort(void *argument)
 
 	  streamReadRecord(streamID1, single, &nmiss);
 
-	  index = findrec(recInfo, nrecords, varID, levelID);
-	  recNmiss[index] = nmiss;
+	  setNmiss(varID, levelID, nvars, varInfo, nmiss);
+	  // varInfo[varID].levInfo[levelID].nmiss = nmiss;
 	}
 
       if ( tsID == 0 )
 	{
+	  if ( cdoVerbose )
+	    for ( vindex = 0; vindex < nvars; vindex++ )
+	      {
+		nlevs = varInfo[vindex].nlevs;
+		for ( lindex = 0; lindex < nlevs; ++lindex )
+		  printf("sort in: %d %s %d %d %g\n",
+			 vindex, varInfo[vindex].name, varInfo[vindex].code, varInfo[vindex].nlevs, varInfo[vindex].levInfo[lindex].level);
+	      }
+
 	  if      ( operatorID == SORTCODE )
-	    qsort(recInfo[0], nrecords, sizeof(recinfo_t), cmpreccode);
+	    qsort(varInfo, nvars, sizeof(varinfo_t), cmpvarcode);
 	  else if ( operatorID == SORTNAME )
-	    qsort(recInfo[0], nrecords, sizeof(recinfo_t), cmprecname);
+	    qsort(varInfo, nvars, sizeof(varinfo_t), cmpvarname);
 	  else if ( operatorID == SORTLEVEL )
-	    qsort(recInfo[0], nrecords, sizeof(recinfo_t), cmpreclevel);
+	    {
+	      for ( vindex = 0; vindex < nvars; vindex++ )
+		{
+		  nlevs = varInfo[vindex].nlevs;
+		  qsort(varInfo[vindex].levInfo, nlevs, sizeof(levinfo_t), cmpvarlevel);
+		}
+	    }
+
+	  if ( cdoVerbose )
+	    for ( vindex = 0; vindex < nvars; vindex++ )
+	      {
+		nlevs = varInfo[vindex].nlevs;
+		for ( lindex = 0; lindex < nlevs; ++lindex )
+		  printf("sort out: %d %s %d %d %g\n",
+			 vindex, varInfo[vindex].name, varInfo[vindex].code, varInfo[vindex].nlevs, varInfo[vindex].levInfo[lindex].level);
+	      }
 	}
 
-      for ( recID = 0; recID < nrecords; recID++ )
+      for ( vindex = 0; vindex < nvars; vindex++ )
 	{
-	  /*
-	  printf("recID, recID %d %d\n", recID, recInfo[recID]->recID);
-	  */
-	  varID   = recInfo[recID]->varID;
-	  levelID = recInfo[recID]->levelID;
-	  nmiss   = recNmiss[recID];
-
-	  if ( tsID == 0 || vlistInqVarTsteptype(vlistID1, varID) != TSTEP_CONSTANT )
+	  varID = varInfo[vindex].varID;
+	  nlevs = varInfo[vindex].nlevs;
+	  for ( lindex = 0; lindex < nlevs; ++lindex )
 	    {
-	      gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
-	      offset   = gridsize*levelID;
-	      single   = vardata[varID] + offset;
-
-	      streamDefRecord(streamID2, varID, levelID);
-	      streamWriteRecord(streamID2, single, nmiss);
+	      levelID = varInfo[vindex].levInfo[lindex].levelID;
+	      nmiss   = varInfo[vindex].levInfo[lindex].nmiss;
+
+	      if ( tsID == 0 || vlistInqVarTsteptype(vlistID1, varID) != TSTEP_CONSTANT )
+		{
+		  gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
+		  offset   = gridsize*levelID;
+		  single   = vardata[varID] + offset;
+
+		  streamDefRecord(streamID2, varID, levelID);
+		  streamWriteRecord(streamID2, single, nmiss);
+		}
 	    }
 	}
 
@@ -227,15 +273,11 @@ void *Sort(void *argument)
   streamClose(streamID1);
   streamClose(streamID2);
 
-  for ( varID = 0; varID < nvars; varID++ )
-    free(vardata[varID]);
-
+  for ( varID = 0; varID < nvars; varID++ ) free(vardata[varID]);
   free(vardata);
 
-  free(recInfo[0]);
-  free(recInfo);
-
-  if ( recNmiss ) free(recNmiss);
+  for ( vindex = 0; vindex < nvars; vindex++ ) free(varInfo[vindex].levInfo);
+  free(varInfo);
 
   cdoFinish();
 
diff --git a/src/Sorttimestamp.c b/src/Sorttimestamp.c
index b63e617..28cc07f 100644
--- a/src/Sorttimestamp.c
+++ b/src/Sorttimestamp.c
@@ -67,7 +67,6 @@ void *Sorttimestamp(void *argument)
   int nmiss;
   int nvars = 0, nlevel;
   int *vdate = NULL, *vtime = NULL;
-  double missval;
   field_t ***vars = NULL;
   timeinfo_t *timeinfo;
 
@@ -114,23 +113,7 @@ void *Sorttimestamp(void *argument)
 	  vdate[xtsID] = taxisInqVdate(taxisID1);
 	  vtime[xtsID] = taxisInqVtime(taxisID1);
 
-	  vars[xtsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      gridID  = vlistInqVarGrid(vlistID1, varID);
-	      missval = vlistInqVarMissval(vlistID1, varID);
-	      nlevel  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      
-	      vars[xtsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
-	      for ( levelID = 0; levelID < nlevel; levelID++ )
-		{
-		  vars[xtsID][varID][levelID].grid    = gridID;
-		  vars[xtsID][varID][levelID].missval = missval;
-		  vars[xtsID][varID][levelID].ptr     = NULL;
-		}
-	    }
+	  vars[xtsID] = field_malloc(vlistID1, FIELD_NONE);
 
 	  for ( recID = 0; recID < nrecs; recID++ )
 	    {
@@ -171,7 +154,7 @@ void *Sorttimestamp(void *argument)
 
 
   vlistDefTaxis(vlistID2, taxisID2);
-	  
+
   streamID2 = streamOpenWrite(cdoStreamName(nfiles), cdoFiletype());
 
   streamDefVlist(streamID2, vlistID2);
@@ -204,7 +187,7 @@ void *Sorttimestamp(void *argument)
 
       for ( varID = 0; varID < nvars; varID++ )
 	{
-	  nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
+	  nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID2, varID));
 	  for ( levelID = 0; levelID < nlevel; levelID++ )
 	    {
 	      if ( vars[xtsID][varID][levelID].ptr )
@@ -212,12 +195,11 @@ void *Sorttimestamp(void *argument)
 		  nmiss = vars[xtsID][varID][levelID].nmiss;
 		  streamDefRecord(streamID2, varID, levelID);
 		  streamWriteRecord(streamID2, vars[xtsID][varID][levelID].ptr, nmiss);
-		  free(vars[xtsID][varID][levelID].ptr);
 		}
 	    }
-	  free(vars[xtsID][varID]);
 	}
-      free(vars[xtsID]);      
+
+      field_free(vars[xtsID], vlistID2);      
     }
 
   if ( vars  ) free(vars);
diff --git a/src/Spectral.c b/src/Spectral.c
index 4f58092..cca8732 100644
--- a/src/Spectral.c
+++ b/src/Spectral.c
@@ -26,6 +26,8 @@
       Spectral   spcut           Cut spectral wave number
 */
 
+#include <ctype.h>
+
 #include <cdi.h>
 #include "cdo.h"
 #include "cdo_int.h"
@@ -105,6 +107,8 @@ void *Spectral(void *argument)
   /* define output grid */
   if ( operatorID == GP2SP || operatorID == GP2SPL )
     {
+      if ( gridIDgp == -1 ) cdoWarning("No data on Gaussian grid found!");
+
       gridID1 = gridIDgp;
 
       if ( gridID1 != -1 )
@@ -123,20 +127,20 @@ void *Spectral(void *argument)
 	      gridDefTrunc(gridIDsp, ntr);
 	      gridDefComplexPacking(gridIDsp, 1);
 	    }
-	}
 
-      if ( gridIDsp == -1 && gridInqType(vlistGrid(vlistID1, 0)) == GRID_GAUSSIAN_REDUCED )
-	cdoAbort("Gaussian reduced grid found. Use option -R to convert it to a regular grid!");
+	  if ( gridIDsp == -1 && gridInqType(vlistGrid(vlistID1, 0)) == GRID_GAUSSIAN_REDUCED )
+	    cdoAbort("Gaussian reduced grid found. Use option -R to convert it to a regular grid!");
 
-      if ( gridIDsp == -1 ) cdoAbort("No Gaussian grid data found!");
+	  if ( gridIDsp == -1 ) cdoAbort("Computation of spherical harmonics failed!");
 
-      gridID2 = gridIDsp;
+	  gridID2 = gridIDsp;
 
-      nlon = gridInqXsize(gridID1);
-      nlat = gridInqYsize(gridID1);
-      ntr  = gridInqTrunc(gridID2);
+	  nlon = gridInqXsize(gridID1);
+	  nlat = gridInqYsize(gridID1);
+	  ntr  = gridInqTrunc(gridID2);
 
-      sptrans = sptrans_new(nlon, nlat, ntr, 0);
+	  sptrans = sptrans_new(nlon, nlat, ntr, 0);
+	}
     }
   else if ( operatorID == SP2GP || operatorID == SP2GPL )
     {   
@@ -183,6 +187,7 @@ void *Spectral(void *argument)
       operatorInputArg("truncation");
       if ( gridID1 != -1 )
 	{
+	  if ( !isdigit(operatorArgv()[0][0]) ) cdoAbort("parameter truncation must comprise only digits [0-9]!");
 	  int ntr = atoi(operatorArgv()[0]);
 	  int nsp = (ntr+1)*(ntr+2);
 	  gridIDsp = gridCreate(GRID_SPECTRAL, nsp);
diff --git a/src/Spectrum.c b/src/Spectrum.c
index 0162e19..1907bd9 100644
--- a/src/Spectrum.c
+++ b/src/Spectrum.c
@@ -165,7 +165,6 @@ void *Spectrum(void *argument)
   int *vdate = NULL, *vtime = NULL;
   int freq, nfreq;
   int seg_l, seg_n, detrend, which_window;
-  double missval;
   double wssum;
   double *array1, *array2;
   double *real, *imag, *window;
@@ -203,23 +202,7 @@ void *Spectrum(void *argument)
       vdate[tsID] = taxisInqVdate(taxisID1);
       vtime[tsID] = taxisInqVtime(taxisID1);
 
-      vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID   = vlistInqVarGrid(vlistID1, varID);
-	  missval  = vlistInqVarMissval(vlistID1, varID);
-	  nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-
-	  vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    {
-	      vars[tsID][varID][levelID].grid    = gridID;
-	      vars[tsID][varID][levelID].missval = missval;
-	      vars[tsID][varID][levelID].ptr     = NULL;
-	    }
-	}
+      vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
 
       for ( recID = 0; recID < nrecs; recID++ )
 	{
@@ -270,30 +253,9 @@ void *Spectrum(void *argument)
 
   vars2 = (field_t ***) malloc(nfreq*sizeof(field_t **));
   for ( freq = 0; freq < nfreq; freq++ )
-    {
-      vars2[freq] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID   = vlistInqVarGrid(vlistID1, varID);
-	  gridsize = gridInqSize(gridID);
-	  missval  = vlistInqVarMissval(vlistID1, varID);
-	  nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      
-	  vars2[freq][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-      
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    {
-	      vars2[freq][varID][levelID].grid    = gridID;
-	      vars2[freq][varID][levelID].missval = missval;
-	      vars2[freq][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-	    }
-	}
-    }
-
-
-  array1  = (double *) malloc(nts*sizeof(double));
+    vars2[freq] = field_malloc(vlistID1, FIELD_PTR);
 
+  array1  = (double *) malloc(nts   * sizeof(double));
   array2  = (double *) malloc(nfreq * sizeof(double));
   real    = (double *) malloc(seg_l * sizeof(double));
   imag    = (double *) malloc(seg_l * sizeof(double));
@@ -334,7 +296,6 @@ void *Spectrum(void *argument)
   for ( varID = 0; varID < nvars; varID++ )
     {
       gridID   = vlistInqVarGrid(vlistID1, varID);
-      missval  = vlistInqVarMissval(vlistID1, varID);
       gridsize = gridInqSize(gridID);
       nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
       for ( levelID = 0; levelID < nlevel; levelID++ )
@@ -357,19 +318,7 @@ void *Spectrum(void *argument)
   if ( array1 ) free(array1);
   if ( array2 ) free(array2);
 
-  for ( tsID = 0; tsID < nts; tsID++ )
-    {
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    if ( vars[tsID][varID][levelID].ptr )
-	      free(vars[tsID][varID][levelID].ptr);
-
-	  free(vars[tsID][varID]);
-	}
-      free(vars[tsID]);
-    }
+  for ( tsID = 0; tsID < nts; tsID++ ) field_free(vars[tsID], vlistID1);
 
   for ( tsID = 0; tsID < nfreq; tsID++ )
     {
@@ -387,12 +336,11 @@ void *Spectrum(void *argument)
 		  nmiss = vars2[tsID][varID][levelID].nmiss;
 		  streamDefRecord(streamID2, varID, levelID);
 		  streamWriteRecord(streamID2, vars2[tsID][varID][levelID].ptr, 0);
-		  free(vars2[tsID][varID][levelID].ptr);
 		}
 	    }
-	  free(vars2[tsID][varID]);
 	}
-      free(vars2[tsID]);
+
+      field_free(vars2[tsID], vlistID1);
     }
 
   if ( vars  ) free(vars);
diff --git a/src/Split.c b/src/Split.c
index 5acb176..dfb5fbd 100644
--- a/src/Split.c
+++ b/src/Split.c
@@ -59,6 +59,7 @@ void *Split(void *argument)
   double ftmp[999];
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   int nsplit = 0;
   int index;
   int i;
@@ -101,9 +102,10 @@ void *Split(void *argument)
       nchars = strlen(filename);
     }
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
-
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
+  
   if ( operatorID == SPLITCODE )
     {
       int *codes = NULL;
diff --git a/src/Splitrec.c b/src/Splitrec.c
index cf2b1e7..ca4e169 100644
--- a/src/Splitrec.c
+++ b/src/Splitrec.c
@@ -38,6 +38,7 @@ void *Splitrec(void *argument)
   int vlistID1, vlistID2;
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   int index;
   int lcopy = FALSE;
   int gridsize;
@@ -57,8 +58,9 @@ void *Splitrec(void *argument)
   strcpy(filename, cdoStreamName(1)->args);
   nchars = strlen(filename);
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   if ( ! lcopy )
     {
diff --git a/src/Splitsel.c b/src/Splitsel.c
index 4da1476..537a28d 100644
--- a/src/Splitsel.c
+++ b/src/Splitsel.c
@@ -29,10 +29,8 @@
 
 void *Splitsel(void *argument)
 {
-  int operatorID;
-  int operfunc;
   int gridsize;
-  int vdate = 0, vtime = 0;
+  //int vdate = 0, vtime = 0;
   int nrecs = 0;
   int varID, levelID, recID;
   int tsID, tsID2;
@@ -52,6 +50,7 @@ void *Splitsel(void *argument)
   int nchars;
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   int index = 0;
   int lcopy = FALSE;
   double *array = NULL;
@@ -61,9 +60,6 @@ void *Splitsel(void *argument)
 
   cdoOperatorAdd("splitsel",  0,  0, NULL);
 
-  operatorID = cdoOperatorID();
-  operfunc = cdoOperatorF1(operatorID);
-
   if ( UNCHANGED_RECORD ) lcopy = TRUE;
 
   /*  operatorInputArg("nsets <noffset <nskip>>"); */
@@ -97,8 +93,9 @@ void *Splitsel(void *argument)
   strcpy(filename, cdoStreamName(1)->args);
   nchars = strlen(filename);
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   //  if ( ! lcopy )
     {
@@ -128,6 +125,7 @@ void *Splitsel(void *argument)
 
 	      for ( levelID = 0; levelID < nlevel; levelID++ )
 		{
+		  field_init(&vars[varID][levelID]);
 		  vars[varID][levelID].grid    = gridID;
 		  vars[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 		}
@@ -176,9 +174,11 @@ void *Splitsel(void *argument)
 	  nrecs = streamInqTimestep(streamID1, tsID);
 	  if ( nrecs == 0 ) break;
 
+	  /*
 	  vdate = taxisInqVdate(taxisID1);
 	  vtime = taxisInqVtime(taxisID1);
-	  /* printf("vdate: %d vtime: %d\n", vdate, vtime); */
+	  printf("vdate: %d vtime: %d\n", vdate, vtime);
+	   */
 
 	  taxisCopyTimestep(taxisID2, taxisID1);
 	  streamDefTimestep(streamID2, tsID2);
diff --git a/src/Splittime.c b/src/Splittime.c
index 4d9bdfc..a8539fc 100644
--- a/src/Splittime.c
+++ b/src/Splittime.c
@@ -30,9 +30,29 @@
 #include "pstream.h"
 #include "util.h"
 
+#include <time.h>
 
 #define  MAX_STREAMS 32
 
+struct tm datetime_to_tm(int date, int time)
+{
+  int year, month, day, hour, minute, second;
+  cdiDecodeDate(date, &year, &month, &day);
+  cdiDecodeTime(time, &hour, &minute, &second);
+
+  struct tm stime;
+  memset(&stime, 0, sizeof(struct tm));
+
+  stime.tm_sec  = second;
+  stime.tm_min  = minute;
+  stime.tm_hour = hour;
+  stime.tm_mday = day;
+  stime.tm_mon  = month-1;
+  stime.tm_year = year-1900;
+
+  return stime;
+}
+
 void *Splittime(void *argument)
 {
   int SPLITHOUR, SPLITDAY, SPLITMON, SPLITSEAS;
@@ -47,6 +67,7 @@ void *Splittime(void *argument)
   int  streamIDs[MAX_STREAMS], tsIDs[MAX_STREAMS];
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   int index = 0;
   int i;
   int taxisID1, taxisID2;
@@ -61,6 +82,7 @@ void *Splittime(void *argument)
   field_t **vars = NULL;
   int season_start;
   const char *seas_name[4];
+  const char *format = NULL;
 
   cdoInitialize(argument);
 
@@ -75,6 +97,11 @@ void *Splittime(void *argument)
 
   if ( UNCHANGED_RECORD ) lcopy = TRUE;
 
+  if ( operatorID == SPLITMON )
+    {
+      if ( operatorArgc() == 1 ) format = operatorArgv()[0];
+    }
+
   season_start = get_season_start();
   get_season_name(seas_name);
 
@@ -93,8 +120,9 @@ void *Splittime(void *argument)
   strcpy(filename, cdoStreamName(1)->args);
   nchars = strlen(filename);
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   //  if ( ! lcopy )
     {
@@ -124,6 +152,7 @@ void *Splittime(void *argument)
 
 	      for ( levelID = 0; levelID < nlevel; levelID++ )
 		{
+		  field_init(&vars[varID][levelID]);
 		  vars[varID][levelID].grid    = gridID;
 		  vars[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 		}
@@ -185,9 +214,22 @@ void *Splittime(void *argument)
 	    }
 	  else
 	    {
-	      sprintf(filename+nchars, "%02d", index);
+	      size_t slen;
+	      char oformat[32];
+	      strcpy(oformat, "%02d");
+
+	      if ( operatorID == SPLITMON && format )
+		{
+		  char sbuf[32];
+		  struct tm stime = datetime_to_tm(vdate, vtime);
+		  slen = strftime(sbuf, 32, format, &stime);
+
+		  if ( slen ) strcpy(oformat, sbuf);
+		}
+
+	      slen = sprintf(filename+nchars, oformat, index);
 	      if ( filesuffix[0] )
-		sprintf(filename+nchars+2, "%s", filesuffix);
+		sprintf(filename+nchars+slen, "%s", filesuffix);
 	    }
 
 	  if ( cdoVerbose ) cdoPrint("create file %s", filename);
diff --git a/src/Splityear.c b/src/Splityear.c
index a5c8eb3..ba190e6 100644
--- a/src/Splityear.c
+++ b/src/Splityear.c
@@ -39,6 +39,7 @@ void *Splityear(void *argument)
   int vlistID1, vlistID2;
   char filesuffix[32];
   char filename[8192];
+  const char *refname;
   int vdate;
   int day;
   int year1, year2;
@@ -65,8 +66,9 @@ void *Splityear(void *argument)
   strcpy(filename, cdoStreamName(1)->args);
   nchars = strlen(filename);
 
+  refname = cdoStreamName(0)->argv[cdoStreamName(0)->argc-1];
   filesuffix[0] = 0;
-  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), cdoDefaultFileType, vlistID1);
+  cdoGenFileSuffix(filesuffix, sizeof(filesuffix), streamInqFiletype(streamID1), vlistID1, refname);
 
   if ( ! lcopy )
     {
diff --git a/src/Subtrend.c b/src/Subtrend.c
index 150f0e2..4871141 100644
--- a/src/Subtrend.c
+++ b/src/Subtrend.c
@@ -31,14 +31,13 @@
 void *Subtrend(void *argument)
 {
   int gridsize;
-  int nrecs, nrecords;
+  int nrecs;
   int gridID, varID, levelID, recID;
   int tsID;
   int i;
   int streamID1, streamID2, streamID3, streamID4;
   int vlistID1, vlistID2, vlistID3, vlistID4, taxisID1, taxisID4;
   int nmiss;
-  int nvars, nlevel;
   double missval, missval1, missval2;
   field_t **vars2, **vars3;
   field_t field1, field4;
@@ -65,34 +64,15 @@ void *Subtrend(void *argument)
 
   streamDefVlist(streamID4, vlistID4);
 
-
-  nvars    = vlistNvars(vlistID1);
-  nrecords = vlistNrecs(vlistID1);
-
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field4);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field4.ptr = (double *) malloc(gridsize*sizeof(double));
 
-  vars2 = (field_t **) malloc(nvars*sizeof(field_t *));
-  vars3 = (field_t **) malloc(nvars*sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
-      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
-
-      vars2[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-      vars3[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  vars2[varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
-	  vars3[varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
-	}
-    }
+  vars2 = field_malloc(vlistID1, FIELD_PTR);
+  vars3 = field_malloc(vlistID1, FIELD_PTR);
 
 
   tsID = 0;
@@ -146,21 +126,8 @@ void *Subtrend(void *argument)
       tsID++;
     }
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  free(vars2[varID][levelID].ptr);
-	  free(vars3[varID][levelID].ptr);
-	}
-
-      free(vars2[varID]);
-      free(vars3[varID]);
-    }
-
-  free(vars2);
-  free(vars3);
+  field_free(vars2, vlistID1);
+  field_free(vars3, vlistID1);
 
   if ( field1.ptr ) free(field1.ptr);
   if ( field4.ptr ) free(field4.ptr);
diff --git a/src/Timcount.c b/src/Timcount.c
index fbfa16a..c31ec47 100644
--- a/src/Timcount.c
+++ b/src/Timcount.c
@@ -41,16 +41,16 @@ void *Timcount(void *argument)
   int vdate = 0, vtime = 0;
   int vdate0 = 0, vtime0 = 0;
   int nrecs, nrecords;
-  int gridID, varID, levelID, recID;
+  int varID, levelID, recID;
   int tsID;
   int otsID;
   long nsets;
   int i;
   int streamID1, streamID2;
   int vlistID1, vlistID2, taxisID1, taxisID2;
-  int nvars, nlevel;
+  int nvars;
+  int nwpv; // number of words per value; real:1  complex:2
   int *recVarID, *recLevelID;
-  double missval;
   field_t **vars1 = NULL;
   field_t field;
 
@@ -90,28 +90,12 @@ void *Timcount(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  if ( vlistNumber(vlistID1) != CDI_REAL ) gridsize *= 2;
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
-  vars1 = (field_t **) malloc(nvars*sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
-      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
-
-      vars1[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  vars1[varID][levelID].grid    = gridID;
-	  vars1[varID][levelID].nmiss   = 0;
-	  vars1[varID][levelID].missval = missval;
-	  vars1[varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-	}
-    }
+  vars1 = field_malloc(vlistID1, FIELD_PTR);
 
   tsID    = 0;
   otsID   = 0;
@@ -138,11 +122,12 @@ void *Timcount(void *argument)
 		  recLevelID[recID] = levelID;
 		}
 
-	      gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
+	      nwpv     = vars1[varID][levelID].nwpv;
+	      gridsize = gridInqSize(vars1[varID][levelID].grid);
 
 	      if ( nsets == 0 )
 		{
-		  for ( i = 0; i < gridsize; i++ )
+		  for ( i = 0; i < nwpv*gridsize; i++ )
 		    vars1[varID][levelID].ptr[i] = vars1[varID][levelID].missval;
 		  vars1[varID][levelID].nmiss = gridsize;
 		}
@@ -181,18 +166,7 @@ void *Timcount(void *argument)
       otsID++;
     }
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  free(vars1[varID][levelID].ptr);
-	}
-
-      free(vars1[varID]);
-    }
-
-  free(vars1);
+  field_free(vars1, vlistID1);
 
   if ( field.ptr ) free(field.ptr);
 
diff --git a/src/Timpctl.c b/src/Timpctl.c
index b96c228..c912f94 100644
--- a/src/Timpctl.c
+++ b/src/Timpctl.c
@@ -53,7 +53,6 @@ void timpctl(int operatorID)
   int nmiss;
   int nvars, nlevels;
   int *recVarID, *recLevelID;
-  double missval;
   field_t **vars1 = NULL;
   field_t field;
   double pn;
@@ -101,28 +100,18 @@ void timpctl(int operatorID)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize * sizeof(double));
 
-  vars1 = (field_t **) malloc(nvars * sizeof(field_t *));
+  vars1 = field_malloc(vlistID1, FIELD_PTR);
   hset = hsetCreate(nvars);
   
   for ( varID = 0; varID < nvars; varID++ )
     {
       gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
       nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
 
-      vars1[varID] = (field_t *) malloc(nlevels*sizeof(field_t));
       hsetCreateVarLevels(hset, varID, nlevels, gridID);
-
-      for ( levelID = 0; levelID < nlevels; levelID++ )
-        {
-          vars1[varID][levelID].grid    = gridID;
-          vars1[varID][levelID].nmiss   = 0;
-          vars1[varID][levelID].missval = missval;
-          vars1[varID][levelID].ptr     = (double *) malloc(gridsize * sizeof(double));
-        } 
     }
 
   tsID    = 0;
@@ -227,15 +216,7 @@ void timpctl(int operatorID)
       otsID++;
     }
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevels; levelID++ )
-	free(vars1[varID][levelID].ptr);
-      free(vars1[varID]);
-    }
-
-  free(vars1);
+  field_free(vars1, vlistID1);
   hsetDestroy(hset);
   
   if ( field.ptr ) free(field.ptr);
diff --git a/src/Timselpctl.c b/src/Timselpctl.c
index 8ffd9ea..34c0d90 100644
--- a/src/Timselpctl.c
+++ b/src/Timselpctl.c
@@ -48,7 +48,6 @@ void *Timselpctl(void *argument)
   int nvars, nlevels;
   int ndates = 0, noffset = 0, nskip = 0, nargc;
   int *recVarID, *recLevelID;
-  double missval;
   field_t **vars1 = NULL;
   field_t field;
   double pn;
@@ -106,28 +105,18 @@ void *Timselpctl(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize * sizeof(double));
 
-  vars1 = (field_t **) malloc(nvars * sizeof(field_t *));
+  vars1 = field_malloc(vlistID1, FIELD_PTR);
   hset = hsetCreate(nvars);
 
   for ( varID = 0; varID < nvars; varID++ )
     {
       gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
       nlevels   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
 
-      vars1[varID] = (field_t *)  malloc(nlevels * sizeof(field_t));
       hsetCreateVarLevels(hset, varID, nlevels, gridID);
-
-      for ( levelID = 0; levelID < nlevels; levelID++ )
-	{
-	  vars1[varID][levelID].grid    = gridID;
-	  vars1[varID][levelID].nmiss   = 0;
-	  vars1[varID][levelID].missval = missval;
-	  vars1[varID][levelID].ptr     = (double *) malloc(gridsize * sizeof(double));
-	}
     }
 
   for ( tsID = 0; tsID < noffset; tsID++ )
@@ -262,15 +251,7 @@ void *Timselpctl(void *argument)
 
  LABEL_END:
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevels; levelID++ )
-	free(vars1[varID][levelID].ptr);
-      free(vars1[varID]);
-    }
-
-  free(vars1);
+  field_free(vars1, vlistID1);
   hsetDestroy(hset);
 
   if ( field.ptr ) free(field.ptr);
diff --git a/src/Timselstat.c b/src/Timselstat.c
index acd23e1..a875f14 100644
--- a/src/Timselstat.c
+++ b/src/Timselstat.c
@@ -115,6 +115,7 @@ void *Timselstat(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   vars1 = field_malloc(vlistID1, FIELD_PTR);
diff --git a/src/Timsort.c b/src/Timsort.c
index 26c0628..8dcf70d 100644
--- a/src/Timsort.c
+++ b/src/Timsort.c
@@ -22,7 +22,7 @@
 */
 
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -65,7 +65,6 @@ void *Timsort(void *argument)
   int nvars, nlevel;
   int *vdate = NULL, *vtime = NULL;
   int ompthID;
-  double missval;
   double **sarray = NULL;
   field_t ***vars = NULL;
 
@@ -100,23 +99,7 @@ void *Timsort(void *argument)
       vdate[tsID] = taxisInqVdate(taxisID1);
       vtime[tsID] = taxisInqVtime(taxisID1);
 
-      vars[tsID] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID  = vlistInqVarGrid(vlistID1, varID);
-	  missval = vlistInqVarMissval(vlistID1, varID);
-	  nlevel  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-
-	  vars[tsID][varID] = (field_t *) malloc(nlevel*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevel; levelID++ )
-	    {
-	      vars[tsID][varID][levelID].grid    = gridID;
-	      vars[tsID][varID][levelID].missval = missval;
-	      vars[tsID][varID][levelID].ptr     = NULL;
-	    }
-	}
+      vars[tsID] = field_malloc(vlistID1, FIELD_NONE);
 
       for ( recID = 0; recID < nrecs; recID++ )
 	{
@@ -146,12 +129,12 @@ void *Timsort(void *argument)
       nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
       for ( levelID = 0; levelID < nlevel; levelID++ )
 	{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, ompthID, tsID)
 #endif
 	  for ( i = 0; i < gridsize; i++ )
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 	      ompthID = omp_get_thread_num();
 #else
 	      ompthID = 0;
@@ -188,12 +171,11 @@ void *Timsort(void *argument)
 		  nmiss = vars[tsID][varID][levelID].nmiss;
 		  streamDefRecord(streamID2, varID, levelID);
 		  streamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
-		  free(vars[tsID][varID][levelID].ptr);
 		}
 	    }
-	  free(vars[tsID][varID]);
 	}
-      free(vars[tsID]);      
+
+      field_free(vars[tsID], vlistID1);      
     }
 
   if ( vars  ) free(vars);
diff --git a/src/Timstat.c b/src/Timstat.c
index a015944..a6700ae 100644
--- a/src/Timstat.c
+++ b/src/Timstat.c
@@ -97,6 +97,7 @@ void *Timstat(void *argument)
   int taxis_has_bounds = FALSE;
   int lvfrac = FALSE;
   int lmean = FALSE, lvarstd = FALSE, lstd = FALSE;
+  int nwpv; // number of words per value; real:1  complex:2
   char vdatestr[32], vtimestr[32];
   double vfrac = 1;
   double divisor;
@@ -228,7 +229,9 @@ void *Timstat(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  if ( vlistNumber(vlistID1) != CDI_REAL ) gridsize *= 2;
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   vars1 = field_malloc(vlistID1, FIELD_PTR);
@@ -278,7 +281,8 @@ void *Timstat(void *argument)
 		  recLevelID[recID] = levelID;
 		}
 
-	      gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
+	      nwpv     = vars1[varID][levelID].nwpv;
+	      gridsize = gridInqSize(vars1[varID][levelID].grid);
 
 	      if ( nsets == 0 )
 		{
@@ -288,9 +292,9 @@ void *Timstat(void *argument)
 		  if ( nmiss > 0 || samp1[varID][levelID].ptr )
 		    {
 		      if ( samp1[varID][levelID].ptr == NULL )
-			samp1[varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
+			samp1[varID][levelID].ptr = (double *) malloc(nwpv*gridsize*sizeof(double));
 
-		      for ( i = 0; i < gridsize; i++ )
+		      for ( i = 0; i < nwpv*gridsize; i++ )
 			if ( DBL_IS_EQUAL(vars1[varID][levelID].ptr[i], vars1[varID][levelID].missval) )
 			  samp1[varID][levelID].ptr[i] = 0;
 			else
@@ -307,12 +311,12 @@ void *Timstat(void *argument)
 		    {
 		      if ( samp1[varID][levelID].ptr == NULL )
 			{
-			  samp1[varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
-			  for ( i = 0; i < gridsize; i++ )
+			  samp1[varID][levelID].ptr = (double *) malloc(nwpv*gridsize*sizeof(double));
+			  for ( i = 0; i < nwpv*gridsize; i++ )
 			    samp1[varID][levelID].ptr[i] = nsets;
 			}
 
-		      for ( i = 0; i < gridsize; i++ )
+		      for ( i = 0; i < nwpv*gridsize; i++ )
 			if ( !DBL_IS_EQUAL(field.ptr[i], vars1[varID][levelID].missval) )
 			  samp1[varID][levelID].ptr[i]++;
 		    }
@@ -394,7 +398,8 @@ void *Timstat(void *argument)
 	for ( varID = 0; varID < nvars; varID++ )
 	  {
 	    if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
-	    gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
+	    nwpv     = vars1[varID][levelID].nwpv;
+	    gridsize = gridInqSize(vars1[varID][levelID].grid);
 	    nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
 	    for ( levelID = 0; levelID < nlevel; levelID++ )
 	      {
@@ -402,7 +407,7 @@ void *Timstat(void *argument)
 		if ( samp1[varID][levelID].ptr )
 		  {
 		    int irun = 0;
-		    for ( i = 0; i < gridsize; ++i )
+		    for ( i = 0; i < nwpv*gridsize; ++i )
 		      {
 			if ( (samp1[varID][levelID].ptr[i] / nsets) < vfrac )
 			  {
@@ -414,7 +419,7 @@ void *Timstat(void *argument)
 		    if ( irun )
 		      {
 			nmiss = 0;
-			for ( i = 0; i < gridsize; ++i )
+			for ( i = 0; i < nwpv*gridsize; ++i )
 			  if ( DBL_IS_EQUAL(vars1[varID][levelID].ptr[i], missval) ) nmiss++;
 			vars1[varID][levelID].nmiss = nmiss;
 		      }
diff --git a/src/Timstat3.c b/src/Timstat3.c
index 0053356..fb1460d 100644
--- a/src/Timstat3.c
+++ b/src/Timstat3.c
@@ -113,11 +113,17 @@ void *Timstat3(void *argument)
   for ( i = 0; i < NIN; ++i ) reached_eof[i] = 0;
 
   for ( i = 0; i < NIN; ++i )
-    in[i].ptr = (double *) malloc(gridsize*sizeof(double));
-  				 
+    {
+      field_init(&in[i]);
+      in[i].ptr = (double *) malloc(gridsize*sizeof(double));
+    }
+				 
   for ( i = 0; i < NOUT; ++i )
-    out[i].ptr = (double *) malloc(gridsize*sizeof(double));
-  				 
+    {
+      field_init(&out[i]);
+      out[i].ptr = (double *) malloc(gridsize*sizeof(double));
+    }
+				 
   for ( iw = 0; iw < NFWORK; ++iw )
     fwork[iw] = (field_t **) malloc(nvars*sizeof(field_t *));
   for ( iw = 0; iw < NIWORK; ++iw )
@@ -140,6 +146,7 @@ void *Timstat3(void *argument)
 	{
 	  for ( iw = 0; iw < NFWORK; ++iw )
 	    {
+	      field_init(&fwork[iw][varID][levelID]);
 	      fwork[iw][varID][levelID].grid    = gridID;
 	      fwork[iw][varID][levelID].nmiss   = 0;
 	      fwork[iw][varID][levelID].missval = missval;
diff --git a/src/Trend.c b/src/Trend.c
index 7aef5b7..3226c2b 100644
--- a/src/Trend.c
+++ b/src/Trend.c
@@ -39,7 +39,7 @@ void *Trend(void *argument)
   int streamID1, streamID2, streamID3;
   int vlistID1, vlistID2, taxisID1, taxisID2;
   int nmiss;
-  int nvars, nlevel;
+  int nvars;
   int *recVarID, *recLevelID;
   int nwork = 5;
   double zj;
@@ -78,31 +78,14 @@ void *Trend(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field2);
+
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
   for ( w = 0; w < nwork; w++ )
-    work[w] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(vlistID1, varID);
-      gridsize = gridInqSize(gridID);
-      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      missval  = vlistInqVarMissval(vlistID1, varID);
-
-      for ( w = 0; w < nwork; w++ )
-	work[w][varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  for ( w = 0; w < nwork; w++ )
-	    {
-	      work[w][varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
-	      for ( i = 0; i < gridsize; i++ ) work[w][varID][levelID].ptr[i] = 0;
-	    }
-	}
-    }
+    work[w] = field_calloc(vlistID1, FIELD_PTR);
 
   tsID = 0;
   while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
@@ -187,20 +170,8 @@ void *Trend(void *argument)
       streamWriteRecord(streamID3, field2.ptr, nmiss);
     }
 
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-      for ( levelID = 0; levelID < nlevel; levelID++ )
-	{
-	  for ( w = 0; w < nwork; w++ )
-	    free(work[w][varID][levelID].ptr);
-	}
-
-      for ( w = 0; w < nwork; w++ )
-	free(work[w][varID]);
-    }
 
-  for ( w = 0; w < nwork; w++ ) free(work[w]);
+  for ( w = 0; w < nwork; w++ ) field_free(work[w], vlistID1);
 
   if ( field1.ptr ) free(field1.ptr);
   if ( field2.ptr ) free(field2.ptr);
diff --git a/src/Trms.c b/src/Trms.c
index 019d4e8..6f47ff0 100644
--- a/src/Trms.c
+++ b/src/Trms.c
@@ -184,6 +184,10 @@ void *Trms(void *argument)
       vardata2[varID] = (double *) malloc(gridsize*nlevel*sizeof(double));
     }
 
+  field_init(&field1);
+  field_init(&field2);
+  field_init(&field3);
+
   lim = vlistGridsizeMax(vlistID1);
   field1.weight = NULL;
   if ( needWeights )
diff --git a/src/Tstepcount.c b/src/Tstepcount.c
index 8776763..be1dd8a 100644
--- a/src/Tstepcount.c
+++ b/src/Tstepcount.c
@@ -21,7 +21,7 @@
       Tstepcount  tstepcount  Count number of timesteps
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -148,13 +148,13 @@ void *Tstepcount(void *argument)
       nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
       for ( levelID = 0; levelID < nlevel; levelID++ )
 	{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, ompthID, tsID) \
   schedule(dynamic,1)
 #endif
 	  for ( i = 0; i < gridsize; i++ )
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
               ompthID = omp_get_thread_num();
 #else
               ompthID = 0;
@@ -197,8 +197,7 @@ void *Tstepcount(void *argument)
 	}
     }
 
-  for ( tsID = 0; tsID < nts; tsID++ )
-    field_free(vars[tsID], vlistID1);
+  for ( tsID = 0; tsID < nts; tsID++ ) field_free(vars[tsID], vlistID1);
 
   if ( vars  ) free(vars);
 
diff --git a/src/Vargen.c b/src/Vargen.c
index 4bfe782..3fef57a 100644
--- a/src/Vargen.c
+++ b/src/Vargen.c
@@ -25,7 +25,7 @@
 */
 
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" // ENABLE_DATA
 #endif
 
@@ -39,19 +39,19 @@
 #if defined(ENABLE_DATA)
   static double etopo_scale  = 3;
   static double etopo_offset = 11000;
-  static const unsigned short const etopo[] = {
+  static const unsigned short etopo[] = {
 #include "etopo.h"
   };
 
   static double temp_scale  =  500;
   static double temp_offset = -220;
-  static const unsigned short const temp[] = {
+  static const unsigned short temp[] = {
 #include "temp.h"
   };
 
   static double mask_scale  =  1;
   static double mask_offset =  0;
-  static const unsigned short const mask[] = {
+  static const unsigned short mask[] = {
 #include "mask.h"
   };
 #endif
diff --git a/src/Varrms.c b/src/Varrms.c
index e498f3b..160596f 100644
--- a/src/Varrms.c
+++ b/src/Varrms.c
@@ -108,6 +108,10 @@ void *Varrms(void *argument)
       vardata2[varID] = (double *) malloc(gridsize*nlevel*sizeof(double));
     }
 
+  field_init(&field1);
+  field_init(&field2);
+  field_init(&field2);
+
   lim = vlistGridsizeMax(vlistID1);
   field1.weight = NULL;
   if ( needWeights )
diff --git a/src/Vertint.c b/src/Vertint.c
index 50d36dc..e7af8be 100644
--- a/src/Vertint.c
+++ b/src/Vertint.c
@@ -60,6 +60,7 @@ void *Vertint(void *argument)
   int geopID = -1, tempID = -1, psID = -1, lnpsID = -1, gheightID = -1;
   int code, param;
   int pnum, pcat, pdis;
+  int sortlevels = TRUE;
   int **varnmiss = NULL, *pnmiss = NULL;
   int *varinterp = NULL;
   char paramstr[32];
@@ -297,6 +298,24 @@ void *Vertint(void *argument)
   if ( Extrapolate == 0 )
     pnmiss   = (int *) malloc(nplev*sizeof(int));
 
+  // check levels
+  if ( zaxisIDh != -1 )
+    {
+      int nlev = zaxisInqSize(zaxisIDh);
+      if ( nlev != nhlev ) cdoAbort("Internal error, wrong numner of hybrid level!");
+      double levels[nlev];
+      zaxisInqLevels(zaxisIDh, levels);
+
+      for ( int ilev = 0; ilev < nlev; ++ilev )
+	{
+	  if ( (ilev+1) != (int)levels[ilev] )
+	    {
+	      sortlevels = FALSE;
+	      break;
+	    }
+	}
+    }
+
   if ( zaxisIDh != -1 && ngp > 0 )
     {
       vert_index = (int *) malloc(ngp*nplev*sizeof(int));
@@ -384,7 +403,7 @@ void *Vertint(void *argument)
       if ( cdoVerbose )
 	cdoPrint("Mode = %d  Center = %d  Code = %d  Param = %s", mode, instNum, code, paramstr);
 
-      if ( code <= 0 )
+      if ( code <= 0 || code == 255 )
 	{
 	  vlistInqVarName(vlistID1, varID, varname);
 	  strtolower(varname);
@@ -392,7 +411,11 @@ void *Vertint(void *argument)
 	  vlistInqVarStdname(vlistID1, varID, stdname);
 	  strtolower(stdname);
 
-	  if ( strcmp(stdname, "surface_air_pressure") == 0 ) code = 134;
+	  if      ( strcmp(stdname, "surface_air_pressure") == 0 ) code = 134;
+	  else if ( strcmp(stdname, "air_temperature")      == 0 ) code = 130;
+	  else if ( strcmp(stdname, "surface_geopotential") == 0 ) code = 129;
+	  else if ( strcmp(stdname, "geopotential")         == 0 ) code = 129;
+	  else if ( strcmp(stdname, "geopotential_height")  == 0 ) code = 156;
 	  else
 	    {
 	      /*                        ECHAM                            ECMWF       */
@@ -450,6 +473,15 @@ void *Vertint(void *argument)
 	}
     }
 
+  if ( cdoVerbose )
+    {
+      cdoPrint("Found:");
+      if ( tempID != -1 ) cdoPrint("  air temperature");
+      if ( psID   != -1 ) cdoPrint("  surface pressure");
+      if ( geopID != -1 ) cdoPrint("  surface geopotential");
+      if ( gheightID != -1 ) cdoPrint("  geopotential height");
+    }
+
   if ( tempID != -1 || gheightID != -1 ) geop_needed = TRUE;
 
   if ( zaxisIDh != -1 && geop_needed )
@@ -495,10 +527,18 @@ void *Vertint(void *argument)
 	{
 	  streamInqRecord(streamID1, &varID, &levelID);
 	  gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
-	  nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
+	  zaxisID  = vlistInqVarZaxis(vlistID1, varID);
+	  nlevel   = zaxisInqSize(zaxisID);
+	  /*
+	  if ( sortlevels && zaxisIDh != -1 && zaxisID == zaxisIDh && nlevel == nhlev )
+	    {
+	      levelID = (int) (zaxisInqLevel(zaxisIDh, levelID)-1);
+	      printf("levelID %d\n", levelID);
+	    }
+	  */
 	  offset   = gridsize*levelID;
 	  single1  = vardata1[varID] + offset;
-	  
+
 	  streamReadRecord(streamID1, single1, &varnmiss[varID][levelID]);
 	  vars[varID] = TRUE;
 	}
@@ -513,7 +553,7 @@ void *Vertint(void *argument)
 	      minmaxval(ngp, geop, NULL, &minval, &maxval);
 	      if ( minval < MIN_FIS || maxval > MAX_FIS )
 		cdoWarning("Surface geopotential out of range (min=%g max=%g)!", minval, maxval);
-	      if ( minval >= 0 && maxval <= 1000 )
+	      if ( minval >= 0 && maxval <= 9000 )
 		cdoWarning("Surface geopotential has an unexpected range (min=%g max=%g)!", minval, maxval);
 	    }
 
diff --git a/src/Vertstat.c b/src/Vertstat.c
index c159001..fe6b600 100644
--- a/src/Vertstat.c
+++ b/src/Vertstat.c
@@ -93,6 +93,7 @@ void *Vertstat(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   vars1 = (field_t *) malloc(nvars*sizeof(field_t));
@@ -106,6 +107,8 @@ void *Vertstat(void *argument)
       gridsize = gridInqSize(gridID);
       missval  = vlistInqVarMissval(vlistID1, varID);
 
+      field_init(&vars1[varID]);
+      field_init(&samp1[varID]);
       vars1[varID].grid    = gridID;
       vars1[varID].nsamp   = 0;
       vars1[varID].nmiss   = 0;
@@ -117,6 +120,7 @@ void *Vertstat(void *argument)
       samp1[varID].ptr     = NULL;
       if ( operfunc == func_std || operfunc == func_var )
 	{
+	  field_init(&vars2[varID]);
 	  vars2[varID].grid    = gridID;
 	  vars2[varID].nmiss   = 0;
 	  vars2[varID].missval = missval;
diff --git a/src/Wct.c b/src/Wct.c
index 18376c8..361d00d 100755
--- a/src/Wct.c
+++ b/src/Wct.c
@@ -108,6 +108,9 @@ void *Wct(void *argument)
   vlistCompare(vlistID1, vlistID2, CMP_DIM);
   
   gridsize = vlistGridsizeMax(vlistID1);
+  
+  field_init(&field1);
+  field_init(&field2);
 
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
diff --git a/src/YAR.c b/src/YAR.c
index 51c073c..c39f450 100644
--- a/src/YAR.c
+++ b/src/YAR.c
@@ -23,14 +23,14 @@
 #include "grid.h"
 #include "remap.h"
 
-#if defined (HAVE_LIBYAC)
+#if defined(HAVE_LIBYAC)
 #include "points.h"
 #include "grid_reg2d.h"
 #include "grid_search.h"
 #include "bucket_search.h"
-#include "event.h"
 #include "search.h"
 #include "clipping.h"
+#include "area.h"
 #endif
 
 int timer_yar_remap, timer_yar_remap_init, timer_yar_remap_sort, timer_yar_remap_con, timer_yar_remap_bil;
@@ -140,8 +140,7 @@ void set_source_data(double * source_data, double init_value,
 
 
 static
-long find_ij_weights(double plon, double plat, double *restrict src_lats, double *restrict src_lons,
-		     double *ig, double *jg)
+long find_ij_weights(double plon, double plat, double *restrict src_lats, double *restrict src_lons, double *ig, double *jg)
 {
 #define  TWO      2.0
 #define  THREE    3.0
@@ -314,7 +313,7 @@ void yar_remap_bil(field_t *field1, field_t *field2)
   printf("lonOut: %g %g %g ... %g %g\n", lonOut[0]/DEG2RAD, lonOut[1]/DEG2RAD, lonOut[2]/DEG2RAD, lonOut[nlonOut-2]/DEG2RAD, lonOut[nlonOut-1]/DEG2RAD);
   printf("latOut: %g %g %g ... %g %g\n", latOut[0]/DEG2RAD, latOut[1]/DEG2RAD, latOut[2]/DEG2RAD, latOut[nlatOut-2]/DEG2RAD, latOut[nlatOut-1]/DEG2RAD);
 
-#if defined (HAVE_LIBYAC)
+#if defined(HAVE_LIBYAC)
 
   //--------------------------------------------
   // define a grid
@@ -430,7 +429,7 @@ void yar_remap_bil(field_t *field1, field_t *field2)
 	      wgts[2] = iguess*jguess;
 	      wgts[3] = (1.-iguess)*jguess;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	      store_link_bilin(&remap.vars, dst_add, src_add, wgts);
@@ -552,7 +551,7 @@ void yar_remap_con(field_t *field1, field_t *field2)
   printf("lonOut: %g %g %g ... %g %g\n", lonOut[0]/DEG2RAD, lonOut[1]/DEG2RAD, lonOut[2]/DEG2RAD, lonOut[nlonOut-2]/DEG2RAD, lonOut[nlonOut-1]/DEG2RAD);
   printf("latOut: %g %g %g ... %g %g\n", latOut[0]/DEG2RAD, latOut[1]/DEG2RAD, latOut[2]/DEG2RAD, latOut[nlatOut-2]/DEG2RAD, latOut[nlatOut-1]/DEG2RAD);
 
-#if defined (HAVE_LIBYAC)
+#if defined(HAVE_LIBYAC)
 
   //--------------------------------------------
   // define a grid
@@ -614,6 +613,10 @@ void yar_remap_con(field_t *field1, field_t *field2)
   double *weight;
   weight = (double *) malloc(gridsize1*sizeof(double));
 
+  double tgt_area;
+  double *area;
+  area = (double *) malloc(gridsize1*sizeof(double));
+
   struct grid_cell *SourceCell;
   SourceCell = malloc (gridsize1  * sizeof(*SourceCell) );
 
@@ -633,9 +636,9 @@ void yar_remap_con(field_t *field1, field_t *field2)
   TargetCell.coordinates_y = malloc ( 4 * sizeof(*TargetCell.coordinates_y) );
 
   unsigned const * curr_deps;
-  struct polygons polygons;
+  //struct polygons polygons;
 
-  polygon_create ( &polygons );
+  //polygon_create ( &polygons );
 
   for ( int i = 0; i < num_elements; ++i )
     {
@@ -690,11 +693,36 @@ void yar_remap_con(field_t *field1, field_t *field2)
 	      printf("\n");
 	    }
 	}
-      
-      polygon_partial_weights(num_deps, SourceCell, TargetCell, weight, &polygons);
+      /*
+      polygon_partial_weights(nSourceCells, SourceCell, TargetCell, weight, &polygons);
 
       correct_weights ( nSourceCells, weight );
-
+      */
+      compute_overlap_areas ( nSourceCells, SourceCell, TargetCell, area);
+
+      // tgt_area = huiliers_area(TargetCell);
+      tgt_area = cell_area(TargetCell);
+      for (n = 0; n < nSourceCells; ++n)
+	weight[n] = area[n] / tgt_area;
+      /*
+      weight_sum = 0.0;
+      for ( n = 0; n < nSourceCells; ++n ) weight_sum += weight[n];
+      
+      if ( fabs(weight_sum-1.0) > epsilon ) {
+	printf ("test 2.) weight %lf\n", weight_sum );
+	PUT_ERR("test 2.) weight deviates from expected value of 1.0!\n");
+      }
+      */
+      correct_weights ( nSourceCells, weight );
+      /*
+      weight_sum = 0.0;
+      for ( n = 0; n < nSourceCells; ++n ) weight_sum += weight[n];
+      
+      if ( fabs(weight_sum-1.0) > epsilon ) {
+	printf ("test 2.) weight %lf\n", weight_sum );
+	PUT_ERR("test 2.) weight deviates from expected value of 1.0!\n");
+      }
+      */
       for ( int k = 0; k < num_deps; ++k )
 	{
 	  int index1 = curr_deps[k];
@@ -713,7 +741,7 @@ void yar_remap_con(field_t *field1, field_t *field2)
       // correct_weights ( nSourceCells, weight );
     }
 
-  polygon_destroy ( &polygons );
+  //polygon_destroy ( &polygons );
   if ( cdoTimer ) timer_stop(timer_yar_remap_con);
 
   if ( cdoTimer ) timer_start(timer_yar_remap);
@@ -735,6 +763,9 @@ void yar_remap_con(field_t *field1, field_t *field2)
   delete_grid(source_grid);
   delete_grid(target_grid);
 
+  free(weight);
+  free(area);
+
   //free(lonIn);
   //free(latIn);
   //free(lonOut);
@@ -782,6 +813,9 @@ void *YAR(void *argument)
   operatorInputArg("grid description file or name");
   gridID2 = cdoDefineGrid(operatorArgv()[0]);
 
+  field_init(&field1);
+  field_init(&field2);
+
   streamID1 = streamOpenRead(cdoStreamName(0));
 
   vlistID1 = streamInqVlist(streamID1);
diff --git a/src/Ydayarith.c b/src/Ydayarith.c
index c392d78..ac00f74 100644
--- a/src/Ydayarith.c
+++ b/src/Ydayarith.c
@@ -70,6 +70,8 @@ void *Ydayarith(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
diff --git a/src/Ydaypctl.c b/src/Ydaypctl.c
index 8f54bdd..4329964 100644
--- a/src/Ydaypctl.c
+++ b/src/Ydaypctl.c
@@ -51,7 +51,6 @@ void *Ydaypctl(void *argument)
   int *recVarID, *recLevelID;
   int vdates1[NDAY], vtimes1[NDAY];
   int vdates2[NDAY], vtimes2[NDAY];
-  double missval;
   field_t **vars1[NDAY];
   field_t field;
   double pn;
@@ -105,6 +104,7 @@ void *Ydaypctl(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   tsID = 0;
@@ -136,26 +136,15 @@ void *Ydaypctl(void *argument)
 
       if ( vars1[dayoy] == NULL )
 	{
-	  vars1[dayoy] = (field_t **) malloc(nvars*sizeof(field_t *));
+	  vars1[dayoy] = field_malloc(vlistID1, FIELD_PTR);
           hsets[dayoy] = hsetCreate(nvars);
 
 	  for ( varID = 0; varID < nvars; varID++ )
 	    {
 	      gridID   = vlistInqVarGrid(vlistID1, varID);
-	      gridsize = gridInqSize(gridID);
 	      nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      missval  = vlistInqVarMissval(vlistID1, varID);
 
-	      vars1[dayoy][varID] = (field_t *)  malloc(nlevels*sizeof(field_t));
               hsetCreateVarLevels(hsets[dayoy], varID, nlevels, gridID);
-	      
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		{
-		  vars1[dayoy][varID][levelID].grid    = gridID;
-		  vars1[dayoy][varID][levelID].nmiss   = 0;
-		  vars1[dayoy][varID][levelID].missval = missval;
-		  vars1[dayoy][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-		}
 	    }
 	}
       
@@ -263,14 +252,7 @@ void *Ydaypctl(void *argument)
     {
       if ( vars1[dayoy] != NULL )
 	{
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		free(vars1[dayoy][varID][levelID].ptr);
-	      free(vars1[dayoy][varID]);
-	    }
-	  free(vars1[dayoy]); 
+	  field_free(vars1[dayoy], vlistID1); 
 	  hsetDestroy(hsets[dayoy]);
 	}
     }
diff --git a/src/Ydaystat.c b/src/Ydaystat.c
index 988b399..1643ff9 100644
--- a/src/Ydaystat.c
+++ b/src/Ydaystat.c
@@ -113,6 +113,7 @@ void *Ydaystat(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   tsID = 0;
diff --git a/src/Ydrunpctl.c b/src/Ydrunpctl.c
index 362db4d..8ffa1fc 100644
--- a/src/Ydrunpctl.c
+++ b/src/Ydrunpctl.c
@@ -47,7 +47,6 @@ void *Ydrunpctl(void *argument)
   int nmiss;
   int nvars, nlevels;
   int *recVarID, *recLevelID;
-  double missval;
   field_t ***vars1 = NULL, **vars2[NDAY];
   datetime_t *datetime;
   int taxisID1, taxisID2, taxisID3, taxisID4;
@@ -114,6 +113,7 @@ void *Ydrunpctl(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   datetime = (datetime_t *) malloc((ndates+1)*sizeof(datetime_t));
@@ -122,25 +122,7 @@ void *Ydrunpctl(void *argument)
   
   for ( its = 0; its < ndates; its++ )
     {
-      vars1[its] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID   = vlistInqVarGrid(vlistID1, varID);
-	  gridsize = gridInqSize(gridID);
-	  nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	  missval  = vlistInqVarMissval(vlistID1, varID);
-
-	  vars1[its][varID] = (field_t *) malloc(nlevels*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevels; levelID++ )
-	    {
-	      vars1[its][varID][levelID].grid    = gridID;
-	      vars1[its][varID][levelID].nmiss   = 0;
-	      vars1[its][varID][levelID].missval = missval;
-	      vars1[its][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-	    }
-	}
+      vars1[its] = field_malloc(vlistID1, FIELD_PTR);
     }
 
   tsID = 0;
@@ -172,26 +154,15 @@ void *Ydrunpctl(void *argument)
 
       if ( vars2[dayoy] == NULL )
 	{
-	  vars2[dayoy] = (field_t **) malloc(nvars*sizeof(field_t *));
+	  vars2[dayoy] = field_malloc(vlistID2, FIELD_PTR);
           hsets[dayoy] = hsetCreate(nvars);
 
 	  for ( varID = 0; varID < nvars; varID++ )
 	    {
 	      gridID   = vlistInqVarGrid(vlistID2, varID);
-	      gridsize = gridInqSize(gridID);
 	      nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID2, varID));
-	      missval  = vlistInqVarMissval(vlistID2, varID);
 
-	      vars2[dayoy][varID] = (field_t *)  malloc(nlevels*sizeof(field_t));
               hsetCreateVarLevels(hsets[dayoy], varID, nlevels, gridID);
-	      
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		{
-		  vars2[dayoy][varID][levelID].grid    = gridID;
-		  vars2[dayoy][varID][levelID].nmiss   = 0;
-		  vars2[dayoy][varID][levelID].missval = missval;
-		  vars2[dayoy][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-		}
 	    }
 	}
       
@@ -353,14 +324,7 @@ void *Ydrunpctl(void *argument)
     {
       if ( vars2[dayoy] != NULL )
 	{
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID2, varID));
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		free(vars2[dayoy][varID][levelID].ptr);
-	      free(vars2[dayoy][varID]);
-	    }
-	  free(vars2[dayoy]); 
+	  field_free(vars2[dayoy], vlistID2); 
 	  hsetDestroy(hsets[dayoy]);
 	}
     }
diff --git a/src/Ydrunstat.c b/src/Ydrunstat.c
index ce4759e..d0c35c0 100644
--- a/src/Ydrunstat.c
+++ b/src/Ydrunstat.c
@@ -51,8 +51,6 @@ YDAY_STATS;
 
 static YDAY_STATS *ydstatCreate(int vlistID);
 static void ydstatDestroy(YDAY_STATS *stats);
-static void ydstatCreateVars1(YDAY_STATS *stats, int dayoy);
-static void ydstatCreateVars2(YDAY_STATS *stats, int dayoy);
 static void ydstatUpdate(YDAY_STATS *stats, int vdate, int vtime, 
   field_t **vars1, field_t **vars2, int nsets, int operfunc);
 static void ydstatFinalize(YDAY_STATS *stats, int operfunc);
@@ -142,36 +140,9 @@ void *Ydrunstat(void *argument)
   
   for ( its = 0; its < ndates; its++ )
     {
-      vars1[its] = (field_t **) malloc(nvars*sizeof(field_t *));
+      vars1[its] = field_malloc(vlistID1, FIELD_PTR);
       if ( lvarstd )
-	vars2[its] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  gridID   = vlistInqVarGrid(vlistID1, varID);
-	  gridsize = gridInqSize(gridID);
-	  nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	  missval  = vlistInqVarMissval(vlistID1, varID);
-
-	  vars1[its][varID] = (field_t *) malloc(nlevels*sizeof(field_t));
-	  if ( lvarstd )
-	    vars2[its][varID] = (field_t *) malloc(nlevels*sizeof(field_t));
-
-	  for ( levelID = 0; levelID < nlevels; levelID++ )
-	    {
-	      vars1[its][varID][levelID].grid    = gridID;
-	      vars1[its][varID][levelID].nmiss   = 0;
-	      vars1[its][varID][levelID].missval = missval;
-	      vars1[its][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-	      if ( lvarstd )
-		{
-		  vars2[its][varID][levelID].grid    = gridID;
-		  vars2[its][varID][levelID].nmiss   = 0;
-		  vars2[its][varID][levelID].missval = missval;
-		  vars2[its][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-		}
-	    }
-	}
+	vars2[its] = field_malloc(vlistID1, FIELD_PTR);
     }
   
   for ( tsID = 0; tsID < ndates; tsID++ )
@@ -301,20 +272,8 @@ void *Ydrunstat(void *argument)
   
   for ( its = 0; its < ndates; its++ )
     {
-      for ( varID = 0; varID < nvars; varID++ )
-	{
-	  nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	  for ( levelID = 0; levelID < nlevels; levelID++ )
-	    {
-	      free(vars1[its][varID][levelID].ptr);
-	      if ( lvarstd ) free(vars2[its][varID][levelID].ptr);
-	    }
-
-	  free(vars1[its][varID]);
-	  if ( lvarstd ) free(vars2[its][varID]);
-	}
-	free(vars1[its]);
-	if ( lvarstd ) free(vars2[its]);
+      field_free(vars1[its], vlistID1);
+      if ( lvarstd ) field_free(vars2[its], vlistID1);
     }
   
   ydstatDestroy(stats);
@@ -393,66 +352,6 @@ void ydstatDestroy(YDAY_STATS *stats)
 }
 
 static
-void ydstatCreateVars1(YDAY_STATS *stats, int dayoy)
-{
-  int varID, levelID, nvars, nlevels;
-  int gridID, gridsize;
-  double missval;
-
-  nvars = vlistNvars(stats->vlist);
-  
-  stats->vars1[dayoy] = (field_t **) malloc(nvars * sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(stats->vlist, varID);
-      gridsize = gridInqSize(gridID);
-      nlevels  = zaxisInqSize(vlistInqVarZaxis(stats->vlist, varID));
-      missval  = vlistInqVarMissval(stats->vlist, varID);
-
-      stats->vars1[dayoy][varID] = (field_t *) malloc(nlevels * sizeof(field_t));
-	      
-      for ( levelID = 0; levelID < nlevels; levelID++ )
-        {
-	  stats->vars1[dayoy][varID][levelID].grid    = gridID;
-	  stats->vars1[dayoy][varID][levelID].nmiss   = 0;
-	  stats->vars1[dayoy][varID][levelID].missval = missval;
-	  stats->vars1[dayoy][varID][levelID].ptr     = (double *) malloc(gridsize * sizeof(double));
-        }
-    }
-}
-
-static
-void ydstatCreateVars2(YDAY_STATS *stats, int dayoy)
-{
-  int varID, levelID, nvars, nlevels;
-  int gridID, gridsize;
-  double missval;
-
-  nvars = vlistNvars(stats->vlist);
-  
-  stats->vars2[dayoy] = (field_t **) malloc(nvars * sizeof(field_t *));
-
-  for ( varID = 0; varID < nvars; varID++ )
-    {
-      gridID   = vlistInqVarGrid(stats->vlist, varID);
-      gridsize = gridInqSize(gridID);
-      nlevels  = zaxisInqSize(vlistInqVarZaxis(stats->vlist, varID));
-      missval  = vlistInqVarMissval(stats->vlist, varID);
-
-      stats->vars2[dayoy][varID] = (field_t *) malloc(nlevels * sizeof(field_t));
-	      
-      for ( levelID = 0; levelID < nlevels; levelID++ )
-        {
-	  stats->vars2[dayoy][varID][levelID].grid    = gridID;
-	  stats->vars2[dayoy][varID][levelID].nmiss   = 0;
-	  stats->vars2[dayoy][varID][levelID].missval = missval;
-	  stats->vars2[dayoy][varID][levelID].ptr     = (double *) malloc(gridsize * sizeof(double));
-        }
-    }
-}
-
-static
 void ydstatUpdate(YDAY_STATS *stats, int vdate, int vtime, 
 		  field_t **vars1, field_t **vars2, int nsets, int operfunc)
 {
@@ -482,9 +381,9 @@ void ydstatUpdate(YDAY_STATS *stats, int vdate, int vtime,
 
   if ( stats->vars1[dayoy] == NULL )
     {
-      ydstatCreateVars1(stats, dayoy);
+      stats->vars1[dayoy] = field_malloc(stats->vlist, FIELD_PTR);
       if ( lvarstd )
-	ydstatCreateVars2(stats, dayoy);
+	stats->vars2[dayoy] = field_malloc(stats->vlist, FIELD_PTR);
     }
 
   for ( varID = 0; varID  < nvars; varID++ )
diff --git a/src/Yearmonstat.c b/src/Yearmonstat.c
index 3c38915..56f66d7 100644
--- a/src/Yearmonstat.c
+++ b/src/Yearmonstat.c
@@ -44,7 +44,7 @@ void *Yearmonstat(void *argument)
   double dsets;
   int i;
   int dpm;
-  int year0, month0;
+  int year0 = 0, month0 = 0;
   int year, month, day;
   int calendar;
   int streamID1, streamID2;
@@ -91,6 +91,7 @@ void *Yearmonstat(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   vars1 = field_malloc(vlistID1, FIELD_PTR);
diff --git a/src/Yhourarith.c b/src/Yhourarith.c
index 4392de5..0f3cfaf 100644
--- a/src/Yhourarith.c
+++ b/src/Yhourarith.c
@@ -97,6 +97,8 @@ void *Yhourarith(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
diff --git a/src/Yhourstat.c b/src/Yhourstat.c
index 00fc863..12655a0 100644
--- a/src/Yhourstat.c
+++ b/src/Yhourstat.c
@@ -138,6 +138,7 @@ void *Yhourstat(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   tsID = 0;
diff --git a/src/Ymonarith.c b/src/Ymonarith.c
index ad376e0..3663cba 100644
--- a/src/Ymonarith.c
+++ b/src/Ymonarith.c
@@ -70,6 +70,8 @@ void *Ymonarith(void *argument)
 
   gridsize = vlistGridsizeMax(vlistID1);
 
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
diff --git a/src/Ymonpctl.c b/src/Ymonpctl.c
index 3504226..3c72e90 100644
--- a/src/Ymonpctl.c
+++ b/src/Ymonpctl.c
@@ -49,7 +49,6 @@ void *Ymonpctl(void *argument)
   int *recVarID, *recLevelID;
   int vdates1[NMONTH], vtimes1[NMONTH];
   int vdates2[NMONTH], vtimes2[NMONTH];
-  double missval;
   field_t **vars1[NMONTH];
   field_t field;
   double pn;
@@ -103,6 +102,7 @@ void *Ymonpctl(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   tsID = 0;
@@ -128,26 +128,15 @@ void *Ymonpctl(void *argument)
 
       if ( vars1[month] == NULL )
 	{
-	  vars1[month] = (field_t **) malloc(nvars*sizeof(field_t *));
+	  vars1[month] = field_malloc(vlistID1, FIELD_PTR);
           hsets[month] = hsetCreate(nvars);
 
 	  for ( varID = 0; varID < nvars; varID++ )
 	    {
 	      gridID   = vlistInqVarGrid(vlistID1, varID);
-	      gridsize = gridInqSize(gridID);
 	      nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      missval  = vlistInqVarMissval(vlistID1, varID);
 
-	      vars1[month][varID] = (field_t *)  malloc(nlevels*sizeof(field_t));
               hsetCreateVarLevels(hsets[month], varID, nlevels, gridID);
-	      
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		{
-		  vars1[month][varID][levelID].grid    = gridID;
-		  vars1[month][varID][levelID].nmiss   = 0;
-		  vars1[month][varID][levelID].missval = missval;
-		  vars1[month][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-		}
 	    }
 	}
       
@@ -249,14 +238,7 @@ void *Ymonpctl(void *argument)
     {
       if ( vars1[month] != NULL )
 	{
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		free(vars1[month][varID][levelID].ptr);
-	      free(vars1[month][varID]);
-	    }
-	  free(vars1[month]); 
+	  field_free(vars1[month], vlistID1); 
 	  hsetDestroy(hsets[month]);
 	}
     }
diff --git a/src/Ymonstat.c b/src/Ymonstat.c
index efd79d0..7d91888 100644
--- a/src/Ymonstat.c
+++ b/src/Ymonstat.c
@@ -130,6 +130,7 @@ void *Ymonstat(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   tsID = 0;
diff --git a/src/Yseaspctl.c b/src/Yseaspctl.c
index b032b31..fe2b0a2 100644
--- a/src/Yseaspctl.c
+++ b/src/Yseaspctl.c
@@ -50,7 +50,6 @@ void *Yseaspctl(void *argument)
   int *recVarID, *recLevelID;
   int vdates1[NSEAS], vtimes1[NSEAS];
   int vdates2[NSEAS], vtimes2[NSEAS];
-  double missval;
   field_t **vars1[NSEAS];
   field_t field;
   double pn;
@@ -106,6 +105,7 @@ void *Yseaspctl(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   tsID = 0;
@@ -149,26 +149,15 @@ void *Yseaspctl(void *argument)
 
       if ( vars1[seas] == NULL )
 	{
-	  vars1[seas] = (field_t **) malloc(nvars*sizeof(field_t *));
+	  vars1[seas] = field_malloc(vlistID1, FIELD_PTR);
           hsets[seas] = hsetCreate(nvars);
 
 	  for ( varID = 0; varID < nvars; varID++ )
 	    {
 	      gridID   = vlistInqVarGrid(vlistID1, varID);
-	      gridsize = gridInqSize(gridID);
 	      nlevels  = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      missval  = vlistInqVarMissval(vlistID1, varID);
 
-	      vars1[seas][varID] = (field_t *)  malloc(nlevels*sizeof(field_t));
               hsetCreateVarLevels(hsets[seas], varID, nlevels, gridID);
-	      
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		{
-		  vars1[seas][varID][levelID].grid    = gridID;
-		  vars1[seas][varID][levelID].nmiss   = 0;
-		  vars1[seas][varID][levelID].missval = missval;
-		  vars1[seas][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-		}
 	    }
 	}
       
@@ -275,14 +264,7 @@ void *Yseaspctl(void *argument)
     {
       if ( vars1[seas] != NULL )
 	{
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      nlevels = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      for ( levelID = 0; levelID < nlevels; levelID++ )
-		free(vars1[seas][varID][levelID].ptr);
-	      free(vars1[seas][varID]);
-	    }
-	  free(vars1[seas]); 
+	  field_free(vars1[seas], vlistID1); 
 	  hsetDestroy(hsets[seas]);
 	}
     }
diff --git a/src/Yseasstat.c b/src/Yseasstat.c
index a31b5dd..e6d139b 100644
--- a/src/Yseasstat.c
+++ b/src/Yseasstat.c
@@ -67,7 +67,6 @@ void *Yseasstat(void *argument)
   int i;
   int varID;
   int recID;
-  int gridID;
   int vdate, vtime;
   int year, month, day, seas;
   int nrecs, nrecords;
@@ -81,7 +80,6 @@ void *Yseasstat(void *argument)
   int nvars, nlevel;
   int *recVarID, *recLevelID;
   date_time_t datetime[NSEAS];
-  double missval;
   field_t **vars1[NSEAS], **vars2[NSEAS], **samp1[NSEAS];
   field_t field;
   int season_start;
@@ -131,6 +129,7 @@ void *Yseasstat(void *argument)
   recLevelID = (int *) malloc(nrecords*sizeof(int));
 
   gridsize = vlistGridsizeMax(vlistID1);
+  field_init(&field);
   field.ptr = (double *) malloc(gridsize*sizeof(double));
 
   tsID = 0;
@@ -165,42 +164,10 @@ void *Yseasstat(void *argument)
 
       if ( vars1[seas] == NULL )
 	{
-	  vars1[seas] = (field_t **) malloc(nvars*sizeof(field_t *));
-	  samp1[seas] = (field_t **) malloc(nvars*sizeof(field_t *));
+	  vars1[seas] = field_malloc(vlistID1, FIELD_PTR);
+	  samp1[seas] = field_malloc(vlistID1, FIELD_NONE);
 	  if ( operfunc == func_std || operfunc == func_var )
-	    vars2[seas] = (field_t **) malloc(nvars*sizeof(field_t *));
-
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      gridID   = vlistInqVarGrid(vlistID1, varID);
-	      gridsize = gridInqSize(gridID);
-	      nlevel   = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      missval  = vlistInqVarMissval(vlistID1, varID);
-
-	      vars1[seas][varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-	      samp1[seas][varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-	      if ( operfunc == func_std || operfunc == func_var )
-		vars2[seas][varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
-	      
-	      for ( levelID = 0; levelID < nlevel; levelID++ )
-		{
-		  vars1[seas][varID][levelID].grid    = gridID;
-		  vars1[seas][varID][levelID].nmiss   = 0;
-		  vars1[seas][varID][levelID].missval = missval;
-		  vars1[seas][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-		  samp1[seas][varID][levelID].grid    = gridID;
-		  samp1[seas][varID][levelID].nmiss   = 0;
-		  samp1[seas][varID][levelID].missval = missval;
-		  samp1[seas][varID][levelID].ptr     = NULL;
-		  if ( operfunc == func_std || operfunc == func_var )
-		    {
-		      vars2[seas][varID][levelID].grid    = gridID;
-		      vars2[seas][varID][levelID].nmiss   = 0;
-		      vars2[seas][varID][levelID].missval = missval;
-		      vars2[seas][varID][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
-		    }
-		}
-	    }
+	    vars2[seas] = field_malloc(vlistID1, FIELD_PTR);
 	}
 
       for ( recID = 0; recID < nrecs; recID++ )
@@ -343,23 +310,8 @@ void *Yseasstat(void *argument)
     {
       if ( vars1[seas] != NULL )
 	{
-	  for ( varID = 0; varID < nvars; varID++ )
-	    {
-	      nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
-	      for ( levelID = 0; levelID < nlevel; levelID++ )
-		{
-		  free(vars1[seas][varID][levelID].ptr);
-		  if ( samp1[seas][varID][levelID].ptr ) free(samp1[seas][varID][levelID].ptr);
-		  if ( operfunc == func_std || operfunc == func_var ) free(vars2[seas][varID][levelID].ptr);
-		}
-	      
-	      free(vars1[seas][varID]);
-	      free(samp1[seas][varID]);
-	      if ( operfunc == func_std || operfunc == func_var ) free(vars2[seas][varID]);
-	    }
-
-	  free(vars1[seas]);
-	  free(samp1[seas]);
+	  field_free(vars1[seas], vlistID1);
+	  field_free(samp1[seas], vlistID1);
 	  if ( operfunc == func_std || operfunc == func_var ) free(vars2[seas]);
 	}
     }
diff --git a/src/Zonstat.c b/src/Zonstat.c
index bbdc39a..4e6a1a9 100644
--- a/src/Zonstat.c
+++ b/src/Zonstat.c
@@ -140,6 +140,8 @@ void *Zonstat(void *argument)
   nlatmax = gridInqYsize(gridID1); /* max nlat ? */
 
   lim = vlistGridsizeMax(vlistID1);
+  field_init(&field2);
+  field_init(&field2);
   field1.ptr  = (double *) malloc(lim*sizeof(double));
   field2.ptr  = (double *) malloc(nlatmax*sizeof(double));
   field2.grid = gridID2;
diff --git a/src/cdo.c b/src/cdo.c
index 01fa775..892ee9f 100644
--- a/src/cdo.c
+++ b/src/cdo.c
@@ -15,7 +15,7 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -25,15 +25,15 @@
 #include <stdlib.h>
 #include <ctype.h>
 /*#include <malloc.h>*/ /* mallopt and malloc_stats */
-#if  defined (HAVE_GETRLIMIT)
-#if  defined (HAVE_SYS_RESOURCE_H)
+#if defined(HAVE_GETRLIMIT)
+#if defined(HAVE_SYS_RESOURCE_H)
 #include <sys/time.h>       /* getrlimit */
 #include <sys/resource.h>   /* getrlimit */
 #endif
 #endif
 #include <unistd.h>         /* sysconf, gethostname */
 
-#if defined (SX)
+#if defined(SX)
 #define RLIM_T  long long
 #else
 #define RLIM_T  rlim_t
@@ -45,7 +45,7 @@
 #include "cdo_int.h"
 
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 #include "pstream_int.h"
 #include "pthread_debug.h"
 #endif
@@ -54,11 +54,11 @@
 #include "util.h"
 #include "error.h"
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
-#if ! defined (VERSION)
+#if ! defined(VERSION)
 #  define  VERSION  "0.0.1"
 #endif
 
@@ -69,6 +69,7 @@ char *Progname;
 
 int ompNumThreads = 1;
 
+char *cdoGridSearchDir   = NULL;
 int cdoDefaultFileType   = CDI_UNDEFID;
 int cdoDefaultDataType   = CDI_UNDEFID;
 int cdoDefaultTimeType   = CDI_UNDEFID;
@@ -138,6 +139,9 @@ int timer_total, timer_read, timer_write;
       }
 
 
+void printFeatures(void);
+void printLibraries(void);
+
 static
 void cdo_version(void)
 {
@@ -145,60 +149,21 @@ void cdo_version(void)
   char *typenames[] = {        "srv",        "ext",        "ieg",        "grb",        "grb2",        "nc",        "nc2",        "nc4",        "nc4c"};
 
   fprintf(stderr, "%s\n", CDO_Version);
-#if defined (COMPILER)
+#if defined(COMPILER)
   fprintf(stderr, "Compiler: %s\n", COMPILER);
 #endif
-#if defined (COMP_VERSION)
+#if defined(COMP_VERSION)
   fprintf(stderr, " version: %s\n", COMP_VERSION);
 #endif
-#if defined (USER_NAME) && defined(HOST_NAME) && defined(SYSTEM_TYPE)
+#if defined(USER_NAME) && defined(HOST_NAME) && defined(SYSTEM_TYPE)
   fprintf(stderr, "Compiled: by %s on %s (%s) %s %s\n",
 	  USER_NAME, HOST_NAME, SYSTEM_TYPE, __DATE__, __TIME__);
 #endif
 
-  fprintf(stderr, "    with:");
-#if defined (HAVE_LIBPTHREAD)
-  fprintf(stderr, " PTHREADS");
-#endif
-#if defined (_OPENMP)
-  fprintf(stderr, " OpenMP");
-#endif
-#if  defined  (HAVE_NETCDF4)
-  fprintf(stderr, " NC4");
-#endif
-#if  defined  (HAVE_LIBNC_DAP)
-  fprintf(stderr, " OPeNDAP");
-#endif
-#if defined (HAVE_LIBSZ)
-  fprintf(stderr, " SZ");
-#endif
-#if defined (HAVE_LIBZ)
-  fprintf(stderr, " Z");
-#endif
-#if defined (HAVE_LIBJASPER)
-  fprintf(stderr, " JASPER");
-#endif
-#if defined (HAVE_LIBUDUNITS2)
-  fprintf(stderr, " UDUNITS2");
-#endif
-#if defined (HAVE_LIBPROJ)
-  fprintf(stderr, " PROJ.4");
-#endif
-#if defined (HAVE_LIBXML2)
-  fprintf(stderr, " XML2");
-#endif
-#if defined (HAVE_LIBMAGICS)
-  fprintf(stderr, " MAGICS");
-#endif
-#if defined (HAVE_LIBDRMAA)
-  fprintf(stderr, " DRMAA");
-#endif
-#if defined (HAVE_LIBCURL)
-  fprintf(stderr, " CURL");
-#endif
-  fprintf(stderr, "\n");
+  printFeatures();
+  printLibraries();
 
-  fprintf(stderr, "filetype: ");
+  fprintf(stderr, "Filetypes: ");
   for ( size_t i = 0; i < sizeof(filetypes)/sizeof(int); ++i )
     if ( cdiHaveFiletype(filetypes[i]) ) fprintf(stderr, "%s ", typenames[i]);
   fprintf(stderr, "\n");
@@ -224,7 +189,7 @@ void usage(void)
   fprintf(stderr, "                   Add L or B to set the byteorder to Little or Big endian\n");
   fprintf(stderr, "    -f <format>    Format of the output file. (grb/grb2/nc/nc2/nc4/nc4c/srv/ext/ieg)\n");
   fprintf(stderr, "    -g <grid>      Set default grid name or file. Available grids: \n");
-  fprintf(stderr, "                   n<N>, t<RES>, tl<RES>, r<NX>x<NY>, g<NX>x<NY>, gme<NI>, lon=<LON>/lat=<LAT>\n");
+  fprintf(stderr, "                   n<N>, t<RES>, tl<RES>, global_<DXY>, r<NX>x<NY>, g<NX>x<NY>, gme<NI>, lon=<LON>/lat=<LAT>\n");
   fprintf(stderr, "    -h             Help information for the operators\n");
   /*
   fprintf(stderr, "    -i <inst>      Institution name/file\n");
@@ -235,12 +200,12 @@ void usage(void)
   fprintf(stderr, "\n");
   */
   /* fprintf(stderr, "    -l <level>     Level file\n"); */
-  fprintf(stderr, "    -k <chunktype> Chunk type: auto, grid or lines\n");
-  fprintf(stderr, "    -L             Lock IO\n");
+  fprintf(stderr, "    -k <chunktype> NetCDF4 chunk type: auto, grid or lines\n");
+  fprintf(stderr, "    -L             Lock IO (sequential access)\n");
   fprintf(stderr, "    -M             Switch to indicate that the I/O streams have missing values\n");
   fprintf(stderr, "    -m <missval>   Set the default missing value (default: %g)\n", cdiInqMissval());
   fprintf(stderr, "    -O             Overwrite existing output file, if checked\n");
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   fprintf(stderr, "    -P <nthreads>  Set number of OpenMP threads\n");
 #endif
   fprintf(stderr, "    -Q             Alphanumeric sorting of netCDF parameter names\n");
@@ -297,9 +262,9 @@ void cdoPrintHelp(char *phelp[]/*, char *xoperator*/)
 }
 
 
-void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID)
+void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID, const char *refname)
 {
-  if ( strncmp(cdo_file_suffix, "NULL", 4) )
+  if ( strncmp(cdo_file_suffix, "NULL", 4) != 0 )
     {
       if ( cdo_file_suffix[0] != 0 )
 	{
@@ -307,10 +272,52 @@ void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID
 	}
       else
 	{
-	  strncat(filesuffix, streamFilesuffix(filetype), maxlen-1);
-	  if ( cdoDefaultFileType == FILETYPE_GRB )
-	    if ( vlistIsSzipped(vlistID) || cdoCompType == COMPRESS_SZIP )
-	      strncat(filesuffix, ".sz", maxlen-1);
+	  int lready = FALSE;
+	  int lcompsz = FALSE;
+	  
+	  if ( filetype == cdoDefaultFileType && cdoDefaultDataType == -1 && cdoDefaultByteorder == -1 )
+	    {
+	      size_t len = 0;
+	      if ( refname != NULL && *refname != 0 && *refname != '-' && *refname != '.' ) len = strlen(refname);
+
+	      if ( len > 2 )
+		{
+		  char *result = strrchr(refname, '.');
+		  if ( result != NULL && result[1] != 0 )
+		    {
+		      int firstchar = tolower(result[1]);
+		      switch (firstchar)
+			{
+			case 'g':
+			  if ( cdoDefaultFileType == FILETYPE_GRB || cdoDefaultFileType == FILETYPE_GRB2 ) lready = TRUE;
+			  break;
+			case 'n':
+			  if ( cdoDefaultFileType == FILETYPE_NC || cdoDefaultFileType == FILETYPE_NC2 ||
+			       cdoDefaultFileType == FILETYPE_NC4 || cdoDefaultFileType == FILETYPE_NC4C ) lready = TRUE;
+			  break;
+			case 's':
+			  if ( cdoDefaultFileType == FILETYPE_SRV ) lready = TRUE;
+			  break;
+			case 'e':
+			  if ( cdoDefaultFileType == FILETYPE_EXT ) lready = TRUE;
+			  break;
+			case 'i':
+			  if ( cdoDefaultFileType == FILETYPE_IEG ) lready = TRUE;
+			  break;
+			}
+		    }
+		  if ( lready )  strncat(filesuffix, result, maxlen-1);
+		}
+	    }
+
+	  if ( !lready )
+	    {
+	      strncat(filesuffix, streamFilesuffix(cdoDefaultFileType), maxlen-1);
+	      if ( cdoDefaultFileType == FILETYPE_GRB && vlistIsSzipped(vlistID) ) lcompsz = TRUE;
+	    }
+
+	  if ( cdoDefaultFileType == FILETYPE_GRB && cdoCompType == COMPRESS_SZIP ) lcompsz = TRUE;
+	  if ( lcompsz ) strncat(filesuffix, ".sz", maxlen-1);
 	}
     }
 }
@@ -334,7 +341,7 @@ void cdoSetDebug(int level)
 
   if ( level == 1 || (level &  32) ) cdoDebug = 1;
   if ( level == 1 || (level &  64) ) pstreamDebug(1);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( level == 1 || (level & 128) ) pipeDebug(1);
   if ( level == 1 || (level & 256) ) Pthread_debug(1);
 #endif
@@ -611,7 +618,7 @@ void setDefaultFileType(char *filetypestr, int labort)
     }
 }
 
-#if defined (malloc)
+#if defined(malloc)
 #undef malloc
 #undef free
 #endif
@@ -755,6 +762,23 @@ void get_env_vars(void)
 {
   char *envstr;
 
+  envstr = getenv("CDO_GRID_SEARCH_DIR");
+  if ( envstr )
+    {
+      size_t len = strlen(envstr);
+      if ( len > 0 )
+	{
+	  len += 2;
+	  cdoGridSearchDir = (char *) malloc(len);
+	  memcpy(cdoGridSearchDir, envstr, len-1);
+	  if ( cdoGridSearchDir[len-3] != '/' )
+	    {
+	      cdoGridSearchDir[len-2] = '/';
+	      cdoGridSearchDir[len-1] = 0;
+	    }
+	}
+    }
+
   envstr = getenv("CDO_LOG_OFF");
   if ( envstr )
     {
@@ -837,94 +861,103 @@ void print_system_info()
   if ( envstr ) fprintf(stderr, "MACHTYPE            = %s\n", envstr);
   fprintf(stderr, "\n");
 
-#if defined (__SSE2__)
+#if defined(_ARCH_PWR6)
+  fprintf(stderr, "Predefined: _ARCH_PWR6\n");
+#endif 
+#if defined(_ARCH_PWR7)
+  fprintf(stderr, "Predefined: _ARCH_PWR7\n");
+#endif 
+#if defined(__SSE2__)
   fprintf(stderr, "Predefined: __SSE2__\n");
 #endif 
-#if defined (__SSE3__)
+#if defined(__SSE3__)
   fprintf(stderr, "Predefined: __SSE3__\n");
 #endif 
-#if defined (__SSE4_1__)
+#if defined(__SSE4_1__)
   fprintf(stderr, "Predefined: __SSE4_1__\n");
 #endif 
-#if defined (__SSE4_2__)
+#if defined(__SSE4_2__)
   fprintf(stderr, "Predefined: __SSE4_2__\n");
 #endif 
-#if defined (__AVX__)
+#if defined(__AVX__)
   fprintf(stderr, "Predefined: __AVX__\n");
 #endif 
   fprintf(stderr, "\n");
 
   fprintf(stderr, "mem alignment       = %d\n\n", getMemAlignment());
 
-#if defined (HAVE_MMAP)
+#if defined(HAVE_MMAP)
   fprintf(stderr, "HAVE_MMAP\n");
 #endif
-#if defined (HAVE_MEMORY_H)
+#if defined(HAVE_MEMORY_H)
   fprintf(stderr, "HAVE_MEMORY_H\n");
 #endif
   fprintf(stderr, "\n");
       
-#if defined (_OPENACC)
+#if defined(_OPENACC)
   fprintf(stderr, "OPENACC VERSION     = %d\n", _OPENACC);
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   fprintf(stderr, "OPENMP VERSION      = %d\n", _OPENMP);
 #endif
-#if defined (__GNUC__)
+#if defined(__GNUC__)
   fprintf(stderr, "GNUC VERSION        = %d\n", __GNUC__);
 #endif
-#if defined (__ICC)
+#if defined(__GNUC_MINOR__)
+  fprintf(stderr, "GNUC MINOR          = %d\n", __GNUC_MINOR__);
+#endif
+#if defined(__ICC)
   fprintf(stderr, "ICC VERSION         = %d\n", __ICC);
 #endif
-#if defined (__STDC__)
+#if defined(__STDC__)
   fprintf(stderr, "STD ANSI C          = %d\n", __STDC__);
 #endif
-#if defined (__STD_VERSION__)
+#if defined(__STD_VERSION__)
   fprintf(stderr, "STD VERSION         = %ld\n", __STD_VERSION__);
 #endif
-#if defined (__STDC_VERSION__)
+#if defined(__STDC_VERSION__)
   fprintf(stderr, "STDC VERSION        = %ld\n", __STDC_VERSION__);
 #endif
-#if defined (__STD_HOSTED__)
+#if defined(__STD_HOSTED__)
   fprintf(stderr, "STD HOSTED          = %d\n", __STD_HOSTED__);
 #endif
-#if defined (FLT_EVAL_METHOD)
+#if defined(FLT_EVAL_METHOD)
   fprintf(stderr, "FLT_EVAL_METHOD     = %d\n", FLT_EVAL_METHOD);
 #endif
-#if defined (FP_FAST_FMA)
+#if defined(FP_FAST_FMA)
   fprintf(stderr, "FP_FAST_FMA         = defined\n");
 #endif
   fprintf(stderr, "\n");
 
-#if defined (_SC_VERSION)
+#if defined(_SC_VERSION)
   fprintf(stderr, "POSIX.1 VERSION     = %ld\n", sysconf(_SC_VERSION));
 #endif
-#if defined (_SC_ARG_MAX)
+#if defined(_SC_ARG_MAX)
   fprintf(stderr, "POSIX.1 ARG_MAX     = %ld\n", sysconf(_SC_ARG_MAX));
 #endif
-#if defined (_SC_CHILD_MAX)
+#if defined(_SC_CHILD_MAX)
   fprintf(stderr, "POSIX.1 CHILD_MAX   = %ld\n", sysconf(_SC_CHILD_MAX));
 #endif
-#if defined (_SC_STREAM_MAX)
+#if defined(_SC_STREAM_MAX)
   fprintf(stderr, "POSIX.1 STREAM_MAX  = %ld\n", sysconf(_SC_STREAM_MAX));
 #endif
-#if defined (_SC_OPEN_MAX)
+#if defined(_SC_OPEN_MAX)
   fprintf(stderr, "POSIX.1 OPEN_MAX    = %ld\n", sysconf(_SC_OPEN_MAX));
 #endif
-#if defined (_SC_PAGESIZE)
+#if defined(_SC_PAGESIZE)
   fprintf(stderr, "POSIX.1 PAGESIZE    = %ld\n", sysconf(_SC_PAGESIZE));
 #endif
 
   fprintf(stderr, "\n");
 
-#if defined (HAVE_GETRLIMIT)
-#if defined (RLIMIT_FSIZE)
+#if defined(HAVE_GETRLIMIT)
+#if defined(RLIMIT_FSIZE)
   PRINT_RLIMIT(RLIMIT_FSIZE);
 #endif
-#if defined (RLIMIT_NOFILE)
+#if defined(RLIMIT_NOFILE)
   PRINT_RLIMIT(RLIMIT_NOFILE);
 #endif
-#if defined (RLIMIT_STACK)
+#if defined(RLIMIT_STACK)
   PRINT_RLIMIT(RLIMIT_STACK);
 #endif
 #endif
@@ -934,8 +967,8 @@ void print_system_info()
 static
 void check_stacksize()
 {
-#if defined (HAVE_GETRLIMIT)
-#if defined (RLIMIT_STACK)
+#if defined(HAVE_GETRLIMIT)
+#if defined(RLIMIT_STACK)
   {
 #define  MIN_STACK_SIZE  67108864L  /* 64MB */
     int status;
@@ -999,7 +1032,7 @@ void parse_options(int argc, char *argv[])
 	  break;
 	case 'e':
 	  {
-#if defined (HAVE_GETHOSTNAME)
+#if defined(HAVE_GETHOSTNAME)
 	  char host[1024];
 	  gethostname(host, sizeof(host));
 	  cdoExpName = cdoOptarg;
@@ -1149,7 +1182,7 @@ int main(int argc, char *argv[])
 
   if ( Debug ) print_pthread_info();
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   if ( numThreads <= 0 ) numThreads = 1;
   omp_set_num_threads(numThreads);
   ompNumThreads = omp_get_max_threads();
@@ -1228,5 +1261,7 @@ int main(int argc, char *argv[])
 
   /* malloc_stats(); */
 
+  if ( cdoGridSearchDir ) free(cdoGridSearchDir);
+
   return (status);
 }
diff --git a/src/cdo.h b/src/cdo.h
index 665e56e..e66dc1a 100644
--- a/src/cdo.h
+++ b/src/cdo.h
@@ -111,8 +111,10 @@ void    cdoDefHistory(int fileID, char *histstring);
 int     cdoDefineGrid(const char *gridfile);
 int     cdoDefineZaxis(const char *zaxisfile);
 
+int     vlistInqNWPV(int vlistID, int varID);
 int     vlistIsSzipped(int vlistID);
-void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID);
+
+void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID, const char *refname);
 
 int  gridWeights(int gridID, double *weights);
 int  gridGenArea(int gridID, double *area);
diff --git a/src/cdo_int.h b/src/cdo_int.h
index 2ad504f..4fcb416 100644
--- a/src/cdo_int.h
+++ b/src/cdo_int.h
@@ -18,7 +18,7 @@
 #ifndef _CDO_INT_H
 #define _CDO_INT_H
 
-#if defined (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -58,15 +58,15 @@ char *strdup(const char *s);
 #define  DATE_IS_NEQ(dtstr1, dtstr2, len) (memcmp(dtstr1, dtstr2, len) != 0)
 
 
-#if defined (__xlC__) /* performance problems on IBM */
+#if defined(__xlC__) /* performance problems on IBM */
 #ifndef DBL_IS_NAN
 #  define DBL_IS_NAN(x)     ((x) != (x))
 #endif
 #else
 #ifndef DBL_IS_NAN
-#if  defined  (HAVE_DECL_ISNAN)
+#if defined(HAVE_DECL_ISNAN)
 #  define DBL_IS_NAN(x)     (isnan(x))
-#elif  defined  (FP_NAN)
+#elif defined(FP_NAN)
 #  define DBL_IS_NAN(x)     (fpclassify(x) == FP_NAN)
 #else
 #  define DBL_IS_NAN(x)     ((x) != (x))
diff --git a/src/cdo_pthread.c b/src/cdo_pthread.c
index c5173c9..d373f2a 100644
--- a/src/cdo_pthread.c
+++ b/src/cdo_pthread.c
@@ -15,13 +15,13 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
 #include <stdio.h>
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 #include <limits.h>
 #include <pthread.h>
 #include "pthread_debug.h"
@@ -30,21 +30,21 @@
 
 void print_pthread_info()
 {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_attr_t attr;
   pthread_mutexattr_t m_attr;
   pthread_condattr_t c_attr;
 
-#if defined (PTHREAD_KEYS_MAX)
+#if defined(PTHREAD_KEYS_MAX)
   fprintf(stderr, "PTHREAD_KEYS_MAX    = %d\n", PTHREAD_KEYS_MAX);
 #endif
-#if defined (PTHREAD_DESTRUCTOR_ITERATIONS)
+#if defined(PTHREAD_DESTRUCTOR_ITERATIONS)
   fprintf(stderr, "PTHREAD_DESTRUCTOR_ITERATIONS = %d\n", PTHREAD_DESTRUCTOR_ITERATIONS);
 #endif
-#if defined (PTHREAD_THREADS_MAX)
+#if defined(PTHREAD_THREADS_MAX)
   fprintf(stderr, "PTHREAD_THREADS_MAX = %d\n", PTHREAD_THREADS_MAX);
 #endif
-#if defined (PTHREAD_STACK_MIN)
+#if defined(PTHREAD_STACK_MIN)
   fprintf(stderr, "PTHREAD_STACK_MIN   = %d\n", PTHREAD_STACK_MIN);
 #endif
 
diff --git a/src/cdo_vlist.c b/src/cdo_vlist.c
index 3903534..a5ea7c6 100644
--- a/src/cdo_vlist.c
+++ b/src/cdo_vlist.c
@@ -256,3 +256,15 @@ int vlistIsSzipped(int vlistID)
 }
 
 
+int vlistInqNWPV(int vlistID, int varID)
+{
+  int nwpv; // number of words per value; real:1  complex:2
+
+  if ( vlistInqVarDatatype(vlistID, varID) == DATATYPE_CPX32 || 
+       vlistInqVarDatatype(vlistID, varID) == DATATYPE_CPX64 )
+    nwpv = 2;
+  else
+    nwpv = 1;
+
+  return (nwpv);
+}
diff --git a/src/config.h.in b/src/config.h.in
index 1d8a446..93535f3 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -9,6 +9,9 @@
 /* Define to 1 for DATA support */
 #undef ENABLE_DATA
 
+/* Define to 1 if you have the <curl/curl.h> header file. */
+#undef HAVE_CURL_CURL_H
+
 /* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
    */
 #undef HAVE_DECL_ISNAN
@@ -46,6 +49,9 @@
 /* Define to 1 for GRIB1 decoding/encoding with cgribex */
 #undef HAVE_LIBCGRIBEX
 
+/* Define to 1 for CURL support */
+#undef HAVE_LIBCURL
+
 /* Define to 1 for EXTRA interface */
 #undef HAVE_LIBEXTRA
 
@@ -178,6 +184,9 @@
 /* Define to 1 if you have the <udunits2.h> header file. */
 #undef HAVE_UDUNITS2_H
 
+/* Define to 1 if you have the <udunits2/udunits2.h> header file. */
+#undef HAVE_UDUNITS2_UDUNITS2_H
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
diff --git a/src/dtypes.h b/src/dtypes.h
index 4072754..1a7c516 100644
--- a/src/dtypes.h
+++ b/src/dtypes.h
@@ -6,7 +6,7 @@
 
 /* INT32 */
 
-#if ! defined (INT_MAX)
+#if ! defined(INT_MAX)
 #  error INT_MAX undefined
 #endif
 
@@ -19,7 +19,7 @@
 
 /* INT64 */
 
-#if ! defined (LONG_MAX)
+#if ! defined(LONG_MAX)
 #  error LONG_MAX undefined
 #endif
 
diff --git a/src/ecacore.c b/src/ecacore.c
index 69bd0fd..291c855 100755
--- a/src/ecacore.c
+++ b/src/ecacore.c
@@ -113,6 +113,9 @@ void eca1(const ECA_REQUEST_1 *request)
 
   gridsize = gridInqSize(gridID);
 
+  field_init(&field1);
+  field_init(&field2);
+
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   if ( IS_SET(request->var2.h2) || IS_SET(request->var2.h3) ) 
     field2.ptr = (double *) malloc(gridsize*sizeof(double));
@@ -134,16 +137,19 @@ void eca1(const ECA_REQUEST_1 *request)
       
   for ( levelID = 0; levelID < nlevels; levelID++ )
     {
+      field_init(&var12[levelID]);
       var12[levelID].grid    = gridID;
       var12[levelID].nmiss   = 0;
       var12[levelID].missval = missval;
       var12[levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 
+      field_init(&samp1[levelID]);
       samp1[levelID].grid    = gridID;
       samp1[levelID].nmiss   = 0;
       samp1[levelID].missval = missval;
       samp1[levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 
+      field_init(&samp2[levelID]);
       samp2[levelID].grid    = gridID;
       samp2[levelID].nmiss   = 0;
       samp2[levelID].missval = missval;
@@ -151,6 +157,7 @@ void eca1(const ECA_REQUEST_1 *request)
 
       if ( IS_SET(request->var1.f3) )
         {
+	  field_init(&var13[levelID]);
           var13[levelID].grid    = gridID;
           var13[levelID].nmiss   = 0;
           var13[levelID].missval = missval;
@@ -158,6 +165,7 @@ void eca1(const ECA_REQUEST_1 *request)
         }
       if ( IS_SET(request->var2.h2) )
         {
+	  field_init(&var21[levelID]);
           var21[levelID].grid    = gridID;
           var21[levelID].nmiss   = 0;
           var21[levelID].missval = missval;
@@ -165,6 +173,7 @@ void eca1(const ECA_REQUEST_1 *request)
         }
       if ( IS_SET(request->var2.h3) )
         {
+	  field_init(&var23[levelID]);
           var23[levelID].grid    = gridID;
           var23[levelID].nmiss   = 0;
           var23[levelID].missval = missval;
@@ -322,12 +331,13 @@ void eca1(const ECA_REQUEST_1 *request)
 	    var = &var13[levelID];
 	  else 
 	    var = &var12[levelID];
-              
+
 	  farsel(var, samp1[levelID]);
 
 	  streamDefRecord(ostreamID, varID, levelID);
 	  streamWriteRecord(ostreamID, var->ptr, var->nmiss);
 	}
+
       if ( IS_SET(request->var2.h2) || IS_SET(request->var2.h3) )
 	{
 	  varID = 1;
@@ -475,6 +485,8 @@ void eca2(const ECA_REQUEST_2 *request)
 
   gridsize = gridInqSize(gridID);
 
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
@@ -494,21 +506,25 @@ void eca2(const ECA_REQUEST_2 *request)
       
   for ( levelID = 0; levelID < nlevels; levelID++ )
     {
+      field_init(&var14[levelID]);
       var14[levelID].grid    = gridID;
       var14[levelID].nmiss   = 0;
       var14[levelID].missval = missval1;
       var14[levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
       
+      field_init(&samp1[levelID]);
       samp1[levelID].grid    = gridID;
       samp1[levelID].nmiss   = 0;
       samp1[levelID].missval = missval1;
       samp1[levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 
+      field_init(&samp2[levelID]);
       samp2[levelID].grid    = gridID;
       samp2[levelID].nmiss   = 0;
       samp2[levelID].missval = missval1;
       samp2[levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 
+      field_init(&samp3[levelID]);
       samp3[levelID].grid    = gridID;
       samp3[levelID].nmiss   = 0;
       samp3[levelID].missval = missval1;
@@ -516,6 +532,7 @@ void eca2(const ECA_REQUEST_2 *request)
       
       if ( request->var1.epilog == PERCENT_OF_TOTAL_AMOUNT )
         {
+	  field_init(&total[levelID]);
           total[levelID].grid    = gridID;
           total[levelID].nmiss   = 0;
           total[levelID].missval = missval1;
@@ -523,6 +540,7 @@ void eca2(const ECA_REQUEST_2 *request)
         }
       if ( IS_SET(request->var1.f5) )
         {
+	  field_init(&var15[levelID]);
           var15[levelID].grid    = gridID;
           var15[levelID].nmiss   = 0;
           var15[levelID].missval = missval1;
@@ -530,6 +548,7 @@ void eca2(const ECA_REQUEST_2 *request)
         }
       if ( IS_SET(request->var2.h2) )
         {
+	  field_init(&var22[levelID]);
           var22[levelID].grid    = gridID;
           var22[levelID].nmiss   = 0;
           var22[levelID].missval = missval1;
@@ -840,6 +859,8 @@ void eca3(const ECA_REQUEST_3 *request)
 
   gridsize = gridInqSize(gridID);
 
+  field_init(&field1);
+  field_init(&field2);
   field1.ptr = (double *) malloc(gridsize*sizeof(double));
   field2.ptr = (double *) malloc(gridsize*sizeof(double));
 
@@ -850,11 +871,13 @@ void eca3(const ECA_REQUEST_3 *request)
         
   for ( levelID = 0; levelID < nlevels; levelID++ )
     {
+      field_init(&var1[levelID]);
       var1[levelID].grid    = gridID;
       var1[levelID].nmiss   = 0;
       var1[levelID].missval = missval;
       var1[levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
             
+      field_init(&var2[levelID]);
       var2[levelID].grid    = gridID;
       var2[levelID].nmiss   = 0;
       var2[levelID].missval = missval;
@@ -1069,10 +1092,13 @@ void eca4(const ECA_REQUEST_4 *request)
 
   /* Two fields are needed because of the definition of gsl for northern and
   * southern hemisphere                                                      */
+  field_init(&fieldGt);
+  field_init(&fieldLt);
   fieldGt.ptr = (double *) malloc(gridsize*sizeof(double));
   fieldLt.ptr = (double *) malloc(gridsize*sizeof(double));
 
   /* field for the land-water-distribution */
+  field_init(&mask);
   mask.ptr    = (double *) malloc(gridsize*sizeof(double));
 
   nlevels     = zaxisInqSize(zaxisID);
@@ -1093,24 +1119,30 @@ void eca4(const ECA_REQUEST_4 *request)
 
   for ( levelID = 0; levelID < nlevels; levelID++ )
   {
+    field_init(&startCount[levelID]);
     startCount[levelID].grid     = gridID;
     startCount[levelID].size     = gridsize;
     startCount[levelID].nmiss    = 0;
     startCount[levelID].missval  = missval;
     startCount[levelID].ptr      = (double *) malloc(gridsize*sizeof(double));
+    memset(startCount[levelID].ptr, 0, gridsize*sizeof(double));
 
+    field_init(&endCount[levelID]);
     endCount[levelID].grid       = gridID;
     endCount[levelID].size       = gridsize;
     endCount[levelID].nmiss      = 0;
     endCount[levelID].missval    = missval;
     endCount[levelID].ptr        = (double *) malloc(gridsize*sizeof(double));
+    memset(endCount[levelID].ptr, 0, gridsize*sizeof(double));
 
+    field_init(&gslDuration[levelID]);
     gslDuration[levelID].grid    = gridID;
     gslDuration[levelID].size    = gridsize;
     gslDuration[levelID].nmiss   = 0;
     gslDuration[levelID].missval = missval;
     gslDuration[levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 
+    field_init(&gslFirstDay[levelID]);
     gslFirstDay[levelID].grid    = gridID;
     gslFirstDay[levelID].size    = gridsize;
     gslFirstDay[levelID].nmiss   = 0;
@@ -1119,12 +1151,14 @@ void eca4(const ECA_REQUEST_4 *request)
 
     for ( int h = 0; h < 2; h++ )
     {
+      field_init(&startDateWithHist[h][levelID]);
       startDateWithHist[h][levelID].grid    = gridID;
       startDateWithHist[h][levelID].size    = gridsize;
       startDateWithHist[h][levelID].nmiss   = 0;
       startDateWithHist[h][levelID].missval = missval;
       startDateWithHist[h][levelID].ptr     = (double *) malloc(gridsize*sizeof(double));
 
+      field_init(&endDateWithHist[h][levelID]);
       endDateWithHist[h][levelID].grid      = gridID;
       endDateWithHist[h][levelID].size      = gridsize;
       endDateWithHist[h][levelID].nmiss     = 0;
@@ -1188,8 +1222,8 @@ void eca4(const ECA_REQUEST_4 *request)
                       startDateWithHist[0][levelID].ptr[i] = missval;
                       endDateWithHist[0][levelID].ptr[i]   = missval;
                     }
-                  gslDuration[levelID].nmiss          = missval;
-                  gslFirstDay[levelID].nmiss          = missval;
+                  gslDuration[levelID].nmiss          = 0;
+                  gslFirstDay[levelID].nmiss          = 0;
                   /* reinitialize the current year */
                   startDateWithHist[0][levelID].nmiss = gridsize;
                   endDateWithHist[0][levelID].nmiss   = gridsize;
@@ -1243,11 +1277,11 @@ void eca4(const ECA_REQUEST_4 *request)
               }
               if ( 7 == month && !resetAtJul )
               {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp sections
 #endif
                 {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp section
 #endif
                   {
@@ -1264,7 +1298,7 @@ void eca4(const ECA_REQUEST_4 *request)
                           }
                       }
                   }
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp section
 #endif
                   {
@@ -1286,11 +1320,11 @@ void eca4(const ECA_REQUEST_4 *request)
               }
 
               /* count the day with temperature larger/smaller than the given limit */
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp sections
 #endif
               {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp section
 #endif
                 {
@@ -1298,7 +1332,7 @@ void eca4(const ECA_REQUEST_4 *request)
                   request->s1(&fieldGt        , request->s1arg);
                   farnum2(&startCount[levelID], fieldGt);
                 }
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp section
 #endif
                 {
@@ -1439,12 +1473,12 @@ void eca4(const ECA_REQUEST_4 *request)
               }
             isFirstYear = FALSE;
           }
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp sections
 #endif
           {
             updateHist(startDateWithHist, nlevels, gridsize, yvals, FALSE);
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp section
 #endif
             updateHist(endDateWithHist,   nlevels, gridsize, yvals, TRUE);
diff --git a/src/ecautil.c b/src/ecautil.c
index 1dbda32..ae2511d 100755
--- a/src/ecautil.c
+++ b/src/ecautil.c
@@ -395,7 +395,7 @@ void farsel(field_t *field1, field_t field2)
       for ( i = 0; i < len; i++ )
         if ( IS_EQUAL(array2[i], 0.0) ) array1[i] = missval1;
     }
-      
+
   field1->nmiss = 0;
   for ( i = 0; i < len; i++ )
     if ( DBL_IS_EQUAL(array1[i], missval1) ) field1->nmiss++;
@@ -544,14 +544,18 @@ void computeGsl(int nlevels, int gridsize, double *yvals, double missval,
                 {
                   duration = (double) (date_to_julday(CALENDAR_PROLEPTIC, (int)   endDateWithHist[0][levelID].ptr[i]) -
                                        date_to_julday(CALENDAR_PROLEPTIC, (int) startDateWithHist[1][levelID].ptr[i]));
-                  firstDay = (double) day_of_year((int) startDateWithHist[1][levelID].ptr[i]);
                 }
               else
                 {
                   duration = (double) (date_to_julday(CALENDAR_PROLEPTIC, (int)   endDateWithHist[1][levelID].ptr[i]) -
                                        date_to_julday(CALENDAR_PROLEPTIC, (int) startDateWithHist[1][levelID].ptr[i]));
-                  firstDay = (double) day_of_year((int) startDateWithHist[1][levelID].ptr[i]);
                 }
+
+	      if ( DBL_IS_EQUAL(startDateWithHist[1][levelID].ptr[i], missval) )
+		firstDay = missval;
+	      else
+		firstDay = (double) day_of_year((int) startDateWithHist[1][levelID].ptr[i]);
+
               gslDuration[levelID].ptr[i] = duration;
               gslFirstDay[levelID].ptr[i] = firstDay;
             }
@@ -574,7 +578,11 @@ void computeGsl(int nlevels, int gridsize, double *yvals, double missval,
                 {
                   duration = (double) (date_to_julday(CALENDAR_PROLEPTIC, (int)   endDateWithHist[0][levelID].ptr[i]) -
                                        date_to_julday(CALENDAR_PROLEPTIC, (int) startDateWithHist[0][levelID].ptr[i]));
-                  firstDay = (double) day_of_year((int) startDateWithHist[0][levelID].ptr[i]);
+
+		  if ( DBL_IS_EQUAL(startDateWithHist[0][levelID].ptr[i], missval) )
+		    firstDay = missval;
+		  else
+		    firstDay = (double) day_of_year((int) startDateWithHist[0][levelID].ptr[i]);
 
                   gslDuration[levelID].ptr[i] = duration;
                   gslFirstDay[levelID].ptr[i] = firstDay;
diff --git a/src/expr.c b/src/expr.c
index 2751fea..0a5a1cf 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -28,19 +28,29 @@ static func_t fun_sym_tbl[] =
 {
   /* scalar functions */
   {0, "abs",   f_abs},
+  {0, "floor", floor},
+  {0, "ceil",  ceil},
   {0, "int",   f_int},
   {0, "nint",  f_nint},
   {0, "sqr",   f_sqr},
   {0, "sqrt",  sqrt},
   {0, "exp",   exp},
+  {0, "erf",   erf},
   {0, "log",   log},
   {0, "log10", log10},
   {0, "sin",   sin},
   {0, "cos",   cos},
   {0, "tan",   tan},
+  {0, "sinh",  sinh},
+  {0, "cosh",  cosh},
+  {0, "tanh",  tanh},
   {0, "asin",  asin},
   {0, "acos",  acos},
   {0, "atan",  atan},
+  {0, "asinh", asinh},
+  {0, "acosh", acosh},
+  {0, "atanh", atanh},
+  {0, "gamma", gamma},
 
   /* array functions
   {1, "min",   min},
diff --git a/src/expr_lex.c b/src/expr_lex.c
index 62d7cf7..7fcfe34 100644
--- a/src/expr_lex.c
+++ b/src/expr_lex.c
@@ -31,7 +31,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -95,11 +95,11 @@ typedef unsigned int flex_uint32_t;
 #else	/* ! __cplusplus */
 
 /* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
+#if defined(__STDC__)
 
 #define YY_USE_CONST
 
-#endif	/* defined (__STDC__) */
+#endif	/* defined(__STDC__) */
 #endif	/* ! __cplusplus */
 
 #ifdef YY_USE_CONST
diff --git a/src/features.c b/src/features.c
new file mode 100644
index 0000000..85cf4a5
--- /dev/null
+++ b/src/features.c
@@ -0,0 +1,114 @@
+#if defined(HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
+#if defined(HAVE_ZLIB_H)
+#include <zlib.h>
+#endif
+
+#if defined(HAVE_LIBXML2)
+#include <libxml/xmlversion.h>
+#endif
+
+#if defined(HAVE_CURL_CURL_H)
+#include <curl/curl.h>
+#endif
+
+#if defined(HAVE_PROJ_API_H)
+#include <proj_api.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+void printFeatures(void)
+{
+  fprintf(stderr, "Features:");
+#if defined(HAVE_LIBPTHREAD)
+  fprintf(stderr, " PTHREADS");
+#endif
+#if defined(_OPENMP)
+  fprintf(stderr, " OpenMP");
+#endif
+#if  defined(HAVE_NETCDF4)
+  fprintf(stderr, " NC4");
+#endif
+#if  defined(HAVE_LIBNC_DAP)
+  fprintf(stderr, " OPeNDAP");
+#endif
+#if defined(HAVE_LIBSZ)
+  fprintf(stderr, " SZ");
+#endif
+#if defined(HAVE_LIBZ)
+  fprintf(stderr, " Z");
+#endif
+#if defined(HAVE_LIBJASPER)
+  fprintf(stderr, " JASPER");
+#endif
+#if defined(HAVE_LIBUDUNITS2)
+  fprintf(stderr, " UDUNITS2");
+#endif
+#if defined(HAVE_LIBPROJ)
+  fprintf(stderr, " PROJ.4");
+#endif
+#if defined(HAVE_LIBXML2)
+  fprintf(stderr, " XML2");
+#endif
+#if defined(HAVE_LIBMAGICS)
+  fprintf(stderr, " MAGICS");
+#endif
+#if defined(HAVE_LIBDRMAA)
+  fprintf(stderr, " DRMAA");
+#endif
+#if defined(HAVE_LIBCURL)
+  fprintf(stderr, " CURL");
+#endif
+  fprintf(stderr, "\n");
+}
+
+
+void printLibraries(void)
+{
+  fprintf(stderr, "Libraries:");
+  /*
+#if defined(HAVE_LIBZ)
+  {
+    fprintf(stderr, " zlib/%s", zlibVersion());
+#if defined(ZLIB_VERSION)
+    if ( strcmp(ZLIB_VERSION, zlibVersion()) != 0 )
+      fprintf(stderr, "(h%s)", ZLIB_VERSION);
+#else
+    fprintf(stderr, "(header not found)");
+#endif
+  }
+#endif
+  */
+#if defined(HAVE_LIBPROJ)
+  fprintf(stderr, " proj");
+#if defined(PJ_VERSION)
+  fprintf(stderr, "/%g", PJ_VERSION*0.01);
+#endif
+#endif
+
+#if defined(HAVE_LIBXML2)
+  fprintf(stderr, " xml2");
+#if defined(LIBXML_DOTTED_VERSION)
+  fprintf(stderr, "/%s", LIBXML_DOTTED_VERSION);
+#endif
+#endif
+
+#if defined(HAVE_LIBCURL)
+  {
+    curl_version_info_data *version_data = curl_version_info(CURLVERSION_NOW);
+    fprintf(stderr, " curl/%s", version_data->version);
+#if defined(LIBCURL_VERSION)
+    if ( strcmp(LIBCURL_VERSION, version_data->version) != 0 )
+      fprintf(stderr, "(h%s)", LIBCURL_VERSION);
+#else
+    fprintf(stderr, "(header not found)");
+#endif
+  }
+#endif
+
+  fprintf(stderr, "\n");
+}
diff --git a/src/field.c b/src/field.c
index 7cbcbda..1ead9c2 100644
--- a/src/field.c
+++ b/src/field.c
@@ -625,7 +625,7 @@ double crps_det_integrate(double *a, const double d, const size_t n)
   double area = 0; 
   //  double tmp;
   size_t i;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( n>10000 ) shared(a) private(i) \
   reduction(+:area) schedule(static,10000) 
 #endif                                                     /* **************************** */
diff --git a/src/field.h b/src/field.h
index 3795964..57fae7f 100644
--- a/src/field.h
+++ b/src/field.h
@@ -49,6 +49,7 @@ double _FSQRT_(const double x, const double missval1);
 
 
 typedef struct {
+  int      nwpv; // number of words per value; real:1  complex:2
   int      grid;
   int      zaxis;
   size_t   size;
@@ -60,8 +61,10 @@ typedef struct {
 }
 field_t;
 
+
 /* fieldmem.c */
 
+void      field_init(field_t *field);
 field_t **field_malloc(const int vlistID, const int ptype);
 field_t **field_calloc(const int vlistID, const int ptype);
 void      field_free(field_t **field, const int vlistID);
diff --git a/src/field2.c b/src/field2.c
index 8c102a9..7c3586f 100644
--- a/src/field2.c
+++ b/src/field2.c
@@ -72,6 +72,7 @@ void arradd(const size_t n, double * const restrict a, const double * const rest
 void faradd(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -82,9 +83,11 @@ void faradd(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
@@ -106,6 +109,7 @@ void faradd(field_t *field1, field_t field2)
 void farsum(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -116,9 +120,11 @@ void farsum(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
@@ -159,12 +165,13 @@ void farsumtr(field_t *occur, field_t field, const double refval)
   double  *farray = field.ptr;
 
   len    = (size_t) gridInqSize(occur->grid);
+
   if ( len != (size_t) gridInqSize(field.grid) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( occur->nmiss > 0 || field.nmiss > 0 )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) schedule(static)
 #endif
       for ( i = 0; i < len; i++ )
@@ -187,7 +194,7 @@ void farsumtr(field_t *occur, field_t field, const double refval)
     }
   else
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared)
 #endif
       for ( i = 0; i < len; i++ ) 
@@ -199,6 +206,7 @@ void farsumtr(field_t *occur, field_t field, const double refval)
 void farsumq(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -209,9 +217,11 @@ void farsumq(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
@@ -240,6 +250,7 @@ void farsumq(field_t *field1, field_t field2)
 void farsub(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -249,9 +260,11 @@ void farsub(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
@@ -274,6 +287,7 @@ void farsub(field_t *field1, field_t field2)
 void farmul(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -283,9 +297,11 @@ void farmul(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
@@ -308,6 +324,7 @@ void farmul(field_t *field1, field_t field2)
 void fardiv(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
@@ -315,9 +332,11 @@ void fardiv(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   for ( i = 0; i < len; i++ ) 
@@ -332,6 +351,7 @@ void fardiv(field_t *field1, field_t field2)
 void faratan2(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
@@ -339,9 +359,11 @@ void faratan2(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   for ( i = 0; i < len; i++ ) 
@@ -356,6 +378,7 @@ void faratan2(field_t *field1, field_t field2)
 void farmin(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -365,9 +388,11 @@ void farmin(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
@@ -394,6 +419,7 @@ void farmin(field_t *field1, field_t field2)
 void farmax(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -403,9 +429,11 @@ void farmax(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
@@ -432,6 +460,7 @@ void farmax(field_t *field1, field_t field2)
 void farvar(field_t *field1, field_t field2, field_t field3)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -444,9 +473,11 @@ void farvar(field_t *field1, field_t field2, field_t field3)
   const double missval3 = field3.missval;
   double *array3  = field3.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 || nmiss3 > 0 )
@@ -484,6 +515,7 @@ void farvar(field_t *field1, field_t field2, field_t field3)
 void farvarx(field_t *field1, field_t field2, field_t field3, const double divisor)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
@@ -493,9 +525,11 @@ void farvarx(field_t *field1, field_t field2, field_t field3, const double divis
   double *array3  = field3.ptr;
   double temp;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   for ( i = 0; i < len; i++ )
@@ -518,14 +552,17 @@ void farvarx(field_t *field1, field_t field2, field_t field3, const double divis
 void farstd(field_t *field1, field_t field2, field_t field3)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
   int    grid2    = field2.grid;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   farvar(field1, field2, field3);
@@ -547,14 +584,17 @@ void farstd(field_t *field1, field_t field2, field_t field3)
 void farstdx(field_t *field1, field_t field2, field_t field3, const double divisor)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
   const int    grid2    = field2.grid;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   farvarx(field1, field2, field3, divisor);
@@ -576,6 +616,7 @@ void farstdx(field_t *field1, field_t field2, field_t field3, const double divis
 void farcvar(field_t *field1, field_t field2, const double rconst1)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -586,9 +627,11 @@ void farcvar(field_t *field1, field_t field2, const double rconst1)
   double *array2  = field2.ptr;
   int    nmiss3   = 0;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( DBL_IS_EQUAL(rconst1, missval1) ) nmiss3 = 1;
@@ -628,6 +671,7 @@ void farcvar(field_t *field1, field_t field2, const double rconst1)
 void farcvarx(field_t *field1, field_t field2, const double rconst1, const double divisor)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
@@ -636,9 +680,11 @@ void farcvarx(field_t *field1, field_t field2, const double rconst1, const doubl
   double *array2  = field2.ptr;
   double temp;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   for ( i = 0; i < len; i++ )
@@ -661,14 +707,17 @@ void farcvarx(field_t *field1, field_t field2, const double rconst1, const doubl
 void farcstd(field_t *field1, field_t field2, const double rconst1)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
   const int    grid2    = field2.grid;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   farcvar(field1, field2, rconst1);
@@ -690,14 +739,17 @@ void farcstd(field_t *field1, field_t field2, const double rconst1)
 void farcstdx(field_t *field1, field_t field2, const double rconst1, const double divisor)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
   const int    grid2    = field2.grid;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   farcvarx(field1, field2, rconst1, divisor);
@@ -719,6 +771,7 @@ void farcstdx(field_t *field1, field_t field2, const double rconst1, const doubl
 void farmoq(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const double missval1 = field1->missval;
   double *array1  = field1->ptr;
@@ -727,9 +780,11 @@ void farmoq(field_t *field1, field_t field2)
   double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  len = (size_t) (nwpv*gridInqSize(grid1));
+
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss2 > 0 )
@@ -769,6 +824,7 @@ void farmoq(field_t *field1, field_t field2)
 void farcount(field_t *field1, field_t field2)
 {
   size_t   i, len;
+  int          nwpv     = field1->nwpv;
   const int    grid1    = field1->grid;
   const int    nmiss1   = field1->nmiss;
   const double missval1 = field1->missval;
@@ -779,9 +835,11 @@ void farcount(field_t *field1, field_t field2)
   const double missval2 = field2.missval;
   double *array2  = field2.ptr;
 
-  len    = (size_t) gridInqSize(grid1);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len = (size_t) (nwpv*gridInqSize(grid1));
 
-  if ( len != (size_t) gridInqSize(grid2) )
+  if ( len != (size_t) (nwpv*gridInqSize(grid2)) )
     cdoAbort("Fields have different gridsize (%s)", __func__);
 
   if ( nmiss1 > 0 || nmiss2 > 0 )
diff --git a/src/fieldc.c b/src/fieldc.c
index 3a1cdeb..5b34853 100644
--- a/src/fieldc.c
+++ b/src/fieldc.c
@@ -33,13 +33,16 @@ void farcfun(field_t *field, double rconst, int function)
 void farcmul(field_t *field, double rconst)
 {
   int i, len;
+  int    nwpv     = field->nwpv;
   int    grid     = field->grid;
   int    nmiss    = field->nmiss;
   double missval1 = field->missval;
   double missval2 = field->missval;
   double *array   = field->ptr;
 
-  len    = gridInqSize(grid);
+  if ( nwpv != 2 ) nwpv = 1;
+
+  len    = nwpv*gridInqSize(grid);
 
   if ( nmiss > 0 )
     {
@@ -49,7 +52,7 @@ void farcmul(field_t *field, double rconst)
   else
     {
       /*
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i)
 #endif
       */
diff --git a/src/fieldmem.c b/src/fieldmem.c
index e2789aa..b5a82e3 100644
--- a/src/fieldmem.c
+++ b/src/fieldmem.c
@@ -2,15 +2,23 @@
 #include <string.h>
 
 #include <cdi.h>
+#include <cdo.h>
 #include "dmemory.h"
 #include "field.h"
 
 
+void field_init(field_t *field)
+{
+  memset(field, 0, sizeof(field_t));
+}
+
+
 field_t **field_allocate(int vlistID, int ptype, int init)
 {
   int nvars, nlevel;
   int varID, zaxisID, levelID;
   int gridID, gridsize;
+  int nwpv; // number of words per value; real:1  complex:2
   double missval;
   field_t **field;
 
@@ -20,6 +28,7 @@ field_t **field_allocate(int vlistID, int ptype, int init)
 
   for ( varID = 0; varID < nvars; ++varID )
     {
+      nwpv     = vlistInqNWPV(vlistID, varID);
       gridID   = vlistInqVarGrid(vlistID, varID);
       gridsize = gridInqSize(gridID);
       zaxisID  = vlistInqVarZaxis(vlistID, varID);
@@ -29,6 +38,9 @@ field_t **field_allocate(int vlistID, int ptype, int init)
       field[varID] = (field_t *)  malloc(nlevel*sizeof(field_t));
       for ( levelID = 0; levelID < nlevel; ++levelID )
 	{
+	  field_init(&field[varID][levelID]);
+
+	  field[varID][levelID].nwpv    = nwpv;
 	  field[varID][levelID].grid    = gridID;
 	  field[varID][levelID].nsamp   = 0;
 	  field[varID][levelID].nmiss   = 0;
@@ -38,14 +50,14 @@ field_t **field_allocate(int vlistID, int ptype, int init)
 
 	  if ( ptype == FIELD_ALL || ptype == FIELD_PTR )
 	    {
-	      field[varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
-	      if ( init ) memset(field[varID][levelID].ptr, 0, gridsize*sizeof(double));
+	      field[varID][levelID].ptr = (double *) malloc(nwpv*gridsize*sizeof(double));
+	      if ( init ) memset(field[varID][levelID].ptr, 0, nwpv*gridsize*sizeof(double));
 	    }
 
 	  if ( ptype == FIELD_ALL || ptype == FIELD_PTR )
 	    {
-	      field[varID][levelID].weight = (double *) malloc(gridsize*sizeof(double));
-	      if ( init ) memset(field[varID][levelID].weight, 0, gridsize*sizeof(double));
+	      field[varID][levelID].weight = (double *) malloc(nwpv*gridsize*sizeof(double));
+	      if ( init ) memset(field[varID][levelID].weight, 0, nwpv*gridsize*sizeof(double));
 	    }    
 	}
     }
diff --git a/src/fouriertrans.c b/src/fouriertrans.c
index 0f0fc90..e604b30 100644
--- a/src/fouriertrans.c
+++ b/src/fouriertrans.c
@@ -6,7 +6,7 @@
 #  include "dmemory.h"
 #endif
 
-#if defined (SX)
+#if defined(SX)
 #  define  NFFT  1024
 #else
 #  define  NFFT  64
@@ -63,13 +63,13 @@ void fft_set(double *trigs, long *ifax, long n)
 
   ifax[0] = nfax;
 
-#if defined (CRAY)
+#if defined(CRAY)
 #pragma _CRI novector
 #endif
-#if defined (SX)
+#if defined(SX)
 #pragma vdir novector
 #endif
-#if defined (__uxp__)
+#if defined(__uxp__)
 #pragma loop scalar
 #endif
   for ( k = 0; k < nfax / 2; k++ )
@@ -157,7 +157,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -189,7 +189,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -219,7 +219,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -239,7 +239,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -273,7 +273,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -312,7 +312,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -352,7 +352,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -376,7 +376,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -415,7 +415,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -459,7 +459,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -508,7 +508,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -534,7 +534,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -574,7 +574,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -631,7 +631,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -695,7 +695,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -730,7 +730,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -779,7 +779,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -838,7 +838,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -898,7 +898,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -926,7 +926,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -985,7 +985,7 @@ int rpassc(double *a, double *b, double *c, double *d, double *trigs,
 	  {
 	    i = ibase;
 	    j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 	    for (ijk = 0; ijk < lot; ++ijk)
@@ -1088,7 +1088,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1119,7 +1119,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -1146,7 +1146,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1167,7 +1167,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1200,7 +1200,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1236,7 +1236,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -1277,7 +1277,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1301,7 +1301,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1338,7 +1338,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1383,7 +1383,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -1430,7 +1430,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1453,7 +1453,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1497,7 +1497,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1551,7 +1551,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -1619,7 +1619,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1656,7 +1656,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1714,7 +1714,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1774,7 +1774,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 		      {
 			i = ibase;
 			j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 			for (ijk = 0; ijk < lot; ++ijk)
@@ -1844,7 +1844,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1875,7 +1875,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	      {
 		i = ibase;
 		j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 		for (ijk = 0; ijk < lot; ++ijk)
@@ -1935,7 +1935,7 @@ int qpassc(double *a, double *b, double *c, double *d, double *trigs,
 	  {
 	    i = ibase;
 	    j = jbase;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 	    for (ijk = 0; ijk < lot; ++ijk)
@@ -2006,13 +2006,13 @@ void fc2gp(double *trig, long *ifax, double *fc, double *gp, long nlat, long nlo
   lot  = nlev * nlat;
 
   wfc = (double *) malloc(lot*jump*sizeof(double));
-#if ! defined (_OPENMP)
+#if ! defined(_OPENMP)
   wgp = (double *) malloc(lot*jump*sizeof(double));
 #endif
 
   for ( lev = 0; lev < nlev; ++lev )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(lat, fou, wix, rix)
 #endif
       for ( lat = 0; lat < nlat; ++lat )
@@ -2043,12 +2043,12 @@ void fc2gp(double *trig, long *ifax, double *fc, double *gp, long nlat, long nlo
       nvex = NFFT;
     }
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(istart, nvex, ix, ii, jj, i, j, k, ia, la, ifac, ibase, jbase, wgp)
 #endif
   for ( nb = 0; nb < nblox; nb++ )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       wgp = (double *) malloc(lot*jump*sizeof(double));
 #endif
       istart = istartv[nb];
@@ -2056,7 +2056,7 @@ void fc2gp(double *trig, long *ifax, double *fc, double *gp, long nlat, long nlo
       else           nvex = NFFT;
 
       i = istart;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
       for ( j = 0; j < nvex; j++ )
@@ -2113,7 +2113,7 @@ void fc2gp(double *trig, long *ifax, double *fc, double *gp, long nlat, long nlo
       /* Fill in zeros at end */
 
       ix = istart + nlon;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
       for ( j = 0; j < nvex; j++ )
@@ -2123,14 +2123,14 @@ void fc2gp(double *trig, long *ifax, double *fc, double *gp, long nlat, long nlo
           ix = ix + jump;
 	}
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       free(wgp);
 #endif
     }
 
   wpt = wfc;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(j, lon)
 #endif
   for ( j = 0; j < lot; ++j )
@@ -2138,7 +2138,7 @@ void fc2gp(double *trig, long *ifax, double *fc, double *gp, long nlat, long nlo
       gp[lon + j*nlon] = wpt[lon + j*jump];
 
   free(istartv);
-#if ! defined (_OPENMP)
+#if ! defined(_OPENMP)
   free(wgp);
 #endif
   free(wfc);
@@ -2235,7 +2235,7 @@ void gp2fc(double *trig, long *ifax, double *gp, double *fc, long nlat, long nlo
       /* Shift a(0) & fill in zero imag parts */
 
       ix = istart;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
       for ( j = 0; j < nvex; j++ )
diff --git a/src/grid.c b/src/grid.c
index ec8a722..8768009 100644
--- a/src/grid.c
+++ b/src/grid.c
@@ -14,14 +14,18 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
+#if defined(_OPENMP)
+#  include <omp.h>
+#endif
+
 #include <stdio.h>
 #include <stdarg.h> /* va_list */
 
-#if defined (HAVE_LIBPROJ)
+#if defined(HAVE_LIBPROJ)
 #  include "proj_api.h"
 #endif
 
@@ -31,13 +35,15 @@
 #include "error.h"
 #include "grid.h"
 
+int referenceToGrid(int gridID1);
+
 
 static
 void scale_vec(double scalefactor, long nvals, double *restrict values)
 {
   long n;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) shared(nvals, scalefactor, values)
 #endif
   for ( n = 0; n < nvals; ++n )
@@ -265,7 +271,7 @@ void gridGenXbounds2D(int nx, int ny, const double * restrict xbounds, double *
   long i, j, index;
   double minlon, maxlon;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none)        \
   shared(nx, ny, xbounds, xbounds2D)	      \
   private(i, j, minlon, maxlon, index)
@@ -292,7 +298,7 @@ void gridGenYbounds2D(int nx, int ny, const double * restrict ybounds, double *
   long i, j, index;
   double minlat, maxlat;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none)        \
   shared(nx, ny, ybounds, ybounds2D)	      \
   private(i, j, minlat, maxlat, index)
@@ -383,7 +389,7 @@ void lcc_to_geo(int gridID, int gridsize, double *xvals, double *yvals)
 static
 void sinusoidal_to_geo(int gridsize, double *xvals, double *yvals)
 {
-#if defined (HAVE_LIBPROJ)
+#if defined(HAVE_LIBPROJ)
   projPJ   *libProj;
   char *params[20];
   int nbpar=0;
@@ -420,7 +426,7 @@ void sinusoidal_to_geo(int gridsize, double *xvals, double *yvals)
 static
 void laea_to_geo(int gridID, int gridsize, double *xvals, double *yvals)
 {
-#if defined (HAVE_LIBPROJ)
+#if defined(HAVE_LIBPROJ)
   projPJ   *libProj;
   char *params[20];
   int nbpar=0;
@@ -464,7 +470,7 @@ void laea_to_geo(int gridID, int gridsize, double *xvals, double *yvals)
 static
 void lcc2_to_geo(int gridID, int gridsize, double *xvals, double *yvals)
 {
-#if defined (HAVE_LIBPROJ)
+#if defined(HAVE_LIBPROJ)
   projPJ   *libProj;
   char *params[20];
   int nbpar=0;
@@ -507,37 +513,212 @@ void lcc2_to_geo(int gridID, int gridsize, double *xvals, double *yvals)
 #endif
 }
 
+/*
+ * grib_get_reduced_row: code from GRIB_API 1.10.4
+ *
+ * Description:
+ *   computes the number of points within the range lon_first->lon_last and the zero based indexes
+ *   ilon_first,ilon_last of the first and last point given the number of points along a parallel (pl)
+ *
+ */
+static
+void grib_get_reduced_row(long pl,double lon_first,double lon_last,long* npoints,long* ilon_first, long* ilon_last )
+{
+  double range=0,dlon_first=0,dlon_last=0;
+  long irange;
+
+  range=lon_last-lon_first;
+  if (range<0) {range+=360;lon_first-=360;}
+
+  /* computing integer number of points and coordinates without using floating point resolution*/
+  *npoints=(range*pl)/360.0+1;
+  *ilon_first=(lon_first*pl)/360.0;
+  *ilon_last=(lon_last*pl)/360.0;
+
+  irange=*ilon_last-*ilon_first+1;
+
+  if (irange != *npoints) {
+    if (irange > *npoints) {
+      /* checking if the first point is out of range*/
+      dlon_first=((*ilon_first)*360.0)/pl;
+      if (dlon_first < lon_first) {(*ilon_first)++;irange--;
+      }
+
+      /* checking if the last point is out of range*/
+      dlon_last=((*ilon_last)*360.0)/pl;
+      if (dlon_last > lon_last) {(*ilon_last)--;irange--;
+      }
+    } else {
+      int ok=0;
+      /* checking if the point before the first is in the range*/
+      dlon_first=((*ilon_first-1)*360.0)/pl;
+      if (dlon_first > lon_first) {(*ilon_first)--;irange++;ok=1;
+      }
+
+      /* checking if the point after the last is in the range*/
+      dlon_last=((*ilon_last+1)*360.0)/pl;
+      if (dlon_last < lon_last) {(*ilon_last)++;irange++;ok=1;
+      }
+
+      /* if neither of the two are triggered then npoints is too large */
+      if (!ok) {(*npoints)--;
+      }
+    }
+
+    //   assert(*npoints==irange);
+  } else {
+	  /* checking if the first point is out of range*/
+	  dlon_first=((*ilon_first)*360.0)/pl;
+	  if (dlon_first < lon_first) {
+		  (*ilon_first)++;(*ilon_last)++;
+	  }
+  }
+
+  if (*ilon_first<0) *ilon_first+=pl;
+
+  return;
+}
+
+
 int    qu2reg3(double *pfield, int *kpoint, int klat, int klon,
 	       double msval, int *kret, int omisng, int operio, int oveggy);
 
+static
+int qu2reg_subarea(int gridsize, int np, double xfirst, double xlast, 
+		   double *array, int *rowlon, int ny, double missval, int *iret, int lmiss, int lperio, int lveggy)
+{
+  int nx = 0;
+  /* sub area (longitudes) */
+  long ilon_firstx;
+  long ilon_first, ilon_last;
+  int i, j;
+  long row_count;
+  int rlon, nwork = 0;
+  int np4 = np*4;
+  int size = 0;
+  int wlen;
+  double *work, **pwork;
+  int ii;
+  double *parray;
+
+  if ( np <= 0 ) cdoAbort("Number of values between pole and equator missing!");
+
+  grib_get_reduced_row(np4, xfirst, xlast, &row_count, &ilon_firstx, &ilon_last);
+  nx = row_count;
+  // printf("nx %d  %ld %ld lon1 %g lon2 %g\n", nx, ilon_firstx, ilon_last, (ilon_firstx*360.)/np4, (ilon_last*360.)/np4);
+
+  for ( j = 0; j < ny; ++j ) nwork += rowlon[j];
+
+  pwork = (double **) malloc(ny*sizeof(double *));
+  work  = (double *) malloc(ny*np4*sizeof(double));
+  wlen = 0;
+  pwork[0] = work;
+  for ( j = 1; j < ny; ++j )
+    {
+      wlen += rowlon[j-1];
+      pwork[j] = work + wlen;
+    } 
+  // printf(" ny, np4, nwork %d %d %d wlen %d\n", ny, np4, nwork, wlen);
+
+  for ( j = 0; j < ny; ++j )
+    {
+      rlon = rowlon[j];
+      for ( i = 0; i < rlon; ++i ) pwork[j][i] = missval;
+    } 
+
+  parray = array;
+  for ( j = 0; j < ny; ++j )
+    {
+      rlon = rowlon[j];
+      row_count = 0;
+      grib_get_reduced_row(rlon, xfirst, xlast, &row_count, &ilon_first, &ilon_last);
+      // printf("j %d xfirst %g xlast %g rowlon %d %ld %ld %ld %g %g\n", j, xfirst, xlast, rlon, row_count, ilon_first, ilon_last, (ilon_first*360.)/rlon, (ilon_last*360.)/rlon);
+
+      for ( i = ilon_first; i < (ilon_first+row_count); ++i )
+	{
+	  ii = i;
+	  if ( ii >= rlon ) ii -= rlon; 
+	  pwork[j][ii] = *parray;
+	  parray++;
+	}
+      size += row_count;
+    }
+
+  if ( gridsize != size ) cdoAbort("gridsize1 inconsistent!");
+
+  (void) qu2reg3(work, rowlon, ny, np4, missval, iret, lmiss, lperio, lveggy);
+
+  wlen = 0;
+  pwork[0] = work;
+  for ( j = 1; j < ny; ++j )
+    {
+      wlen += np4;
+      pwork[j] = work + wlen;
+    } 
+
+  // printf("nx, ilon_firstx %d %ld\n", nx, ilon_firstx);
+  parray = array;
+  for ( j = 0; j < ny; ++j )
+    {
+      for ( i = ilon_firstx; i < (ilon_firstx+nx); ++i )
+	{
+	  ii = i;
+	  if ( ii >= np4 ) ii -= np4; 
+	  *parray = pwork[j][ii];
+	  parray++;
+	}
+    }
+
+  free(work);
+  free(pwork);
+
+  return (nx);
+}
+
+
 void field2regular(int gridID1, int gridID2, double missval, double *array, int nmiss)
 {
-  int nlon, nlat;
+  int nx = 0, ny, np;
   int gridtype;
   int lmiss, lperio, lveggy;
   int iret;
-  int *rowlonptr;
+  int *rowlon;
+  double xfirstandlast[2];
+  double xfirst, xlast;
 
   gridtype = gridInqType(gridID1);
 
   if ( gridtype != GRID_GAUSSIAN_REDUCED ) Error("Not a reduced gaussian grid!");
 
-  nlat = gridInqYsize(gridID1);
-  nlon = 2*nlat;
+  lmiss = nmiss > 0;
+  lperio = 1;
+  lveggy = 0;
 
-  rowlonptr = (int *) malloc(nlat*sizeof(int));
+  ny = gridInqYsize(gridID1);
+  np = gridInqNP(gridID1);
 
-  if ( gridInqSize(gridID2) != nlon*nlat ) Error("Gridsize differ!");
+  rowlon = (int *) malloc(ny*sizeof(int));
+  gridInqRowlon(gridID1, rowlon);
 
-  gridInqRowlon(gridID1, rowlonptr);
+  xfirstandlast[0] = 0.;
+  xfirstandlast[1] = 0.;
+  gridInqXvals(gridID1, xfirstandlast);
+  xfirst = xfirstandlast[0];
+  xlast  = xfirstandlast[1];
 
-  lmiss = nmiss > 0;
-  lperio = 1;
-  lveggy = 0;
+  if ( fabs(xfirst) > 0 || (np > 0 && fabs(xlast - (360.0-90.0/np)) > 90.0/np) )
+    {
+      nx = qu2reg_subarea(gridInqSize(gridID1), np, xfirst, xlast, array, rowlon, ny, missval, &iret, lmiss, lperio, lveggy);
+    }
+  else
+    {
+      nx = 2*ny;
+      (void) qu2reg3(array, rowlon, ny, nx, missval, &iret, lmiss, lperio, lveggy);
+    }
 
-  (void) qu2reg3(array, rowlonptr, nlat, nlon, missval, &iret, lmiss, lperio, lveggy);
+  if ( gridInqSize(gridID2) != nx*ny ) Error("Gridsize differ!");
 
-  free(rowlonptr);
+  free(rowlon);
 }
 
 
@@ -545,16 +726,57 @@ int gridToRegular(int gridID1)
 {
   int gridID2;
   int gridtype, gridsize;
-  int nx, ny;
+  int nx = 0, ny, np;
   long i;
   double *xvals = NULL, *yvals = NULL;
+  double xfirstandlast[2];
+  double xfirst, xlast;
 
   gridtype = gridInqType(gridID1);
 
   if ( gridtype != GRID_GAUSSIAN_REDUCED ) Error("Not a reduced gaussian grid!");
 
   ny = gridInqYsize(gridID1);
-  nx = 2*ny;
+  np = gridInqNP(gridID1);
+
+  yvals = (double *) malloc(ny*sizeof(double));
+  gridInqYvals(gridID1, yvals);
+
+  xfirstandlast[0] = 0.;
+  xfirstandlast[1] = 0.;
+  gridInqXvals(gridID1, xfirstandlast);
+  xfirst = xfirstandlast[0];
+  xlast  = xfirstandlast[1];
+
+  if ( fabs(xfirst) > 0 || (np > 0 && fabs(xlast - (360.0-90.0/np)) > 90.0/np) )
+    {
+      /* sub area (longitudes) */
+      long ilon_first, ilon_last;
+      long row_count;
+      int np4 = np*4;
+      int *rowlon = NULL;
+
+      if ( np <= 0 ) cdoAbort("Number of values between pole and equator missing!");
+
+      grib_get_reduced_row(np4, xfirst, xlast, &row_count, &ilon_first, &ilon_last);
+
+      nx = row_count;
+      xvals = (double *) malloc(nx*sizeof(double));
+      for ( i = 0; i < nx; ++i )
+	{
+	  xvals[i] = ((ilon_first+i)*360.)/np4;
+	  if ( xfirst > xlast ) xvals[i] -= 360.;
+	}
+
+      free(rowlon);
+    }
+  else
+    {
+      nx = 2*ny;
+      xvals = (double *) malloc(nx*sizeof(double));
+      for ( i = 0; i < nx; ++i ) xvals[i] = i * 360./nx;
+    }
+
   gridsize = nx*ny;
 
   gridID2  = gridCreate(GRID_GAUSSIAN, gridsize);
@@ -562,14 +784,9 @@ int gridToRegular(int gridID1)
   gridDefXsize(gridID2, nx);
   gridDefYsize(gridID2, ny);
   
-  xvals = (double *) malloc(nx*sizeof(double));
-  yvals = (double *) malloc(ny*sizeof(double));
-
-  for ( i = 0; i < nx; ++i ) xvals[i] = i * 360./nx;
-  gridInqYvals(gridID1, yvals);
-
   gridDefXvals(gridID2, xvals);
   gridDefYvals(gridID2, yvals);
+  gridDefNP(gridID2, np);
 
   free(xvals);
   free(yvals);
@@ -651,10 +868,10 @@ int gridToCurvilinear(int gridID1, int lbounds)
 	    int len;
 	    len = (int) strlen(xunits);
 	    if ( len == 1 && memcmp(xunits, "m",  1) == 0 ) lvalid_xunits = TRUE;
-	    if ( len == 1 && memcmp(xunits, "km", 2) == 0 ) lvalid_xunits = TRUE;
+	    if ( len == 2 && memcmp(xunits, "km", 2) == 0 ) lvalid_xunits = TRUE;
 	    len = (int) strlen(yunits);
 	    if ( len == 1 && memcmp(yunits, "m",  1) == 0 ) lvalid_yunits = TRUE;
-	    if ( len == 1 && memcmp(yunits, "km", 2) == 0 ) lvalid_yunits = TRUE;
+	    if ( len == 2 && memcmp(yunits, "km", 2) == 0 ) lvalid_yunits = TRUE;
 
 	    if ( lvalid_xunits == FALSE )
 	      cdoWarning("Possibly wrong result! Invalid x-coordinate units: \"%s\" (expected \"m\" or \"km\")", xunits);
@@ -1161,7 +1378,7 @@ int gridCurvilinearToRegular(int gridID1)
   for ( j = 1; j < ny; j++ )
     for ( i = 0; i < nx; i++ )
       {
-	if ( IS_NOT_EQUAL(xvals[i], xvals2D[j*nx+i]) )
+	if ( fabs(xvals[i] - xvals2D[j*nx+i]) > 1.e-6 )
 	  {
 	    lx = FALSE;
 	    j = ny;
@@ -1172,7 +1389,7 @@ int gridCurvilinearToRegular(int gridID1)
   for ( i = 1; i < nx; i++ )
     for ( j = 0; j < ny; j++ )
       {
-	if ( IS_NOT_EQUAL(yvals[j], yvals2D[j*nx+i]) )
+	if ( fabs(yvals[j] - yvals2D[j*nx+i]) > 1.e-6 )
 	  {
 	    ly = FALSE;
 	    i = nx;
@@ -1210,345 +1427,6 @@ int gridCurvilinearToRegular(int gridID1)
 }
 
 
-int referenceToGrid(int gridID1)
-{
-  int gridID2 = -1;
-  int gridtype, gridsize;
-  int offset = 7;
-  char gridfile[8912];
-
-  gridsize = gridInqSize(gridID1);
-
-  if ( gridInqReference(gridID1, NULL) )
-    {
-      int streamID;
-      int number, position;
-
-      number = gridInqNumber(gridID1);
-      position = gridInqPosition(gridID1);
-      gridInqReference(gridID1, gridfile);
-
-      if ( gridfile[offset] != '/' ) offset--;
-      streamID = streamOpenRead(&gridfile[offset]);
-      if ( streamID >= 0 )
-	{
-	  int vlistID, gridID = -1;
-	  int ngrids;
-	  vlistID = streamInqVlist(streamID);
-	  ngrids = vlistNgrids(vlistID);
-	  if ( position > 0 && position <= ngrids )
-	    {
-	      gridID = vlistGrid(vlistID, position-1);
-	      if ( gridInqSize(gridID) == gridsize )
-		gridID2 = gridDuplicate(gridID);
-	      else
-		cdoWarning("Grid size %d on position %d do not match! Reference=%s", gridsize, position, gridfile);
-	    }
-	  else
-	    cdoWarning("Grid position %d not available! Reference=%s", position, gridfile);
-
-	  streamClose(streamID);
-	}
-      else
-	cdoWarning("Reference to grid not found! Path=%s", gridfile);
-    }
-  else
-    {
-      cdoWarning("No reference to grid found!");
-    }
-
-  return (gridID2);
-}
-
-
-static
-double areas(struct cart *dv1, struct cart *dv2, struct cart *dv3)
-{
-  double a1, a2, a3;
-  double ca1, ca2, ca3;
-  double s12, s23, s31;
-
-  struct cart u12, u23, u31;
-
-  double areas;
-
-  /* compute cross products Uij = Vi X Vj */
-
-  u12.x[0] = dv1->x[1]*dv2->x[2] - dv1->x[2]*dv2->x[1];
-  u12.x[1] = dv1->x[2]*dv2->x[0] - dv1->x[0]*dv2->x[2];
-  u12.x[2] = dv1->x[0]*dv2->x[1] - dv1->x[1]*dv2->x[0];
-  
-  u23.x[0] = dv2->x[1]*dv3->x[2] - dv2->x[2]*dv3->x[1];
-  u23.x[1] = dv2->x[2]*dv3->x[0] - dv2->x[0]*dv3->x[2];
-  u23.x[2] = dv2->x[0]*dv3->x[1] - dv2->x[1]*dv3->x[0];
-  
-  u31.x[0] = dv3->x[1]*dv1->x[2] - dv3->x[2]*dv1->x[1];
-  u31.x[1] = dv3->x[2]*dv1->x[0] - dv3->x[0]*dv1->x[2];
-  u31.x[2] = dv3->x[0]*dv1->x[1] - dv3->x[1]*dv1->x[0];
-  
-  /* normalize Uij to unit vectors */
-  
-  s12 = u12.x[0]*u12.x[0]+u12.x[1]*u12.x[1]+u12.x[2]*u12.x[2];
-  s23 = u23.x[0]*u23.x[0]+u23.x[1]*u23.x[1]+u23.x[2]*u23.x[2];
-  s31 = u31.x[0]*u31.x[0]+u31.x[1]*u31.x[1]+u31.x[2]*u31.x[2];
-
-  /* test for a degenerate triangle associated with collinear vertices */
-  
-  if ( !(fabs(s12) > 0.0) || !(fabs(s23) > 0.0) || !(fabs(s31) > 0.0) ) {
-    areas = 0.0;
-    return areas;
-  }
-
-  s12 = sqrt(s12);
-  s23 = sqrt(s23);
-  s31 = sqrt(s31);
-  
-  u12.x[0] = u12.x[0]/s12; u12.x[1] = u12.x[1]/s12; u12.x[2] = u12.x[2]/s12;
-  u23.x[0] = u23.x[0]/s23; u23.x[1] = u23.x[1]/s23; u23.x[2] = u23.x[2]/s23;
-  u31.x[0] = u31.x[0]/s31; u31.x[1] = u31.x[1]/s31; u31.x[2] = u31.x[2]/s31;
-  
-  /*
-   *  Compute interior angles Ai as the dihedral angles between planes:
-   *  CA1 = cos(A1) = -<U12,U31>
-   *  CA2 = cos(A2) = -<U23,U12>
-   *  CA3 = cos(A3) = -<U31,U23>
-   */
-
-  ca1 = -( u12.x[0]*u31.x[0]+u12.x[1]*u31.x[1]+u12.x[2]*u31.x[2] );
-  ca2 = -( u23.x[0]*u12.x[0]+u23.x[1]*u12.x[1]+u23.x[2]*u12.x[2] );
-  ca3 = -( u31.x[0]*u23.x[0]+u31.x[1]*u23.x[1]+u31.x[2]*u23.x[2] );
-
-#if ! defined (FMAX)
-#define  FMAX(a,b)  ((a) > (b) ? (a) : (b))
-#endif
-#if ! defined (FMIN)
-#define  FMIN(a,b)  ((a) < (b) ? (a) : (b))
-#endif
-
-  ca1 = FMAX(ca1, -1.0);
-  ca1 = FMIN(ca1, +1.0);
-  ca2 = FMAX(ca2, -1.0);
-  ca2 = FMIN(ca2, +1.0);
-  ca3 = FMAX(ca3, -1.0);
-  ca3 = FMIN(ca3, +1.0);
-  
-  a1 = acos(ca1);
-  a2 = acos(ca2);
-  a3 = acos(ca3);
-  
-  /* compute AREAS = A1 + A2 + A3 - PI */
-  
-  areas = a1 + a2 + a3 - M_PI;
-
-  if ( areas < 0.0 ) {
-    areas = 0.0;
-  }
-
-  return areas;
-}
-
-static
-double cell_area(long i, long nv, double *grid_center_lon, double *grid_center_lat,
-		 double *grid_corner_lon, double *grid_corner_lat, int *status)
-{
-  long k;
-  double xa;
-  double area;
-  struct geo p1, p2, p3;
-  struct cart c1, c2, c3;
-
-  area = 0;
-      
-  p3.lon = grid_center_lon[i]; 
-  p3.lat = grid_center_lat[i];
-  c3 = gc2cc(&p3);
-      
-  for ( k = 1; k < nv; ++k )
-    {
-      p1.lon = grid_corner_lon[i*nv+k-1]; 
-      p1.lat = grid_corner_lat[i*nv+k-1];
-      c1 = gc2cc(&p1);
-      p2.lon = grid_corner_lon[i*nv+k]; 
-      p2.lat = grid_corner_lat[i*nv+k];
-      c2 = gc2cc(&p2);
-
-      xa = areas(&c1, &c2, &c3);
-      area += xa;
-    }
-
-  p1.lon = grid_corner_lon[i*nv+0]; 
-  p1.lat = grid_corner_lat[i*nv+0];
-  c1 = gc2cc(&p1);
-  p2.lon = grid_corner_lon[i*nv+nv-1]; 
-  p2.lat = grid_corner_lat[i*nv+nv-1];
-  c2 = gc2cc(&p2);
-
-  xa = areas(&c1, &c2, &c3);
-  area += xa;
-
-  return (area);
-}
-
-
-int gridGenArea(int gridID, double *area)
-{
-  int status = 0;
-  int gridtype;
-  int lgrid_gen_bounds = FALSE;
-  int lgriddestroy = FALSE;
-  long i;
-  long nv, gridsize;
-  double total_area;
-  double *grid_center_lon = NULL;
-  double *grid_center_lat = NULL;
-  double *grid_corner_lon = NULL;
-  double *grid_corner_lat = NULL;
-  int *grid_mask = NULL;
-
-  gridsize = gridInqSize(gridID);
-  gridtype = gridInqType(gridID);
-
-  if ( gridtype != GRID_LONLAT      &&
-       gridtype != GRID_GAUSSIAN    &&
-       gridtype != GRID_LCC         &&
-       gridtype != GRID_LCC2        &&
-       gridtype != GRID_LAEA        &&
-       gridtype != GRID_SINUSOIDAL  &&
-       gridtype != GRID_GME         &&
-       gridtype != GRID_REFERENCE   &&
-       gridtype != GRID_CURVILINEAR &&
-       gridtype != GRID_UNSTRUCTURED )
-    {
-      cdoAbort("Internal error! Unsupported gridtype: %s", gridNamePtr(gridtype)); 
-    }
-
-  if ( gridtype != GRID_UNSTRUCTURED && gridtype != GRID_CURVILINEAR )
-    {
-      if ( gridtype == GRID_GME )
-	{
-	  lgriddestroy = TRUE;
-	  gridID = gridToUnstructured(gridID, 1);
-	  grid_mask = (int *) malloc(gridsize*sizeof(int));
-	  gridInqMaskGME(gridID, grid_mask);
-	}
-      else if ( gridtype == GRID_REFERENCE )
-	{
-	  lgriddestroy = TRUE;
-	  gridID = referenceToGrid(gridID);
-	  if ( gridID == -1 ) return (1);
-	}
-      else
-	{
-	  lgriddestroy = TRUE;
-	  gridID = gridToCurvilinear(gridID, 1);
-	  lgrid_gen_bounds = TRUE;
-	}
-    }
-
-  gridtype = gridInqType(gridID);
-
-  if ( gridtype == GRID_UNSTRUCTURED )
-    nv = gridInqNvertex(gridID);
-  else
-    nv = 4;
-  
-  grid_center_lon = (double *) malloc(gridsize*sizeof(double));
-  grid_center_lat = (double *) malloc(gridsize*sizeof(double));
-
-  gridInqXvals(gridID, grid_center_lon);
-  gridInqYvals(gridID, grid_center_lat);
-
-  grid_corner_lon = (double *) malloc(nv*gridsize*sizeof(double));
-  grid_corner_lat = (double *) malloc(nv*gridsize*sizeof(double));
-
-  if ( gridInqYbounds(gridID, NULL) && gridInqXbounds(gridID, NULL) )
-    {
-      gridInqXbounds(gridID, grid_corner_lon);
-      gridInqYbounds(gridID, grid_corner_lat);
-    }
-  else
-    {
-      if ( lgrid_gen_bounds )
-	{
-	  int nlon = gridInqXsize(gridID);
-	  int nlat = gridInqYsize(gridID);
-	  double dlon = 0;
-	  if ( nlon == 1 )
-	    {
-	      dlon = 1;
-	    }
-	  genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon, dlon);
-	  genYbounds(nlon, nlat, grid_center_lat, grid_corner_lat);
-	}
-      else
-	{
-	  status = 1;
-	  return (status);
-	}
-    }
-  
-  /* Convert lat/lon units if required */
-  {
-    char units[CDI_MAX_NAME];
-
-    gridInqXunits(gridID, units);
-
-    if ( memcmp(units, "radian", 6) == 0 )
-      {
-	/* No conversion necessary */
-      }
-    else if ( memcmp(units, "degree", 6) == 0 )
-      {
-	for ( i = 0; i < gridsize; ++i )
-	  {
-	    grid_center_lon[i] *= DEG2RAD;
-	    grid_center_lat[i] *= DEG2RAD;
-	  }
-	for ( i = 0; i < gridsize*nv; ++i )
-	  {
-	    grid_corner_lon[i] *= DEG2RAD;
-	    grid_corner_lat[i] *= DEG2RAD;
-	  }
-      }
-    else
-      {
-	cdoWarning("Unknown units supplied for grid1 center lat/lon: proceeding assuming radians");
-      }
-  }
-
-  if ( lgriddestroy ) gridDestroy(gridID);
-
-  total_area = 0;
-#if defined (_OPENMP)
-#pragma omp parallel for default(none)        \
-  shared(gridsize, area, nv, grid_center_lon, grid_center_lat, grid_corner_lon, grid_corner_lat, status) \
-  private(i)
-#endif
-  for ( i = 0; i < gridsize; ++i )
-    {
-      area[i] = cell_area(i, nv, grid_center_lon, grid_center_lat, grid_corner_lon, grid_corner_lat, &status);
-      /*
-      if (  area[i] < 0.009 && fabs(grid_corner_lat[i*nv+1]) > 89)
-      printf("%d %g %g %g %g %g %g %g %g %g\n", i, area[i]*6371000*6371000, grid_center_lon[i], grid_center_lat[i],
-	     grid_corner_lon[i*nv], grid_corner_lat[i*nv],
-	     grid_corner_lon[i*nv+1], grid_corner_lat[i*nv+1],
-	     grid_corner_lon[i*nv+2], grid_corner_lat[i*nv+2]);
-      */
-      //     total_area += area[i];
-    }
-
-  //  if ( cdoVerbose ) cdoPrint("Total area = %g steradians", total_area);
-
-  free(grid_center_lon);
-  free(grid_center_lat);
-  free(grid_corner_lon);
-  free(grid_corner_lat);
-  if ( grid_mask ) free(grid_mask);
-
-  return (status);
-}
-
-
 int gridGenWeights(int gridID, double *grid_area, double *grid_wgts)
 {
   int i, nvals, gridsize, gridtype;
@@ -1596,7 +1474,6 @@ int gridGenWeights(int gridID, double *grid_area, double *grid_wgts)
 }
 
 
-static
 int gridWeightsOld(int gridID, double *weights)
 {
   int status = FALSE;
@@ -1711,7 +1588,6 @@ int gridWeights(int gridID, double *grid_wgts)
 	   gridtype == GRID_LAEA        ||
 	   gridtype == GRID_SINUSOIDAL  ||
 	   gridtype == GRID_GME         ||
-	   gridtype == GRID_REFERENCE   ||
 	   gridtype == GRID_CURVILINEAR ||
 	   gridtype == GRID_UNSTRUCTURED )
 	{
diff --git a/src/grid_area.c b/src/grid_area.c
new file mode 100644
index 0000000..d42173c
--- /dev/null
+++ b/src/grid_area.c
@@ -0,0 +1,410 @@
+/*
+  This file is part of CDO. CDO is a collection of Operators to
+  manipulate and analyse Climate model Data.
+
+  Copyright (C) 2003-2013 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+  See COPYING file for copying and redistribution conditions.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+*/
+
+#if defined(_OPENMP)
+#  include <omp.h>
+#endif
+
+#include <cdi.h>
+#include "cdo.h"
+#include "cdo_int.h"
+#include "error.h"
+#include "grid.h"
+
+static
+void lonlat_to_xyz(double lon, double lat, double *xyz)
+{
+  double coslat = cos(lat);
+  xyz[0] = coslat * cos(lon);
+  xyz[1] = coslat * sin(lon);
+  xyz[2] = sin(lat);
+}
+
+static
+void cross_product(const double *restrict a, const double *restrict b, double *restrict c)
+{
+  c[0] = a[1]*b[2] - a[2]*b[1];
+  c[1] = a[2]*b[0] - a[0]*b[2];
+  c[2] = a[0]*b[1] - a[1]*b[0];
+}
+
+static
+double scalar_product(const double *restrict a, const double *restrict b)
+{
+  return (a[0]*b[0] + a[1]*b[1] + a[2]*b[2]);
+}
+
+static
+double norm(const double *restrict a)
+{
+  return (a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
+}
+
+static
+double cell_area(int num_corners, double *cell_corner_lon, double *cell_corner_lat)
+{
+  if ( num_corners < 3 ) return 0;
+
+  /* generalised version based on the ICON code, mo_base_geometry.f90
+     provided by Luis Kornblueh, MPI-M. */
+
+  int M = num_corners; // number of vertices
+  int m; // loop index over number of vertices M
+  int i; // loop index over the three dimensions
+
+  double area;
+  double s[M];
+  double ca[M];
+  double a[M];
+
+  double p[M][3];
+  double u[M][3];
+
+  /* Convert into cartesian coordinates */
+
+  for ( m = 0; m < M; m++ )
+    lonlat_to_xyz(cell_corner_lon[m], cell_corner_lat[m], p[m]);
+
+  /* First, compute cross products Uij = Vi x Vj. */
+
+  for ( m = 0; m < M; m++ )
+    cross_product(p[m], p[(m+1)%M], u[m]);
+
+  /*  Normalize Uij to unit vectors. */
+
+  area = 0.0;
+
+  for ( m = 0; m < M; m++ )
+    {
+      s[m] = norm(u[m]);
+      area += s[m];
+    }
+
+  /* Test for a degenerated cells associated with collinear vertices. */
+
+  if ( fabs(area) > 0.0 )
+    {
+      for ( m = 0; m < M; m++ )
+	s[m] = sqrt(s[m]);
+
+      for ( m = 0; m < M; m++ )
+	for ( i = 0; i < 3; i++ )
+	  u[m][i] = u[m][i]/s[m];
+
+      /*  Compute interior angles Ai as the dihedral angles between planes
+	  by using the definition of the scalar product
+
+	            ab = |a| |b| cos (phi)
+
+	  As a and b are already normalised this reduces to
+
+                    ab = cos (phi)
+
+          There is no explanation so far for the - in the loop below.
+	  But otherwise we don't get the correct results for triangles
+	  and cells. Must have something to do with the theorem.
+      */
+
+      for ( m = 0; m < M; m++ )
+	{
+	  ca[m] = - scalar_product(u[m], u[(m+1)%M]);
+	  if ( ca[m] < -1.0 ) ca[m] = -1.0;
+	  if ( ca[m] >  1.0 ) ca[m] =  1.0;
+	  a[m] = acos(ca[m]);
+	}
+
+      /*  Compute areas = a1 + a2 + a3 - (M-2) * pi.
+
+	  here for a unit sphere: */
+
+      area = - (double) (M-2) * M_PI;
+
+      for ( m = 0; m < M; m++ )
+	area += a[m];
+
+      //   area *= EarthRadius * EarthRadius;
+
+      if ( area < 0.0 ) area = 0.0;
+    }
+
+  return (area);
+}
+
+/** area of a spherical triangle based on L'Huilier's Theorem
+  *
+  * source code is taken from code by Robert Oehmke of Earth System Modeling
+  * Framework (www.earthsystemmodeling.org)
+  *
+  * the license statement for this routine is as follows:
+  * Earth System Modeling Framework
+  * Copyright 2002-2013, University Corporation for Atmospheric Research,
+  * Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+  * Laboratory, University of Michigan, National Centers for Environmental
+  * Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+  * NASA Goddard Space Flight Center.
+  * Licensed under the University of Illinois-NCSA License.
+  */
+static
+double tri_area(const double *restrict u, const double *restrict v, const double *restrict w)
+{
+  double tmp_vec[3];
+
+  cross_product(u, v, tmp_vec);
+  double sina = sqrt(norm(tmp_vec));
+  double a = asin(sina);
+
+  cross_product(u, w, tmp_vec);
+  double sinb = sqrt(norm(tmp_vec));
+  double b = asin(sinb);
+
+  cross_product(w, v, tmp_vec);
+  double sinc = sqrt(norm(tmp_vec));
+  double c = asin(sinc);
+
+  double s = 0.5*(a+b+c);
+
+  double t = tan(s*0.5) * tan((s - a)*0.5) * tan((s - b)*0.5) * tan((s - c)*0.5);
+
+  double area = fabs(4.0 * atan(sqrt(fabs(t))));
+
+  return (area);
+}
+
+ /*
+  * source code is taken from code by Robert Oehmke of Earth System Modeling
+  * Framework (www.earthsystemmodeling.org) and adjusted to CDO data structures
+  *
+  * the license statement for this routine is as follows:
+  * Earth System Modeling Framework
+  * Copyright 2002-2013, University Corporation for Atmospheric Research,
+  * Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+  * Laboratory, University of Michigan, National Centers for Environmental
+  * Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+  * NASA Goddard Space Flight Center.
+  * Licensed under the University of Illinois-NCSA License.
+  */
+static
+double huiliers_area(int num_corners, double *cell_corner_lon, double *cell_corner_lat)
+{
+  if ( num_corners < 3 ) return 0;
+
+  // sum areas around cell
+  double sum = 0.0;
+  double pnt1[3], pnt2[3], pnt3[3];
+
+  lonlat_to_xyz(cell_corner_lon[0], cell_corner_lat[0], pnt1);
+  lonlat_to_xyz(cell_corner_lon[1], cell_corner_lat[1], pnt2);
+
+  for ( int i = 2; i < num_corners; i++ )
+    {
+      // points that make up a side of cell
+      lonlat_to_xyz(cell_corner_lon[i], cell_corner_lat[i], pnt3);
+ 
+      // compute angle for pnt2
+      sum += tri_area(pnt1, pnt2, pnt3);
+
+      if ( i < (num_corners-1) ) { pnt2[0] = pnt3[0]; pnt2[1] = pnt3[1]; pnt2[2] = pnt3[2]; }
+    }
+
+  return (sum);
+}
+
+
+int gridGenArea(int gridID, double *area)
+{
+  int status = 0;
+  int gridtype;
+  int lgrid_gen_bounds = FALSE;
+  int lgriddestroy = FALSE;
+  long i;
+  long nv, gridsize;
+  double *grid_corner_lon = NULL;
+  double *grid_corner_lat = NULL;
+  int *grid_mask = NULL;
+
+  gridsize = gridInqSize(gridID);
+  gridtype = gridInqType(gridID);
+
+  if ( gridtype != GRID_LONLAT      &&
+       gridtype != GRID_GAUSSIAN    &&
+       gridtype != GRID_LCC         &&
+       gridtype != GRID_LCC2        &&
+       gridtype != GRID_LAEA        &&
+       gridtype != GRID_SINUSOIDAL  &&
+       gridtype != GRID_GME         &&
+       gridtype != GRID_CURVILINEAR &&
+       gridtype != GRID_UNSTRUCTURED )
+    {
+      cdoAbort("Internal error! Unsupported gridtype: %s", gridNamePtr(gridtype)); 
+    }
+
+  if ( gridtype != GRID_UNSTRUCTURED && gridtype != GRID_CURVILINEAR )
+    {
+      if ( gridtype == GRID_GME )
+	{
+	  lgriddestroy = TRUE;
+	  gridID = gridToUnstructured(gridID, 1);
+	  grid_mask = (int *) malloc(gridsize*sizeof(int));
+	  gridInqMaskGME(gridID, grid_mask);
+	}
+      else
+	{
+	  lgriddestroy = TRUE;
+	  gridID = gridToCurvilinear(gridID, 1);
+	  lgrid_gen_bounds = TRUE;
+	}
+    }
+
+  if ( gridtype == GRID_UNSTRUCTURED )
+    {
+      if ( gridInqYvals(gridID, NULL) == 0 || gridInqXvals(gridID, NULL) == 0 )
+	{
+	  if ( gridInqNumber(gridID) > 0 )
+	    {
+	      lgriddestroy = TRUE;
+	      gridID = referenceToGrid(gridID);
+	      if ( gridID == -1 ) return (1);
+	    }
+	}
+    }
+
+  gridtype = gridInqType(gridID);
+
+  if ( gridtype == GRID_UNSTRUCTURED )
+    nv = gridInqNvertex(gridID);
+  else
+    nv = 4;
+
+  if ( gridInqYvals(gridID, NULL) == 0 || gridInqXvals(gridID, NULL) == 0 )
+    {
+      cdoWarning("Computation of grid cell area weights failed, grid cell center coordinates missing!");
+      status = 1;
+      return (status);
+    }
+
+  if ( nv == 0 )
+    {
+      cdoWarning("Computation of grid cell area weights failed, grid cell corner coordinates missing!");
+      status = 1;
+      return (status);
+    }
+
+  grid_corner_lon = (double *) malloc(nv*gridsize*sizeof(double));
+  grid_corner_lat = (double *) malloc(nv*gridsize*sizeof(double));
+
+  if ( gridInqYbounds(gridID, NULL) && gridInqXbounds(gridID, NULL) )
+    {
+      gridInqXbounds(gridID, grid_corner_lon);
+      gridInqYbounds(gridID, grid_corner_lat);
+    }
+  else
+    {
+      if ( lgrid_gen_bounds )
+	{
+	  int nlon = gridInqXsize(gridID);
+	  int nlat = gridInqYsize(gridID);
+	  double dlon = 0;
+	  if ( nlon == 1 )
+	    {
+	      dlon = 1;
+	    }
+
+	  double *grid_center_lon = NULL;
+	  double *grid_center_lat = NULL;
+
+	  grid_center_lon = (double *) malloc(gridsize*sizeof(double));
+	  grid_center_lat = (double *) malloc(gridsize*sizeof(double));
+
+	  gridInqXvals(gridID, grid_center_lon);
+	  gridInqYvals(gridID, grid_center_lat);
+
+	  genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon, dlon);
+	  genYbounds(nlon, nlat, grid_center_lat, grid_corner_lat);
+
+	  free(grid_center_lon);
+	  free(grid_center_lat);
+	}
+      else
+	{
+	  status = 1;
+	  return (status);
+	}
+    }
+  
+  /* Convert lat/lon units if required */
+  {
+    char units[CDI_MAX_NAME];
+
+    gridInqXunits(gridID, units);
+
+    if ( memcmp(units, "radian", 6) == 0 )
+      {
+	/* No conversion necessary */
+      }
+    else if ( memcmp(units, "degree", 6) == 0 )
+      {
+	for ( i = 0; i < gridsize*nv; ++i )
+	  {
+	    grid_corner_lon[i] *= DEG2RAD;
+	    grid_corner_lat[i] *= DEG2RAD;
+	  }
+      }
+    else
+      {
+	cdoWarning("Unknown units supplied for grid1 center lat/lon: proceeding assuming radians");
+      }
+  }
+
+  if ( lgriddestroy ) gridDestroy(gridID);
+
+  double findex = 0;
+
+  progressInit();
+
+#if defined(_OPENMP)
+#pragma omp parallel for default(none)        \
+  shared(findex, gridsize, area, nv, grid_corner_lon, grid_corner_lat) \
+  private(i)
+#endif
+  for ( i = 0; i < gridsize; ++i )
+    {
+      int lprogress = 1;
+#if defined(_OPENMP)
+      if ( omp_get_thread_num() != 0 ) lprogress = 0;
+#endif
+#if defined(_OPENMP)
+#pragma omp atomic
+#endif
+      findex++;
+      if ( lprogress ) progressStatus(0, 1, findex/gridsize);
+
+      //area[i] = cell_area(nv, grid_corner_lon+i*nv, grid_corner_lat+i*nv);
+      area[i] = huiliers_area(nv, grid_corner_lon+i*nv, grid_corner_lat+i*nv);
+    }
+
+  if ( cdoVerbose )
+    {
+      double total_area = 0;
+      for ( i = 0; i < gridsize; ++i ) total_area += area[i];
+      cdoPrint("Total area = %g steradians", total_area);
+    }
+
+  free(grid_corner_lon);
+  free(grid_corner_lat);
+  if ( grid_mask ) free(grid_mask);
+
+  return (status);
+}
diff --git a/src/griddes.c b/src/griddes.c
index f4f080c..63b12d1 100644
--- a/src/griddes.c
+++ b/src/griddes.c
@@ -15,11 +15,11 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
 #  include "netcdf.h"
 #endif
 
@@ -37,6 +37,7 @@
 #include "grid.h"
 #include "griddes.h"
 #include "error.h"
+#include "dtypes.h"
 
 #define  cmpstr(s1, s2, len)  (memcmp(s1, s2, len = strlen(s2)))
 
@@ -177,6 +178,7 @@ int gridDefine(griddes_t grid)
     case GRID_LONLAT:
     case GRID_GAUSSIAN:
     case GRID_SINUSOIDAL:
+    case GRID_LAEA:
       {
 	if ( grid.size != 1 )
 	  {
@@ -184,12 +186,14 @@ int gridDefine(griddes_t grid)
 	    if ( grid.ysize == 0 ) Error("ysize undefined!");
 	  }
 
-	if ( grid.size == 0 ) grid.size = grid.xsize*grid.ysize;
+	if ( grid.size == 0 ) grid.size = (long)grid.xsize*grid.ysize;
 
-	if ( grid.size != grid.xsize*grid.ysize )
-	  Error("Inconsistent grid declaration: xsize*ysize!=gridsize! (xsize=%d ysize=%d gridsize=%d)",
+	if ( grid.size != (long)grid.xsize*grid.ysize )
+	  Error("Inconsistent grid declaration: xsize*ysize!=gridsize (xsize=%d ysize=%d gridsize=%d)",
 		grid.xsize, grid.ysize, grid.size);
 
+	if ( grid.size < 0 || grid.size > INT_MAX ) Error("grid size (%ld) out of bounds (0 - %d)!", grid.size, INT_MAX);
+
 	gridID = gridCreate(grid.type, grid.size);
 
 	if ( grid.xsize > 0 ) gridDefXsize(gridID, grid.xsize);
@@ -285,6 +289,11 @@ int gridDefine(griddes_t grid)
 	    free(grid.mask);
 	  }
 
+	if ( grid.type == GRID_LAEA )
+	  {
+	    if ( grid.a > 0 ) gridDefLaea(gridID, grid.a, grid.lon_0, grid.lat_0);
+	  }
+
 	break;
       }
     case GRID_CURVILINEAR:
@@ -311,7 +320,13 @@ int gridDefine(griddes_t grid)
 	  }
 	else
 	  {
-	    gridDefNvertex(gridID, grid.nvertex);
+	    if ( grid.nvertex > 0 ) gridDefNvertex(gridID, grid.nvertex);
+	    if ( grid.number > 0 )
+	      {
+		gridDefNumber(gridID, grid.number);
+		if ( grid.position >= 0 ) gridDefPosition(gridID, grid.position);
+	      }
+	    if ( *grid.path ) gridDefReference(gridID, grid.path);
 	  }
 
 	if ( grid.xvals )
@@ -480,16 +495,6 @@ int gridDefine(griddes_t grid)
 
 	break;
       }
-    case GRID_REFERENCE:
-      {
-	gridID = gridCreate(grid.type, grid.size);
-
-	gridDefNumber(gridID, grid.number);
-	gridDefPosition(gridID, grid.position);
-	if ( *grid.path ) gridDefReference(gridID, grid.path);
-
-	break;
-      }
     default:
       {
 	if ( grid.type == -1 )
@@ -722,8 +727,6 @@ int gridFromFile(FILE *gfp, const char *dname)
 	    grid.type = GRID_UNSTRUCTURED;
 	  else if ( cmpstr(pline, "gme", len)  == 0 )
 	    grid.type = GRID_GME;
-	  else if ( cmpstr(pline, "reference", len)  == 0 )
-	    grid.type = GRID_REFERENCE;
 	  else if ( cmpstr(pline, "lcc2", len)  == 0 )
 	    grid.type = GRID_LCC2;
 	  else if ( cmpstr(pline, "lcc", len)  == 0 )
diff --git a/src/griddes.h b/src/griddes.h
index 50c3907..7de9fdd 100644
--- a/src/griddes.h
+++ b/src/griddes.h
@@ -40,7 +40,7 @@ typedef struct {
   int    *rowlon;
   int     genBounds;
   int     nvertex;
-  int     size;
+  long    size;
   int     xsize;
   int     ysize;
   int     np;
diff --git a/src/griddes_h5.c b/src/griddes_h5.c
index 66115ab..daab7ae 100644
--- a/src/griddes_h5.c
+++ b/src/griddes_h5.c
@@ -1,10 +1,10 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
 #define H5_USE_16_API
 
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
 #  include "hdf5.h"
 #endif
 
@@ -15,7 +15,7 @@
 #include "error.h"
 
 
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
 static herr_t
 obj_info(hid_t loc_id, const char *name, void *objname)
 {
@@ -52,7 +52,7 @@ obj_info(hid_t loc_id, const char *name, void *objname)
 #endif
 
 
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
 static
 int h5find_object(hid_t file_id, char *name)
 {
@@ -291,7 +291,7 @@ void correct_sinxvals(int xsize, int ysize, double *xvals)
 int gridFromH5file(const char *gridfile)
 {
   int gridID = -1;
-#if  defined  (HAVE_LIBHDF5)
+#if defined(HAVE_LIBHDF5)
   hid_t	  file_id;	/* HDF5 File ID	        	*/
   hid_t	  lon_id = -1;	/* Dataset ID	        	*/
   hid_t	  lat_id = -1;	/* Dataset ID	        	*/
diff --git a/src/griddes_nc.c b/src/griddes_nc.c
index a1e7209..141ea01 100644
--- a/src/griddes_nc.c
+++ b/src/griddes_nc.c
@@ -1,8 +1,8 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
 #  include "netcdf.h"
 #endif
 
@@ -15,7 +15,7 @@
 #include "error.h"
 
 
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
 static void nce(int istat)
 {
   /*
@@ -30,7 +30,7 @@ static void nce(int istat)
 int cdf_openread(const char *filename)
 {
   int fileID = -1;
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
   int nc_file_id;      /* netCDF grid file id           */
 
   openLock();
@@ -48,7 +48,7 @@ int cdf_openread(const char *filename)
 int gridFromNCfile(const char *gridfile)
 {
   int gridID = -1;
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
   int nc_file_id;      /* netCDF grid file id           */
   int nc_gridsize_id;  /* netCDF grid size dim id       */
   int nc_gridcorn_id;  /* netCDF grid corner dim id     */
@@ -159,7 +159,7 @@ int gridFromNCfile(const char *gridfile)
 
 void writeNCgrid(const char *gridfile, int gridID, int *grid_imask)
 {
-#if  defined  (HAVE_LIBNETCDF)
+#if defined(HAVE_LIBNETCDF)
   int nc_file_id;      /* netCDF grid file id           */
   int nc_gridsize_id;  /* netCDF grid size dim id       */
   int nc_gridcorn_id;  /* netCDF grid corner dim id     */
diff --git a/src/gridreference.c b/src/gridreference.c
new file mode 100644
index 0000000..6bac951
--- /dev/null
+++ b/src/gridreference.c
@@ -0,0 +1,290 @@
+/*
+  This file is part of CDO. CDO is a collection of Operators to
+  manipulate and analyse Climate model Data.
+
+  Copyright (C) 2003-2013 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+  See COPYING file for copying and redistribution conditions.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+*/
+
+#if defined(HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
+#if defined(HAVE_LIBCURL)
+#include <curl/curl.h>
+#include <curl/types.h>
+#include <curl/easy.h>
+#include <errno.h>
+#endif
+
+#include <cdi.h>
+#include "cdo.h"
+#include "cdo_int.h"
+
+/*
+ * callback function for curl for writing the network retrieved grid file
+ */
+static
+size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
+  size_t written;
+  written = fwrite(ptr, size, nmemb, stream);
+  return written;
+}
+
+/* code from grid_tools.2 */
+int download_gridfile(const char *restrict uri, const char *restrict basename)
+{
+  int rval = 1;
+#if defined(HAVE_LIBCURL)
+  // As curl_easy_init calls non-thread safe curl_global_init the libcurl developer advice
+  // to call curl_global_init first and before potential thread spawning.
+
+  CURLcode ret;  
+  CURL *hd;
+  double length;
+  int status;
+  int curlflags = CURL_GLOBAL_DEFAULT;
+
+#if defined(CURL_GLOBAL_ACK_EINTR)
+  curlflags |= CURL_GLOBAL_ACK_EINTR;
+#endif
+
+  ret = curl_global_init(curlflags);
+  if(ret != 0)
+    {
+      fprintf(stderr, "ERROR: %s!\n", curl_easy_strerror(ret));
+      return -1;
+    }
+
+  hd = curl_easy_init();
+  if (hd == NULL)
+    {
+      fprintf(stderr, "ERROR: could not get curl handler.\n");
+      return -1;
+    }
+  else
+    {
+      FILE *fp;
+      fp = fopen(basename, "w");
+      if (fp == NULL)
+	{
+	  fprintf(stderr, "ERROR: could not open local output file %s. %s.\n", basename, strerror(errno));
+	  return -1;
+	}
+
+      //curl_easy_setopt(hd, CURLOPT_VERBOSE, 1);
+      curl_easy_setopt(hd, CURLOPT_URL, uri);
+      curl_easy_setopt(hd, CURLOPT_WRITEFUNCTION, write_data);
+      curl_easy_setopt(hd, CURLOPT_WRITEDATA, fp);
+      ret = curl_easy_perform(hd);
+      fclose(fp);
+      if ( ret == 0 ) 
+	{
+	  /*
+	  int ihead;
+	  curl_easy_getinfo(hd, CURLINFO_HEADER_SIZE, &ihead);
+	  printf("ihead %d\n", ihead);
+	  */
+	  char *ctype;
+	  curl_easy_getinfo(hd, CURLINFO_CONTENT_TYPE, &ctype);
+
+	  if ( strstr(ctype, "html") == NULL ) // no html content
+	    {
+	      curl_easy_getinfo(hd, CURLINFO_SIZE_DOWNLOAD, &length);
+	      if ( cdoVerbose ) cdoPrint("File %s downloaded - size: %.0lf byte", basename, length); 
+	      rval = 0;
+	    }
+	  else
+	    {
+	      status = remove(basename);
+	      if (status == -1) perror(basename);
+	      if ( cdoVerbose ) cdoPrint("The requested URL was not found on this server!");
+	    }
+	}
+      else
+	{
+	  status = remove(basename);
+	  if (status == -1) perror(basename);
+	  fprintf(stderr, "ERROR: %s. Download %s failed.\n\n", curl_easy_strerror(ret), basename);
+	}
+      
+      curl_easy_cleanup(hd);
+    }
+#else
+  cdoWarning("CURL support not compiled in!");
+#endif  
+
+  return rval;
+}
+
+#if defined(HAVE_SYS_STAT_H)
+#include <sys/stat.h>
+#endif
+
+/*
+ * Search for filename.
+ */
+int search_file(const char *restrict directory, const char *restrict filename)
+{
+#if defined(HAVE_SYS_STAT_H)
+  struct stat buf;
+  int status;
+
+  status = stat(directory, &buf);
+
+  if ( status == 0 )
+    {
+      status = stat(filename, &buf);
+      if ( status == 0 ) return 0;
+    }
+  else
+    {
+      perror(directory);
+    }
+#endif
+
+  return 1;
+}
+
+
+int referenceToGrid(int gridID1)
+{
+  int gridID2 = -1;
+  int gridsize;
+  char griduri[8912];
+  char gridpath[8912];
+
+  griduri[0] = 0;
+  gridpath[0] = 0;
+
+  if ( gridInqReference(gridID1, NULL) ) gridInqReference(gridID1, griduri);
+
+  if ( griduri[0] == 0 )
+    {
+      cdoWarning("Reference to horizontal grid not available!");
+    }
+  else
+    {
+      int lgriduri = TRUE;
+      int status;
+      int streamID;
+      int number, position;
+
+      char *basename = strrchr(griduri, '/');
+      if ( basename == NULL )
+	{
+	  basename = griduri;
+	  lgriduri = FALSE;
+	}
+      else
+	{
+	  basename++;
+	}
+
+      strcpy(gridpath, "./");
+      strcat(gridpath, basename);
+      if ( cdoVerbose ) cdoPrint("Search for horizontal grid file \"%s\"", gridpath);
+  
+      /* scan local directory for file */
+      status = search_file("./", gridpath);
+      if ( status != 0 )
+	{
+	  extern char *cdoGridSearchDir;
+	  if ( cdoGridSearchDir != NULL)
+	    {
+	      strcpy(gridpath, cdoGridSearchDir);
+	      strcat(gridpath, basename);
+	      if ( cdoVerbose ) cdoPrint("Search for horizontal grid file \"%s\"", gridpath);
+  
+	      /* scan directory given by environment variable */
+	      status = search_file(cdoGridSearchDir, gridpath);
+	    }
+
+	  if ( status != 0 && lgriduri )
+	    {
+	      /*
+	      strcpy(griduri, "http://icon-downloads.mpimet.mpg.de/grids/public/edzw/icon_grid_0001x_R02B05_R.nc");
+	      char *basename = strrchr(griduri, '/') + 1;
+	      */
+	      if ( cdoVerbose ) cdoPrint("Download horizontal grid file %s to %s", griduri, basename);
+	      status = download_gridfile(griduri, basename);
+	    }
+	}
+
+      if ( status == 0 )
+	{
+	  if ( cdoVerbose ) cdoPrint("Horizontal grid file used: %s", gridpath);
+      
+	  gridsize = gridInqSize(gridID1);
+
+	  number = gridInqNumber(gridID1);
+	  position = gridInqPosition(gridID1);
+
+	  streamID = streamOpenRead(gridpath);
+	  if ( streamID >= 0 )
+	    {
+	      int vlistID, gridID = -1;
+	      int ngrids;
+	      vlistID = streamInqVlist(streamID);
+	      ngrids = vlistNgrids(vlistID);
+	      if ( position > 0 && position <= ngrids )
+		{
+		  gridID = vlistGrid(vlistID, position-1);
+		  if ( gridInqSize(gridID) == gridsize )
+		    gridID2 = gridDuplicate(gridID);
+		  else
+		    cdoWarning("Grid size %d on position %d do not match! Reference=%s", gridsize, position, gridpath);
+		}
+	      else if ( position == 0 )
+		{
+		  for ( int grididx = 0; grididx < ngrids; ++grididx )
+		    {
+		      gridID = vlistGrid(vlistID, grididx);
+		      if ( gridInqSize(gridID) == gridsize )
+			{
+			  gridID2 = gridDuplicate(gridID);
+			  break;
+			}
+		    }
+		}
+	      else
+		cdoWarning("Number of grid in reference %d not available! Reference=%s", position, gridpath);
+	      
+	      streamClose(streamID);
+	    }
+	  else
+	    cdiError(streamID, "Open failed on horizontal grid file >%s<", gridpath);
+	}
+
+      if ( gridID2 != -1 )
+	{
+	  char uuidOfHGrid1[16];
+	  char uuidOfHGrid2[16];
+
+	  memset(uuidOfHGrid1, 0, 16);
+	  memset(uuidOfHGrid2, 0, 16);
+
+	  gridInqUUID(gridID1, uuidOfHGrid1);
+	  gridInqUUID(gridID2, uuidOfHGrid2);
+	  
+	  if ( uuidOfHGrid1[0] != 0 && uuidOfHGrid1[0] != 0 && memcmp(uuidOfHGrid1, uuidOfHGrid2, 16) != 0 )
+	    cdoWarning("UUID of horizontal grids differ!");
+
+	  int number1 = gridInqNumber(gridID1);
+	  int number2 = gridInqNumber(gridID2);
+
+	  if ( number1 > 0 && number2 > 0 && number1 != number2 )
+	    cdoWarning("Number of grid used of horizontal grids differ!");
+	}
+    }
+
+  return (gridID2);
+}
diff --git a/src/hetaeta.c b/src/hetaeta.c
index afec87a..6442318 100644
--- a/src/hetaeta.c
+++ b/src/hetaeta.c
@@ -4,7 +4,7 @@
 #define  OPOINT 34179
 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -28,7 +28,7 @@ const double eta_pbl = 0.8;     /* upper limit of BPL eta coordiante */
 
 const double g = 9.81;
 
-#if defined (OUTPUT)
+#if defined(OUTPUT)
 FILE *old, *new;
 #endif
 
@@ -156,7 +156,7 @@ void hetaeta_sc(int ltq, int lpsmod, long ij, long ngp, long nlev1, long nlev2,
 	  fi1[k] = fi1[k+1]+rair*tv1[k]*(lnph1[k+1]-lnph1[k]);
 	}
     }
-#if defined (OUTPUT)
+#if defined(OUTPUT)
   if ( ij == OPOINT )
     for ( k = nlev1-1; k >= 0; --k )
       { 
@@ -422,7 +422,7 @@ void hetaeta_sc(int ltq, int lpsmod, long ij, long ngp, long nlev1, long nlev2,
 	zq2[k] = rh2[k]*epsilon*esat(zt2[k])/pf2[k];
     }
 
-#if defined (OUTPUT)
+#if defined(OUTPUT)
   if ( ij == OPOINT )
     for ( k = nlev2-1; k >= 0; --k )
       { 
@@ -488,7 +488,7 @@ void hetaeta(int ltq, int ngp, const int *imiss,
   long nlev1p1;
   long nlev2p1;
   int lpsmod = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   double **zt2_2, **zq2_2;
   double **ph1_2, **lnph1_2, **fi1_2, **pf1_2, **lnpf1_2, **tv1_2, **theta1_2, **rh1_2, **zvar_2;
   double **ph2_2, **lnph2_2, **fi2_2, **pf2_2;
@@ -502,7 +502,7 @@ void hetaeta(int ltq, int ngp, const int *imiss,
 #else
   double **vars_pbl = NULL;
 #endif
-#if defined (OUTPUT)
+#if defined(OUTPUT)
   double t, q, fi;
 
   old = fopen("old.dat","w");
@@ -512,7 +512,7 @@ void hetaeta(int ltq, int ngp, const int *imiss,
   nlev1p1 = nlev1+1;
   nlev2p1 = nlev2+1;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   ph1_2    = (double **) malloc(ompNumThreads*sizeof(double *));
   lnph1_2  = (double **) malloc(ompNumThreads*sizeof(double *));
   fi1_2    = (double **) malloc(ompNumThreads*sizeof(double *));
@@ -715,7 +715,7 @@ void hetaeta(int ltq, int ngp, const int *imiss,
   epsm1i = 1.0/epsilon-1.0;
 
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ngp, ph1_2, lnph1_2, fi1_2, pf1_2, lnpf1_2, tv1_2, theta1_2, rh1_2, zvar_2, ph2_2, lnph2_2, \
 	 fi2_2, pf2_2, rh_pbl_2, zt2_2, zq2_2, theta_pbl_2, rh2_2, wgt_2, idx_2, vars_pbl_2, \
@@ -729,7 +729,7 @@ void hetaeta(int ltq, int ngp, const int *imiss,
 #endif
   for ( ij = 0; ij < ngp; ++ij )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       int ompthID;
       long iv;      
 
@@ -788,13 +788,13 @@ void hetaeta(int ltq, int ngp, const int *imiss,
 
     } /* end for ij */
 
-#if defined (OUTPUT)
+#if defined(OUTPUT)
   fclose(old);
   fclose(new);
 #endif
 
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   for ( i = 0; i < ompNumThreads; i++ )
     {
       free(ph1_2[i]);    
diff --git a/src/interpol.c b/src/interpol.c
index 06cef09..51b72c2 100644
--- a/src/interpol.c
+++ b/src/interpol.c
@@ -4,10 +4,15 @@
 #include "grid.h"
 #include "util.h"  /* progressStatus */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #include <omp.h>  // omp_get_thread_num()
 #endif
 
+#define  ZERO     0.0
+#define  ONE      1.0
+#define  TWO      2.0
+#define  THREE    3.0
+
 /**
 * Find the interval i-1 .. i in which an element x fits and return i, the 
 * bigger one of the interval borders or x itself if it is an interval border.
@@ -198,6 +203,26 @@ double intlinarr2p(long nxm, long nym, double **fieldm, const double *xm, const
 }
 
 static
+void rect_find_ij_weights(double plon, double plat, long ii, long jj, const double *restrict xm, const double *restrict ym, double *ig, double *jg)
+{
+  /*
+    wgts[0] = (plon-xm[ii])   * (plat-ym[jj])   / ((xm[ii-1]-xm[ii]) * (ym[jj-1]-ym[jj]));
+    wgts[1] = (plon-xm[ii-1]) * (plat-ym[jj])   / ((xm[ii]-xm[ii-1]) * (ym[jj-1]-ym[jj]));
+    wgts[2] = (plon-xm[ii-1]) * (plat-ym[jj-1]) / ((xm[ii]-xm[ii-1]) * (ym[jj]-ym[jj-1]));
+    wgts[3] = (plon-xm[ii])   * (plat-ym[jj-1]) / ((xm[ii-1]-xm[ii]) * (ym[jj]-ym[jj-1]));
+  */
+  double iw, jw;
+  double wgts0 = (plon-xm[ii])   * (plat-ym[jj])   / ((xm[ii-1]-xm[ii]) * (ym[jj-1]-ym[jj]));
+  double wgts1 = (plon-xm[ii-1]) * (plat-ym[jj])   / ((xm[ii]-xm[ii-1]) * (ym[jj-1]-ym[jj]));
+
+  iw = 1./(wgts0/wgts1 + 1.);
+  jw = 1. - wgts1/iw;
+
+  *ig = iw;
+  *jg = jw;
+}
+
+static
 void intlinarr2(double missval, int lon_is_circular,
 		long nxm, long nym,  const double *restrict fieldm, const double *restrict xm, const double *restrict ym,
 		long gridsize2, double *field, const double *restrict x, const double *restrict y)
@@ -220,7 +245,7 @@ void intlinarr2(double missval, int lon_is_circular,
 
   progressInit();
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, field, fieldm, x, y, xm, ym, nxm, nym, gridsize2, missval, findex, nlon1, lon_is_circular, grid1_mask) \
   private(i, jj, ii)
@@ -232,13 +257,13 @@ void intlinarr2(double missval, int lon_is_circular,
       long iix;
       int lfound;
       int lprogress = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       if ( omp_get_thread_num() != 0 ) lprogress = 0;
 #endif
 
       field[i] = missval;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       findex++;
@@ -266,8 +291,24 @@ void intlinarr2(double missval, int lon_is_circular,
 
 	  wgts[0] = (x[i]-xm[ii])   * (y[i]-ym[jj])   / ((xm[ii-1]-xm[ii]) * (ym[jj-1]-ym[jj]));
 	  wgts[1] = (x[i]-xm[ii-1]) * (y[i]-ym[jj])   / ((xm[ii]-xm[ii-1]) * (ym[jj-1]-ym[jj]));
-	  wgts[2] = (x[i]-xm[ii])   * (y[i]-ym[jj-1]) / ((xm[ii-1]-xm[ii]) * (ym[jj]-ym[jj-1]));
 	  wgts[3] = (x[i]-xm[ii-1]) * (y[i]-ym[jj-1]) / ((xm[ii]-xm[ii-1]) * (ym[jj]-ym[jj-1]));
+	  wgts[2] = (x[i]-xm[ii])   * (y[i]-ym[jj-1]) / ((xm[ii-1]-xm[ii]) * (ym[jj]-ym[jj-1]));
+	  /*
+	  double wgts0, wgts1, wgts2, wgts3, iw, jw;
+	  rect_find_ij_weights(x[i], y[i], ii, jj, xm, ym, &iw, &jw);
+
+	  wgts0 = (ONE-iw) * (ONE-jw);
+	  wgts1 =      iw  * (ONE-jw);
+	  wgts2 =      iw  *      jw;
+	  wgts3 = (ONE-iw) *      jw;
+
+	  if ( fabs(wgts[0] - wgts0) > 1.e-12 ) printf("wd0: %g\n", wgts[0] - wgts0);
+	  if ( fabs(wgts[1] - wgts1) > 1.e-12 ) printf("wd1: %g\n", wgts[1] - wgts1);
+	  if ( fabs(wgts[2] - wgts2) > 1.e-12 ) printf("wd2: %g\n", wgts[2] - wgts2);
+	  if ( fabs(wgts[3] - wgts3) > 1.e-12 ) printf("wd3: %g\n", wgts[3] - wgts3);
+	  */
+	  //printf("%2ld %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n", dst_add, plon, plat, wgts[0], wgts[1], wgts[2], wgts[3], iw, jw);
+
 	  
 	  field[i] = 0;
 	  for ( n = 0; n < 4; ++n )
@@ -316,14 +357,14 @@ void boundbox_from_corners(long ic, long nc, const double *restrict corner_lon,
     }
 }
 
-#if defined (HAVE_LIBYAC)
+#if defined(HAVE_LIBYAC)
 #include "points.h"
 #include "grid_reg2d.h"
 #include "grid_search.h"
 #include "bucket_search.h"
-#include "event.h"
 #include "search.h"
 #include "clipping.h"
+#include "area.h"
 #endif
 
 static
@@ -365,7 +406,7 @@ void intconarr2(double missval, int lon_is_circular,
  
   progressInit();
 
-#if defined (HAVE_LIBYAC)
+#if defined(HAVE_LIBYAC)
   enum edge_type quad_type[] = {GREAT_CIRCLE, GREAT_CIRCLE, GREAT_CIRCLE, GREAT_CIRCLE}; // not used !
   // enum edge_type quad_type[] = {LON_CIRCLE, LON_CIRCLE, LON_CIRCLE, LON_CIRCLE};
 
@@ -375,6 +416,10 @@ void intconarr2(double missval, int lon_is_circular,
   double *weight;
   weight = (double *) malloc(gridsize1*sizeof(double));
 
+  double tgt_area;
+  double *area;
+  area = (double *) malloc(gridsize1*sizeof(double));
+
   struct grid_cell *SourceCell;
   SourceCell = malloc (gridsize1  * sizeof(*SourceCell) );
 
@@ -393,13 +438,13 @@ void intconarr2(double missval, int lon_is_circular,
   TargetCell.coordinates_y = malloc (nc2 * sizeof(*TargetCell.coordinates_y) );
 
   unsigned const * curr_deps;
-  struct polygons polygons;
+  //struct polygons polygons;
 
-  polygon_create ( &polygons );
+  //polygon_create ( &polygons );
 #endif
 
   /*
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, field, fieldm, x, y, xm, ym, nxm, nym, gridsize2, missval, findex, nlon1, lon_is_circular, grid1_mask, nc2) \
   private(i, jj, ii)
@@ -414,7 +459,7 @@ void intconarr2(double missval, int lon_is_circular,
       int lprogress = 1;
       ndeps = 0;
       /*
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       if ( omp_get_thread_num() != 0 ) lprogress = 0;
 #endif
       */
@@ -431,7 +476,7 @@ void intconarr2(double missval, int lon_is_circular,
       bound_lon2 = bound_box[3];
       //  printf("bound_box %ld  lon: %g %g lat: %g %g\n", i+1, bound_box[2]*RAD2DEG, bound_box[3]*RAD2DEG, bound_box[0]*RAD2DEG, bound_box[1]*RAD2DEG);
       /*
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       */
@@ -498,7 +543,7 @@ void intconarr2(double missval, int lon_is_circular,
 	lfound = rect_grid_search2(&imin, &imax, bound_box[2], bound_box[3], nxm, xm);
       */
 
-#if defined (HAVE_LIBYAC)
+#if defined(HAVE_LIBYAC)
       int index2 = i;
       /*
       int ilat2 = index2/nlonOut;
@@ -564,7 +609,13 @@ void intconarr2(double missval, int lon_is_circular,
 	    }
 	}
       
-      polygon_partial_weights(num_deps, SourceCell, TargetCell, weight, &polygons);
+      //polygon_partial_weights(num_deps, SourceCell, TargetCell, weight, &polygons);
+      compute_overlap_areas ( nSourceCells, SourceCell, TargetCell, area);
+
+      tgt_area = huiliers_area(TargetCell);
+      // tgt_area = cell_area(TargetCell);
+      for (n = 0; n < nSourceCells; ++n)
+	weight[n] = area[n] / tgt_area;
 
       correct_weights ( nSourceCells, weight );
 
@@ -592,8 +643,10 @@ void intconarr2(double missval, int lon_is_circular,
 #endif
     }
  
-#if defined (HAVE_LIBYAC)
-  polygon_destroy ( &polygons );
+#if defined(HAVE_LIBYAC)
+  free(weight);
+  free(area);
+  //polygon_destroy ( &polygons );
 #endif
 
   if ( findex < gridsize2 ) progressStatus(0, 1, 1);
@@ -1200,14 +1253,14 @@ void interpolate(field_t *field1, field_t *field2)
 			      || lon[nlon] >= lon[ 0] + 360 - 0.001);
 
   for (ilat = 0; ilat < nlat; ilat++)
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
     for (ilon = 0; ilon < nlon; ilon++)
       xin[2 * ilat + 1][2 * ilon + 1] = in0[ilat][ilon];
 
   for (ilat = 0; ilat < nxlat; ilat += 2)
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
     for (ilon = 1; ilon < nxlon; ilon += 2)
@@ -1228,7 +1281,7 @@ void interpolate(field_t *field1, field_t *field2)
       }
 
   for ( ilat = 1; ilat < nxlat; ilat += 2 )
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
     for ( ilon = 0; ilon < nxlon; ilon += 2 )
@@ -1259,7 +1312,7 @@ void interpolate(field_t *field1, field_t *field2)
       }
 
   for ( ilat = 0; ilat < nxlat; ilat += 2 )
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
     for ( ilon = 0; ilon < nxlon; ilon += 2 )
diff --git a/src/job.c b/src/job.c
index de5e79d..dffa234 100644
--- a/src/job.c
+++ b/src/job.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -13,7 +13,7 @@
 
 #include "cdo.h"
 
-#if  defined  (HAVE_LIBDRMAA)
+#if defined(HAVE_LIBDRMAA)
 #  include "drmaa.h"
 #endif
 
@@ -21,7 +21,7 @@
 
 int ftpget(int flag, const char *url, const char *path, const char *target, const char *source);
 
-#if  defined  (HAVE_LIBDRMAA)
+#if defined(HAVE_LIBDRMAA)
 static drmaa_job_template_t *create_job_template(const char *expname, const char *jobfilename, const char *jobname, const char *tmppath)
 {
   drmaa_job_template_t *job = NULL;
@@ -45,7 +45,7 @@ static drmaa_job_template_t *create_job_template(const char *expname, const char
 
   /* determine hostname */
 
-#if defined (HAVE_GETHOSTNAME)
+#if defined(HAVE_GETHOSTNAME)
   gethostname(host, sizeof(host));  
 #else
   fprintf(stderr, "Function gethostname not available!\n");
@@ -127,7 +127,7 @@ static drmaa_job_template_t *create_job_template(const char *expname, const char
 #endif
 
 
-#if  defined  (HAVE_LIBDRMAA)
+#if defined(HAVE_LIBDRMAA)
 static int drmaa_submit(const char *expname, const char *jobfilename, const char *jobname, const char *tmppath, const char *ftppath)
 {
   char status[DRMAA_ERROR_STRING_BUFFER];
@@ -336,7 +336,7 @@ static int drmaa_submit(const char *expname, const char *jobfilename, const char
 int job_submit(const char *expname, const char *jobfilename, const char *jobname, const char *tmppath, const char *ftppath)
 {
   int status = 0;
-#if  defined  (HAVE_LIBDRMAA)
+#if defined(HAVE_LIBDRMAA)
 
   status = drmaa_submit(expname, jobfilename, jobname, tmppath, ftppath);
 #else
@@ -347,7 +347,7 @@ int job_submit(const char *expname, const char *jobfilename, const char *jobname
 
 
 
-#if  defined  (HAVE_LIBCURL)
+#if defined(HAVE_LIBCURL)
 #  include <curl/curl.h>
 #  include <curl/types.h>
 #  include <curl/easy.h>
@@ -390,7 +390,7 @@ int my_progress_func(int *stdout_is_tty,
 int ftpget(int flag, const char *url, const char *path, const char *target, const char *source)
 {
   int status = 0;
-#if  defined  (HAVE_LIBCURL)
+#if defined(HAVE_LIBCURL)
   CURL *curl;
   CURLcode res;
   struct curl_slist* commands = NULL ;
@@ -510,7 +510,7 @@ int ftpget(int flag, const char *url, const char *path, const char *target, cons
 int ftprmd(const char *url, const char *path)
 {
   int status = 0;
-#if  defined  (HAVE_LIBCURL)
+#if defined(HAVE_LIBCURL)
   CURL *curl;
   CURLcode res;
   struct curl_slist* commands = NULL ;
@@ -600,7 +600,7 @@ void exp_run(int argc, char *argv[], char *cdoExpName)
   size_t len;
   char host[1024];
 
-#if defined (HAVE_GETHOSTNAME)
+#if defined(HAVE_GETHOSTNAME)
   gethostname(host, sizeof(host));
 #else
   fprintf(stderr, "Function gethostname not available!\n");
diff --git a/src/legendre.c b/src/legendre.c
index 775b5d9..7d7434f 100644
--- a/src/legendre.c
+++ b/src/legendre.c
@@ -56,7 +56,8 @@ void jspleg1(double *pleg, double plat, int ktrunc, double *work)
 
   */
   int itout1, i1m, ilm, jm, jcn, im2;
-  double zsin, zcos, zf1m, zre1, zf2m, zn, ze1, ze2;
+  double zsin, zcos, zf1m, zre1, zf2m, znsqr, ze1, ze2;
+  double zjmsqr;
   double *zhlp1, *zhlp2, *zhlp3;
 
 
@@ -115,12 +116,13 @@ void jspleg1(double *pleg, double plat, int ktrunc, double *work)
 
       /*  Step 5.       Sum for N = M+2 to T+1 */
 
+      zjmsqr = jm*jm;
       im2 = i1m+2;
 
       for ( jcn = im2; jcn < itout1; jcn++ )
 	{
-          zn         = jcn + 1;
-	  zhlp3[jcn] = sqrt((4.*zn*zn-1.)/(zn*zn-jm*jm));
+          znsqr      = (jcn + 1)*(jcn + 1);
+	  zhlp3[jcn] = sqrt((4.*znsqr-1.)/(znsqr-zjmsqr));
 	}
 
       for ( jcn = im2; jcn < itout1; jcn++ )
@@ -226,10 +228,10 @@ void phcs(double *pnm, double *hnm, int waves, double pmu,
     {
       pnm[0] = sqrt(1.0 + 1.0 / (jm+jm)) * zcos2 * ztemp2[0];
       hnm[0] = jm * pmu * pnm[0];
-#if defined (CRAY)
+#if defined(CRAY)
 #pragma _CRI novector
 #endif
-#if defined (__uxp__)
+#if defined(__uxp__)
 #pragma loop scalar
 #endif
       for (jn = 1; jn < twowaves-jm; jn++)
@@ -284,7 +286,7 @@ void sp2fctest(double *sa, double *fa, double *poli, int nlev, int nlat, int nfc
 	      sai = *sal++;
 	      far = fal;
 	      fai = fal + nlat;
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 	      for ( latn = 0; latn < nlat/2; latn++ )
@@ -315,7 +317,7 @@ void sp2fc(const double *sa, double *fa, const double *poli, long nlev, long nla
 
   nsp2 = (nt+1)*(nt+2);
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(jmm, jfc, lat, pol, sar, sai, sal, far, fai, fal)
 #endif
   for ( lev = 0; lev < nlev; lev++ )
@@ -349,12 +351,16 @@ void sp2fc(const double *sa, double *fa, const double *poli, long nlev, long nla
 void fc2sp(double *fa, double *sa, double *poli, int nlev, int nlat, int nfc, int nt)
 {
   int lev, jmm, jfc, lat, nsp2;
-  double sar, sai, *far, *fai, *pol;
-  double *sal, *fal;
+  double sar, sai;
+  const double * restrict far;
+  const double * restrict fai;
+  const double * restrict pol;
+  double *sal;
+  double *fal;
 
   nsp2 = (nt+1)*(nt+2);
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(jmm, jfc, lat, pol, sar, sai, sal, far, fai, fal)
 #endif
   for ( lev = 0; lev < nlev; lev++ )
diff --git a/src/magics_template_parser.c b/src/magics_template_parser.c
index 6ad4af6..658be13 100644
--- a/src/magics_template_parser.c
+++ b/src/magics_template_parser.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h" /* HAVE_LIBMAGICS */
 #endif
 
diff --git a/src/merge_sort2.c b/src/merge_sort2.c
index 38d3a8e..2fbfece 100644
--- a/src/merge_sort2.c
+++ b/src/merge_sort2.c
@@ -81,7 +81,7 @@ void sort_par(long num_links, double *restrict add1, int parent, int par_depth)
 
   depth = (int) (log(parent)/log(2));
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   /* Allow for nested parallelism */
   if ( omp_in_parallel() && depth<par_depth ) 
     {
@@ -92,7 +92,7 @@ void sort_par(long num_links, double *restrict add1, int parent, int par_depth)
     }                                    
 #endif
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if(depth<par_depth) \
   private(i,who_am_i,my_depth) \
   num_threads(2)
@@ -102,7 +102,7 @@ void sort_par(long num_links, double *restrict add1, int parent, int par_depth)
       who_am_i = nsplit*parent+i;
       my_depth = (int) (log(parent)/log(2))+1;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       /*      if ( 0 )
       	cdoPrint("I am %i (parent %i), my_depth is: %i thread_num %i (%i) \n",
 	who_am_i,parent,my_depth,omp_get_thread_num()+1,omp_get_num_threads());
@@ -129,7 +129,7 @@ void sort_par(long num_links, double *restrict add1, int parent, int par_depth)
 
   tmp = malloc(num_links*sizeof(double));
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( depth < par_depth /* && num_links > 4096*/ ) \
     private(i) num_threads(2) schedule(static,1024)
 #endif
diff --git a/src/merge_sort2.h b/src/merge_sort2.h
index 27c023c..aca0f13 100644
--- a/src/merge_sort2.h
+++ b/src/merge_sort2.h
@@ -10,7 +10,7 @@
 #include <time.h>
 #include "cdo.h"
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #include <omp.h>
 #endif
 
diff --git a/src/modules.c b/src/modules.c
index 02f5d96..4dadf30 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -15,7 +15,7 @@
   GNU General Public License for more details.
 */
 
-#if defined (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -271,7 +271,7 @@ void *Maggraph(void *argument);
 #endif
 
 
-#define  AdisitOperators        {"adisit"}
+#define  AdisitOperators        {"adisit","adipot"}
 #define  ArithOperators         {"add",  "sub",  "mul",  "div", "min", "max", "atan2"}
 #define  ArithcOperators        {"addc", "subc", "mulc", "divc", "mod"}
 #define  ArithdaysOperators     {"muldpm", "divdpm", "muldpy", "divdpy", "muldoy"}
@@ -312,7 +312,7 @@ void *Maggraph(void *argument);
 #define  FCOperators            {"fc2sp", "sp2fc", "fc2gp", "gp2fc"}
 #define  FiledesOperators       {"filedes", "griddes", "griddes2", "zaxisdes", "vct", "vct2", "pardes", \
                                  "vlist", "partab", "partab2"}
-#define  FillmissOperators      {"fillmiss"}
+#define  FillmissOperators      {"fillmiss","fillmiss2"}
 #define  FilterOperators        {"bandpass", "highpass", "lowpass"}
 #define  FldrmsOperators        {"fldrms"}
 #define  FldstatOperators       {"fldmin", "fldmax", "fldsum", "fldmean", "fldavg", "fldstd", "fldstd1", "fldvar", "fldvar1", "fldpctl"}
@@ -392,7 +392,7 @@ void *Maggraph(void *argument);
 #define  SetOperators           {"setcode", "setparam", "setname", "setunit", "setlevel", "setltype", "settabnum"}
 #define  SetboxOperators        {"setclonlatbox", "setcindexbox"}
 #define  SetgattOperators       {"setgatt", "setgatts"}
-#define  SetgridOperators       {"setgrid", "setgridtype", "setgridarea", "setgridmask", "unsetgridmask", "setgridnumber"}
+#define  SetgridOperators       {"setgrid", "setgridtype", "setgridarea", "setgridmask", "unsetgridmask", "setgridnumber", "setgriduri"}
 #define  SethaloOperators       {"sethalo", "tpnhalo"}
 #define  SetmissOperators       {"setmissval", "setctomiss", "setmisstoc", "setrtomiss", "setvrange"}
 #define  SetpartabOperators     {"setpartab", "setpartabc", "setpartabp", "setpartabn"}
@@ -579,7 +579,7 @@ static modules_t Modules[] =
   { Expr,           ExprHelp,          ExprOperators,          CDI_REAL,  1,  1 },
   { FC,             NULL,              FCOperators,            CDI_REAL,  1,  1 },
   { Filedes,        FiledesHelp,       FiledesOperators,       CDI_BOTH,  1,  0 },
-  { Fillmiss,       NULL,              FillmissOperators,      CDI_REAL,  1,  1 },
+  { Fillmiss,       FillmissHelp,      FillmissOperators,      CDI_REAL,  1,  1 },
   { Filter,         FilterHelp,        FilterOperators,        CDI_REAL,  1,  1 },
   { Fldrms,         NULL,              FldrmsOperators,        CDI_REAL,  2,  1 },
   { Fldstat,        FldstatHelp,       FldstatOperators,       CDI_REAL,  1,  1 },
@@ -640,7 +640,7 @@ static modules_t Modules[] =
   { Rotuv,          RotuvHelp,         RotuvOperators,         CDI_REAL,  1,  1 },
   { Runpctl,        RunpctlHelp,       RunpctlOperators,       CDI_REAL,  1,  1 },
   { Runstat,        RunstatHelp,       RunstatOperators,       CDI_REAL,  1,  1 },
-  { Seascount,      NULL,              SeascountOperators,     CDI_REAL,  1,  1 },
+  { Seascount,      NULL,              SeascountOperators,     CDI_BOTH,  1,  1 },
   { Seaspctl,       SeaspctlHelp,      SeaspctlOperators,      CDI_REAL,  3,  1 },
   { Seasstat,       SeasstatHelp,      SeasstatOperators,      CDI_REAL,  1,  1 },
   { Selbox,         SelboxHelp,        SelboxOperators,        CDI_BOTH,  1,  1 },
@@ -682,11 +682,11 @@ static modules_t Modules[] =
   { Test2,          NULL,              Test2Operators,         CDI_REAL,  2,  1 },
   { Testdata,       NULL,              TestdataOperators,      CDI_REAL,  1,  1 },
   { Tests,          NULL,              TestsOperators,         CDI_REAL,  1,  1 },
-  { Timcount,       NULL,              TimcountOperators,      CDI_REAL,  1,  1 },
-  { Timcount,       NULL,              YearcountOperators,     CDI_REAL,  1,  1 },
-  { Timcount,       NULL,              MoncountOperators,      CDI_REAL,  1,  1 },
-  { Timcount,       NULL,              DaycountOperators,      CDI_REAL,  1,  1 },
-  { Timcount,       NULL,              HourcountOperators,     CDI_REAL,  1,  1 },
+  { Timcount,       NULL,              TimcountOperators,      CDI_BOTH,  1,  1 },
+  { Timcount,       NULL,              YearcountOperators,     CDI_BOTH,  1,  1 },
+  { Timcount,       NULL,              MoncountOperators,      CDI_BOTH,  1,  1 },
+  { Timcount,       NULL,              DaycountOperators,      CDI_BOTH,  1,  1 },
+  { Timcount,       NULL,              HourcountOperators,     CDI_BOTH,  1,  1 },
   { Timpctl,        TimpctlHelp,       TimpctlOperators,       CDI_REAL,  3,  1 },
   { Timpctl,        YearpctlHelp,      YearpctlOperators,      CDI_REAL,  3,  1 },
   { Timpctl,        MonpctlHelp,       MonpctlOperators,       CDI_REAL,  3,  1 },
@@ -695,11 +695,11 @@ static modules_t Modules[] =
   { Timselpctl,     TimselpctlHelp,    TimselpctlOperators,    CDI_REAL,  3,  1 },
   { Timsort,        TimsortHelp,       TimsortOperators,       CDI_REAL,  1,  1 },
   { Timselstat,     TimselstatHelp,    TimselstatOperators,    CDI_REAL,  1,  1 },
-  { Timstat,        TimstatHelp,       TimstatOperators,       CDI_REAL,  1,  1 },
-  { Timstat,        YearstatHelp,      YearstatOperators,      CDI_REAL,  1,  1 },
-  { Timstat,        MonstatHelp,       MonstatOperators,       CDI_REAL,  1,  1 },
-  { Timstat,        DaystatHelp,       DaystatOperators,       CDI_REAL,  1,  1 },
-  { Timstat,        HourstatHelp,      HourstatOperators,      CDI_REAL,  1,  1 },
+  { Timstat,        TimstatHelp,       TimstatOperators,       CDI_BOTH,  1,  1 },
+  { Timstat,        YearstatHelp,      YearstatOperators,      CDI_BOTH,  1,  1 },
+  { Timstat,        MonstatHelp,       MonstatOperators,       CDI_BOTH,  1,  1 },
+  { Timstat,        DaystatHelp,       DaystatOperators,       CDI_BOTH,  1,  1 },
+  { Timstat,        HourstatHelp,      HourstatOperators,      CDI_BOTH,  1,  1 },
   { Timstat2,       TimcorHelp,        TimcorOperators,        CDI_REAL,  2,  1 },
   { Timstat2,       TimcovarHelp,      TimcovarOperators,      CDI_REAL,  2,  1 },
   { Timstat3,       NULL,              Timstat3Operators,      CDI_REAL,  2,  1 },
diff --git a/src/namelist.c b/src/namelist.c
index 9b4bfbe..603175f 100644
--- a/src/namelist.c
+++ b/src/namelist.c
@@ -23,7 +23,7 @@
 
 #include "namelist.h"
 
-#if ! defined (strdup)
+#if ! defined(strdup)
 char *strdup(const char *s);
 #endif
 int readline(FILE *fp, char *line, int len);
diff --git a/src/operator_help.h b/src/operator_help.h
index 5568b0e..68a07d6 100644
--- a/src/operator_help.h
+++ b/src/operator_help.h
@@ -41,7 +41,7 @@ static char *SinfoHelp[] = {
     "",
     "DESCRIPTION",
     "    This module writes information about the structure of ifiles to standard output.",
-    "    ifiles is an unlimited number of input files. All input files need to have ",
+    "    ifiles is an arbitrary number of input files. All input files need to have ",
     "    the same structure with the same variables on different timesteps.",
     "    The information displayed depends on the chosen operator.",
     "",
@@ -192,7 +192,7 @@ static char *CopyHelp[] = {
     "",
     "DESCRIPTION",
     "    This module contains operators to copy or concatenate datasets.",
-    "    ifiles is an unlimited number of input files. All input files need to have ",
+    "    ifiles is an arbitrary number of input files. All input files need to have ",
     "    the same structure with the same variables on different timesteps.",
     "",
     "OPERATORS",
@@ -212,7 +212,7 @@ static char *ReplaceHelp[] = {
     "    replace  ifile1 ifile2 ofile",
     "",
     "DESCRIPTION",
-    "    The replace operator replaces variables of ifile1 by variables from ifile2 and write",
+    "    The replace operator replaces variables in ifile1 by variables from ifile2 and write",
     "    the result to ofile. Both input datasets need to have the same number of timesteps.",
     NULL
 };
@@ -257,25 +257,22 @@ static char *MergeHelp[] = {
     "    <operator>  ifiles ofile",
     "",
     "DESCRIPTION",
-    "    This module reads datasets from several input files,",
-    "    merges them and writes the resulting dataset to ofile.",
+    "    This module reads datasets from several input files, merges them and writes the resulting dataset to ofile.",
     "",
     "OPERATORS",
     "    merge      Merge datasets with different fields",
-    "               Merges time series of different fields from several input datasets.",
-    "               The number of fields per timestep written to ofile",
-    "               is the sum of the field numbers per timestep in all input datasets.",
-    "               The time series on all input datasets are required to have different",
-    "               fields and the same number of timesteps.",
+    "               Merges time series of different fields from several input datasets. The number ",
+    "               of fields per timestep written to ofile is the sum of the field numbers ",
+    "               per timestep in all input datasets. The time series on all input datasets are ",
+    "               required to have different fields and the same number of timesteps.",
     "               The fields in each different input file either have to be different variables",
     "               or different levels of the same variable. A mixture of different variables on",
     "               different levels in different input files is not allowed.",
     "    mergetime  Merge datasets sorted by date and time",
     "               Merges all timesteps of all input files sorted by date and time.",
-    "               All input files need to have the same structure with the same variables ",
-    "               on different timesteps.",
-    "               After this operation every input timestep is in ofile and",
-    "               all timesteps are sorted by date and time.",
+    "               All input files need to have the same structure with the same variables on ",
+    "               different timesteps. After this operation every input timestep is in ofile ",
+    "               and all timesteps are sorted by date and time.",
     "",
     "ENVIRONMENT",
     "    SKIP_SAME_TIME",
@@ -332,11 +329,12 @@ static char *SplitHelp[] = {
 
 static char *SplittimeHelp[] = {
     "NAME",
-    "    splithour, splitday, splitmon, splitseas, splityear - ",
+    "    splithour, splitday, splitseas, splityear, splitmon - ",
     "    Split timesteps of a dataset",
     "",
     "SYNOPSIS",
     "    <operator>  ifile obase",
+    "    splitmon[,format]  ifile obase",
     "",
     "DESCRIPTION",
     "    This module splits ifile into  timesteps pieces. The output files will be named",
@@ -350,15 +348,18 @@ static char *SplittimeHelp[] = {
     "    splitday   Split days",
     "               Splits a file into pieces, one for each different day.",
     "               xxx will have two digits with the day.",
-    "    splitmon   Split months",
-    "               Splits a file into pieces, one for each different month.",
-    "               xxx will have two digits with the month.",
     "    splitseas  Split seasons",
     "               Splits a file into pieces, one for each different season.",
     "               xxx will have three characters with the season.",
     "    splityear  Split years",
     "               Splits a file into pieces, one for each different year.",
     "               xxx will have four digits with the year.",
+    "    splitmon   Split months",
+    "               Splits a file into pieces, one for each different month.",
+    "               xxx will have two digits with the month.",
+    "",
+    "PARAMETER",
+    "    format  STRING  C-style format for strftime() (e.g. %B for the full month name)",
     "",
     "ENVIRONMENT",
     "    CDO_FILE_SUFFIX",
@@ -403,7 +404,7 @@ static char *SelectHelp[] = {
     "",
     "DESCRIPTION",
     "    This module selects some fields from ifiles and writes them to ofile.",
-    "    ifiles is an unlimited number of input files. All input files need to have ",
+    "    ifiles is an arbitrary number of input files. All input files need to have ",
     "    the same structure with the same variables on different timesteps.",
     "    The fields selected depends on the chosen parameters. Parameter is a comma",
     "    separated list of key-value pairs.",
@@ -415,18 +416,19 @@ static char *SelectHelp[] = {
     "            Deletes all fields with parameters in a user given list.",
     "",
     "PARAMETER",
-    "    name      STRING  Comma separated list of variable names",
-    "    param     STRING  Comma separated list of parameter identifiers",
-    "    code      INTEGER Comma separated list of code numbers",
-    "    ltype     INTEGER Comma separated list of GRIB level types",
-    "    levidx    INTEGER Comma separated list of index of levels",
-    "    level     FLOAT   Comma separated list of vertical levels",
-    "    minute    INTEGER Comma separated list of minutes",
-    "    hour      INTEGER Comma separated list of hours",
-    "    day       INTEGER Comma separated list of days",
-    "    month     INTEGER Comma separated list of months",
-    "    year      INTEGER Comma separated list of years",
-    "    timestep  INTEGER Comma separated list of timesteps",
+    "    name              STRING  Comma separated list of variable names",
+    "    param             STRING  Comma separated list of parameter identifiers",
+    "    code              INTEGER Comma separated list of code numbers",
+    "    ltype             INTEGER Comma separated list of GRIB level types",
+    "    levidx            INTEGER Comma separated list of index of levels",
+    "    level             FLOAT   Comma separated list of vertical levels",
+    "    minute            INTEGER Comma separated list of minutes",
+    "    hour              INTEGER Comma separated list of hours",
+    "    day               INTEGER Comma separated list of days",
+    "    month             INTEGER Comma separated list of months",
+    "    year              INTEGER Comma separated list of years",
+    "    timestep          INTEGER Comma separated list of timesteps",
+    "    timestep_of_year  INTEGER Comma separated list of timesteps of year",
     NULL
 };
 
@@ -533,7 +535,7 @@ static char *SeltimeHelp[] = {
     "    seldate      Select dates",
     "                 Selects all timesteps with a date in a user given range.",
     "    selsmon      Select single month",
-    "                 Selects a month and optional an unlimited number of timesteps before and after this month.",
+    "                 Selects a month and optional an arbitrary number of timesteps before and after this month.",
     "",
     "PARAMETER",
     "    timesteps  INTEGER  Comma separated list of timesteps",
@@ -2923,26 +2925,23 @@ static char *YdrunpctlHelp[] = {
     "    ydrunpctl,p,nts  ifile1 ifile2 ifile3 ofile",
     "",
     "DESCRIPTION",
-    "    This operator writes running percentile values for each day of year ",
-    "    in ifile1 to ofile. A certain percentile is computed for all",
-    "    timesteps in running windows of which the medium timestep corresponds",
-    "    to a certain day of year. ",
-    "    The algorithm uses histograms with minimum and maximum bounds given in",
-    "    ifile2 and ifile3, respectively. The default number of",
-    "    histogram bins is 101. The default can be overridden by setting the",
-    "    environment variable CDO_PCTL_NBINS to a different value. The files",
-    "    ifile2 and ifile3 should be the result of corresponding",
-    "    ydrunmin and ydrunmax operations, respectively.",
-    "    The date information in an output field is the date of the medium time",
-    "    step in the last contributing running window.",
-    "    Note that the operator have to be applied to a continuous time series of daily",
-    "    measurements in order to yield physically meaningful results. Also note that",
-    "    the output time series begins (nts-1)/2 timesteps after the first timestep ",
-    "    of the input time series and ends (nts-1)/2 timesteps before the last.",
-    "    For input data which are complete but not continuous, such as time series of",
-    "    daily measurements for the same month or season within different years, the",
-    "    operator only yields physically meaningful results if the input time series",
-    "    does include the (nts-1)/2 days before and after each period of interest.",
+    "    This operator writes running percentile values for each day of year in ifile1 to ofile. ",
+    "    A certain percentile is computed for all timesteps in running windows of which the medium ",
+    "    timestep corresponds to a certain day of year. ",
+    "    The algorithm uses histograms with minimum and maximum bounds given in ifile2 and ifile3,",
+    "    respectively. The default number of histogram bins is 101. The default can be overridden",
+    "    by setting the environment variable CDO_PCTL_NBINS to a different value. The files ifile2 ",
+    "    and ifile3 should be the result of corresponding ydrunmin and ydrunmax operations, respectively.",
+    "    The date information in an output field is the date of the medium time step in the last ",
+    "    contributing running window.",
+    "    Note that the operator have to be applied to a continuous time series of daily measurements ",
+    "    in order to yield physically meaningful results. Also note that the output time series begins",
+    "    (nts-1)/2 timesteps after the first timestep of the input time series and ends (nts-1)/2 ",
+    "    timesteps before the last.",
+    "    For input data which are complete but not continuous, such as time series of daily measurements ",
+    "    for the same month or season within different years, the operator only yields physically meaningful ",
+    "    results if the input time series does include the (nts-1)/2 days before and after each period ",
+    "    of interest.",
     "    ",
     "    o(001,x) = pth percentile {i(t,x), i(t+1,x), ..., i(t+nts-1,x); day[(i(t+(nts-1)/2)] = 001}",
     "                     ...",
@@ -3410,8 +3409,9 @@ static char *IntvertHelp[] = {
     "DESCRIPTION",
     "    Interpolate 3D variables on hybrid model levels to pressure or height levels.",
     "    The input file should contain the log. surface pressure or the surface pressure.",
-    "    To interpolate the temperature, the orography (surface geopotential) is also needed.",
-    "    The pressure, temperature, and orography are identified by their code numbers.",
+    "    To interpolate the temperature, the surface geopotential is also needed.",
+    "    The pressure, temperature, and surface geopotential are identified by their GRIB1 code number",
+    "    or netCDF CF standard name.",
     "    Supported parameter tables are: WMO standard table number 2 and ECMWF local table number 128.",
     "    Use the alias  ml2plx/ml2hlx or the environment variable EXTRAPOLATE",
     "    to extrapolate missing values. All input fields have to be on the same horizontal grid.",
@@ -3434,8 +3434,7 @@ static char *IntvertHelp[] = {
     "        If set to 1 extrapolate missing values.",
     "",
     "NOTE",
-    "    The netCDF CF convention for vertical hybrid coordinates is ",
-    "    not supported, yet!",
+    "    The netCDF CF convention for vertical hybrid coordinates is not supported, yet!",
     NULL
 };
 
@@ -3548,47 +3547,39 @@ static char *SpectralHelp[] = {
     "    sp2sp,trunc  ifile ofile",
     "",
     "DESCRIPTION",
-    "    This module transforms fields on Gaussian grids to spectral coefficients ",
-    "    and vice versa.",
+    "    This module transforms fields on Gaussian grids to spectral coefficients and vice versa.",
     "",
     "OPERATORS",
     "    sp2gp   Spectral to gridpoint",
-    "            Convert all fields with spectral coefficients to a regular Gaussian",
-    "            grid. The number of latitudes of the resulting Gaussian grid is ",
-    "            calculated from the triangular truncation by:",
+    "            Convert all fields with spectral coefficients to a regular Gaussian grid. The number of ",
+    "            latitudes of the resulting Gaussian grid is calculated from the triangular truncation by:",
     "            ",
     "               nlat = NINT((trunc*3 + 1.)/2.)",
     "    sp2gpl  Spectral to gridpoint (linear)",
-    "            Convert all fields with spectral coefficients to a regular Gaussian",
-    "            grid. The number of latitudes of the resulting Gaussian grid",
-    "            is calculated from the triangular truncation by:",
+    "            Convert all fields with spectral coefficients to a regular Gaussian grid. The number of ",
+    "            latitudes of the resulting Gaussian grid is calculated from the triangular truncation by:",
     "            ",
     "               nlat = NINT((trunc*2 + 1.)/2.)",
     "            ",
     "            Use this operator to convert ERA40 data e.g. from TL159 to N80.",
     "    gp2sp   Gridpoint to spectral",
-    "            Convert all Gaussian gridpoint fields to spectral coefficients.",
-    "            The triangular truncation of the resulting spherical harmonics",
-    "            is calculated from the number of latitudes by:",
+    "            Convert all Gaussian gridpoint fields to spectral coefficients. The triangular truncation ",
+    "            of the resulting spherical harmonics is calculated from the number of latitudes by:",
     "            ",
     "               trunc = (nlat*2 - 1) / 3",
     "    gp2spl  Gridpoint to spectral (linear)",
-    "            Convert all Gaussian gridpoint fields to spectral coefficients.",
-    "            The triangular truncation of the resulting spherical harmonics",
-    "            is calculated from the number of latitudes by:",
+    "            Convert all Gaussian gridpoint fields to spectral coefficients. The triangular truncation ",
+    "            of the resulting spherical harmonics is calculated from the number of latitudes by:",
     "            ",
     "               trunc = (nlat*2 - 1) / 2",
     "            ",
-    "            Use this operator to convert ERA40 data e.g. from N80 to TL159",
-    "            instead of T106.",
+    "            Use this operator to convert ERA40 data e.g. from N80 to TL159 instead of T106.",
     "    sp2sp   Spectral to spectral",
-    "            Change the triangular truncation of all spectral fields.",
-    "            The operator performs downward conversion by cutting the resolution.",
-    "            Upward conversions are achieved by filling in zeros.",
+    "            Change the triangular truncation of all spectral fields. The operator performs downward ",
+    "            conversion by cutting the resolution. Upward conversions are achieved by filling in zeros.",
     "",
     "PARAMETER",
     "    trunc  INTEGER  New spectral resolution",
-    "    wnums  INTEGER  Comma separated list of wave numbers",
     NULL
 };
 
@@ -3780,7 +3771,7 @@ static char *OutputHelp[] = {
     "",
     "SYNOPSIS",
     "    output  ifiles",
-    "    outputf,format,nelem  ifiles",
+    "    outputf,format[,nelem]  ifiles",
     "    outputint  ifiles",
     "    outputsrv  ifiles",
     "    outputext  ifiles",
@@ -3798,7 +3789,7 @@ static char *OutputHelp[] = {
     "    outputf    Formatted output",
     "               Prints all values to standard output.",
     "               The format and number of elements for each row have to be specified by the parameters",
-    "               format and nelem.",
+    "               format and nelem. The default for nelem is 1.",
     "    outputint  Integer output",
     "               Prints all values rounded to the nearest integer to standard output.",
     "    outputsrv  SERVICE ASCII output",
@@ -3810,7 +3801,7 @@ static char *OutputHelp[] = {
     "",
     "PARAMETER",
     "    format  STRING  C-style format for one element (e.g. %13.6g)",
-    "    nelem   INTEGER Number of elements for each row (nelem max = gridsize)",
+    "    nelem   INTEGER Number of elements for each row (default: nelem = 1)",
     NULL
 };
 
@@ -4069,17 +4060,29 @@ static char *MastrfuHelp[] = {
 
 static char *AdisitHelp[] = {
     "NAME",
-    "    adisit - Potential temperature to in-situ temperature",
+    "    adisit, adipot - Potential temperature to in-situ temperature and vice versa",
     "",
     "SYNOPSIS",
     "    adisit[,pressure]  ifile ofile",
+    "    adipot  ifile ofile",
     "",
     "DESCRIPTION",
-    "    This is a special operator for the post processing of the ocean and sea ice model MPIOM.",
-    "    It converts potential temperature adiabatically to in-situ temperature to(tho, sao, p).",
-    "    Required input fields are sea water potential temperature (name=tho; code=2) and sea water salinity (name=sao; code=5).",
-    "    Pressure is calculated from the level information or can be specified by the optional parameter.",
-    "    Output fields are sea water temperature (name=to; code=20) and sea water salinity (name=sao; code=5).",
+    "",
+    "OPERATORS",
+    "    adisit  Potential temperature to in-situ temperature",
+    "            This is a special operator for the post processing of the ocean and sea ice model output.",
+    "            It converts potential temperature adiabatically to in-situ temperature to(t, s, p).",
+    "            Required input fields are sea water potential temperature (name=tho; code=2) and sea water salinity (name=sao; code=5).",
+    "            Pressure is calculated from the level information or can be specified by the optional parameter.",
+    "            Output fields are sea water temperature (name=to; code=20) and sea water salinity (name=s; code=5).",
+    "    adipot  In-situ temperature to potential temperature",
+    "            This is a special operator for the post processing of the ocean and sea ice",
+    "            model outpu.  It converts in-situ temperature to potential temperature tho(to,",
+    "            s, p).  Required input fields are sea water in-situ temperature (name=t; code=2) ",
+    "            and sea water salinity (name=sao,s; code=5).  Pressure is calculated",
+    "            from the level information or can be specified by the optional parameter.",
+    "            Output fields are sea water temperature (name=tho; code=2) and sea water",
+    "            salinity (name=s; code=5).",
     "",
     "PARAMETER",
     "    pressure  FLOAT   Pressure in bar (constant value assigned to all levels)",
@@ -4272,6 +4275,27 @@ static char *HurrHelp[] = {
     NULL
 };
 
+static char *FillmissHelp[] = {
+    "NAME",
+    "    fillmiss, fillmiss2 - Fill missing values",
+    "",
+    "SYNOPSIS",
+    "    fillmiss  ifile ofile",
+    "    fillmiss2[,maxiter]  ifile ofile",
+    "",
+    "DESCRIPTION",
+    "",
+    "OPERATORS",
+    "    fillmiss   Fill missing values",
+    "               Fill missing values by bilinear interpolation of the neightbours.",
+    "    fillmiss2  Fill missing values",
+    "               Fill missing values by using the neares value from up/down/left/right neightbours. ",
+    "",
+    "PARAMETER",
+    "    maxiter  INTEGER  Number of iterations to perform this nearest neightbours replacement",
+    NULL
+};
+
 static char *EcaCddHelp[] = {
     "NAME",
     "    eca_cdd - Consecutive dry days index per time period",
@@ -4289,7 +4313,7 @@ static char *EcaCddHelp[] = {
     "    - number_of_cdd_periods_with_more_than_5days_per_time_period",
     "",
     "PARAMETER",
-    "    R  FLOAT   Precipitation threshold (mm, default: R = 1 mm)",
+    "    R  FLOAT   Precipitation threshold (unit: mm; default: R = 1 mm)",
     NULL
 };
 
@@ -4317,18 +4341,15 @@ static char *EcaCsuHelp[] = {
     "    eca_csu[,T]  ifile ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile be a time series of the daily maximum temperature TX,",
-    "    then the largest number of consecutive days where TX > T is counted.",
-    "    The number T is an optional parameter with default T = 25 °C.",
-    "    Note that TN have to be given in units of Kelvin, whereas T have to be given",
-    "    in degrees Celsius.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    Let ifile be a time series of the daily maximum temperature TX, then the largest number of consecutive",
+    "    days where TX > T is counted. The number T is an optional parameter with default T = 25°C.",
+    "    Note that TN have to be given in units of Kelvin, whereas T have to be given in degrees Celsius.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - consecutive_summer_days_index_per_time_period",
     "",
     "PARAMETER",
-    "    T  FLOAT   Temperature threshold (� Celsius, default: T = 25� Celsius)",
+    "    T  FLOAT   Temperature threshold (unit: °C; default: T = 25°C)",
     NULL
 };
 
@@ -4343,14 +4364,13 @@ static char *EcaCwdHelp[] = {
     "    Let ifile be a time series of the daily precipitation amount RR, then the largest number ",
     "    of consecutive days where RR is at least R is counted. R is an optional parameter with ",
     "    default R = 1 mm. A further output variable is the number of wet periods of more than 5 days.",
-    "    The date information of a timestep in ofile is the date of the last contributing ",
-    "    timestep in ifile.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - consecutive_wet_days_index_per_time_period",
     "    - number_of_cwd_periods_with_more_than_5days_per_time_period",
     "",
     "PARAMETER",
-    "    R  FLOAT   Precipitation threshold (mm, default: R = 1 mm)",
+    "    R  FLOAT   Precipitation threshold (unit: mm; default: R = 1 mm)",
     NULL
 };
 
@@ -4362,25 +4382,21 @@ static char *EcaCwdiHelp[] = {
     "    eca_cwdi[,nday[,T]]  ifile1 ifile2 ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile1 be a time series of the daily minimum temperature TN,",
-    "    and let ifile2 be the mean TNnorm of daily minimum temperatures",
-    "    for any period used as reference. Then counted is the number of days",
+    "    Let ifile1 be a time series of the daily minimum temperature TN, and let ifile2 be the mean ",
+    "    TNnorm of daily minimum temperatures for any period used as reference. Then counted is the number of days",
     "    where, in intervals of at least nday consecutive days, TN < TNnorm - T.",
-    "    The numbers nday and T are optional parameters with default nday = 6",
-    "    and T = 5 °C. A further output variable is the number of cold",
-    "    waves longer than or equal to nday days.",
-    "    TNnorm is calculated as the mean of minimum temperatures of a five day ",
-    "    window centred on each calendar day of a given climate reference period.",
-    "    Note that both TN and TNnorm have to be given in the same units.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile1.",
+    "    The numbers nday and T are optional parameters with default nday = 6 and T = 5°C. ",
+    "    A further output variable is the number of cold waves longer than or equal to nday days.",
+    "    TNnorm is calculated as the mean of minimum temperatures of a five day window centred on each calendar day ",
+    "    of a given climate reference period. Note that both TN and TNnorm have to be given in the same units.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile1.",
     "    The following variables are created: ",
     "    - cold_wave_duration_index_wrt_mean_of_reference_period",
     "    - cold_waves_per_time_period",
     "",
     "PARAMETER",
     "    nday  INTEGER  Number of consecutive days (default: nday = 6)",
-    "    T     FLOAT    Temperature offset (� Celsius, default: T = 5� Celsius)",
+    "    T     FLOAT    Temperature offset (unit: °C; default: T = 5°C)",
     NULL
 };
 
@@ -4458,37 +4474,30 @@ static char *EcaGslHelp[] = {
     "    eca_gsl[,nday[,T[,fland]]]  ifile1 ifile2 ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile1 be a time series of the daily mean temperature TG,",
-    "    and ifile2 be a land-water mask.",
-    "    Within a period of 12 months, the thermal growing season length is officially",
-    "    defined as the number of days between:",
-    "    - frist occurrence of at least nday consecutive days with TG $>$ @math{T}",
-    "    - first occurrence of at least nday consecutive days with TG $<$ @math{T} within the last 6 months",
-    "    On northern hemispere, this period corresponds with the regular year, whereas",
-    "    on southern hemispere, it starts at july $1^{st}$. Please note, that this",
-    "    definition may lead to weird results concerning values TG = T: In the first",
-    "    half of the period, these days do not contribute to the gsl, but they do within",
-    "    the second half. Moreover this definition could lead to discontinuous values in",
-    "    equatorial regions.",
+    "    Let ifile1 be a time series of the daily mean temperature TG, and ifile2 be a land-water mask.",
+    "    Within a period of 12 months, the thermal growing season length is officially defined as the number of days between:",
+    "    - first occurrence of at least nday consecutive days with TG > T",
+    "    - first occurrence of at least nday consecutive days with TG < T within the last 6 months",
+    "    On northern hemispere, this period corresponds with the regular year, whereas on southern hemispere, it starts ",
+    "    at July 1st. Please note, that this definition may lead to weird results concerning values TG = T: ",
+    "    In the first half of the period, these days do not contribute to the gsl, but they do within the second half.",
+    "    Moreover this definition could lead to discontinuous values in equatorial regions.",
     "    ",
-    "    The numbers nday and T are optional parameter with default nday = 6",
-    "    and T = 5 °C. The number fland is an optional parameter with",
-    "    default value fland = 0.5 and denotes the fraction of a grid point that",
-    "    have to be covered by land in order to be included in the calculation. A",
-    "    further output variable is the start day of year of the growing season.",
-    "    Note that TG have to be given in units of Kelvin, whereas T have to be given",
-    "    in degrees Celsius.",
+    "    The numbers nday and T are optional parameter with default nday = 6 and T = 5°C. ",
+    "    The number fland is an optional parameter with default value fland = 0.5 and denotes the fraction of ",
+    "    a grid point that have to be covered by land in order to be included in the calculation. A further output variable ",
+    "    is the start day of year of the growing season. Note that TG have to be given in units of Kelvin, whereas T ",
+    "    have to be given in degrees Celsius.",
     "    ",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - thermal_growing_season_length",
     "    - day_of_year_of_growing_season_start",
     "",
     "PARAMETER",
     "    nday   INTEGER  Number of consecutive days (default: nday = 6)",
-    "    T      FLOAT   Temperature threshold (degree Celsius, default: T = 5� Celsius)",
-    "    fland  FLOAT   Land fraction threshold (default: fland = 0.5)",
+    "    T      FLOAT    Temperature threshold (unit: °C; default: T = 5°C)",
+    "    fland  FLOAT    Land fraction threshold (default: fland = 0.5)",
     NULL
 };
 
@@ -4500,20 +4509,18 @@ static char *EcaHdHelp[] = {
     "    eca_hd[,T1[,T2]]  ifile ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile be a time series of the daily mean temperature TG, then",
-    "    the heating degree days are defined as the sum of T1 - TG, where only",
-    "    values TG < T2 are considered. If T1 and T2 are omitted, a temperature",
-    "    of 17 °C is used for both parameters. If only T1 is given, T2 is",
-    "    set to T1. Note that TG have to be given in units of kelvin, whereas T1",
-    "    and T2 have to be given in degrees Celsius.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    Let ifile be a time series of the daily mean temperature TG, then the heating degree days ",
+    "    are defined as the sum of T1 - TG, where only values TG < T2 are considered. ",
+    "    If T1 and T2 are omitted, a temperature of 17°C is used for both parameters. ",
+    "    If only T1 is given, T2 is set to T1. Note that TG have to be given in units ",
+    "    of kelvin, whereas T1 and T2 have to be given in degrees Celsius.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - heating_degree_days_per_time_period",
     "",
     "PARAMETER",
-    "    T1  FLOAT   Temperature limit (� Celsius, default: T1 = 17� Celsius)",
-    "    T2  FLOAT   Temperature limit (� Celsius, default: T2 = T1)",
+    "    T1  FLOAT   Temperature limit (unit: °C; default: T1 = 17°C)",
+    "    T2  FLOAT   Temperature limit (unit: °C; default: T2 = T1)",
     NULL
 };
 
@@ -4525,25 +4532,21 @@ static char *EcaHwdiHelp[] = {
     "    eca_hwdi[,nday[,T]]  ifile1 ifile2 ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile1 be a time series of the daily maximum temperature TX,",
-    "    and let ifile2 be the mean TXnorm of daily maximum temperatures",
-    "    for any period used as reference. Then counted is the number of days",
+    "    Let ifile1 be a time series of the daily maximum temperature TX, and let ifile2 be the mean ",
+    "    TXnorm of daily maximum temperatures for any period used as reference. Then counted is the number of days",
     "    where, in intervals of at least nday consecutive days, TX > TXnorm + T.",
-    "    The numbers nday and T are optional parameters with default nday = 6",
-    "    and T = 5 °C. A further output variable is the number of heat",
-    "    waves longer than or equal to nday days. ",
-    "    TXnorm is calculated as the mean of maximum temperatures of a five day ",
-    "    window centred on each calendar day of a given climate reference period.",
-    "    Note that both TX and TXnorm have to be given in the same units.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile1.",
+    "    The numbers nday and T are optional parameters with default nday = 6 and T = 5°C. ",
+    "    A further output variable is the number of heat waves longer than or equal to nday days. ",
+    "    TXnorm is calculated as the mean of maximum temperatures of a five day window centred on each calendar day",
+    "    of a given climate reference period. Note that both TX and TXnorm have to be given in the same units.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile1.",
     "    The following variables are created: ",
     "    - heat_wave_duration_index_wrt_mean_of_reference_period",
     "    - heat_waves_per_time_period",
     "",
     "PARAMETER",
     "    nday  INTEGER  Number of consecutive days (default: nday = 6)",
-    "    T     FLOAT    Temperature offset (� Celsius, default: T = 5� Celsius)",
+    "    T     FLOAT    Temperature offset (unit: °C; default: T = 5°C)",
     NULL
 };
 
@@ -4792,15 +4795,14 @@ static char *EcaRr1Help[] = {
     "    eca_rr1[,R]  ifile ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile be a time series of the daily precipitation amount RR in [mm] (or alternatively in [kg m-2]),",
-    "    then the number of days where RR is at least R is counted. R is an optional parameter with ",
-    "    default R = 1 mm. The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    Let ifile be a time series of the daily precipitation amount RR in [mm] (or alternatively in [kg m-2]), then",
+    "    the number of days where RR is at least R is counted. R is an optional parameter with default R = 1 mm. ",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - wet_days_index_per_time_period",
     "",
     "PARAMETER",
-    "    R  FLOAT   Precipitation threshold (mm, default: R = 1 mm)",
+    "    R  FLOAT   Precipitation threshold (unit: mm; default: R = 1 mm)",
     NULL
 };
 
@@ -4834,19 +4836,16 @@ static char *EcaRx5dayHelp[] = {
     "    eca_rx5day[,x]  ifile ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile be a time series of 5-day precipitation totals RR,",
-    "    then the maximum of RR is written to ofile. A further output",
-    "    variable is the number of 5 day period with precipitation totals",
-    "    greater than x mm, where x is an optional parameter with default",
-    "    x = 50 mm.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    Let ifile be a time series of 5-day precipitation totals RR, then the maximum of RR is written to ofile. ",
+    "    A further output variable is the number of 5 day period with precipitation totals greater than x mm, where x ",
+    "    is an optional parameter with default x = 50 mm.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - highest_five_day_precipitation_amount_per_time_period",
     "    - number_of_5day_heavy_precipitation_periods_per_time_period",
     "",
     "PARAMETER",
-    "    x  FLOAT   Precipitation threshold (mm, default: x = 50 mm)",
+    "    x  FLOAT   Precipitation threshold (unit: mm; default: x = 50 mm)",
     NULL
 };
 
@@ -4858,16 +4857,14 @@ static char *EcaSdiiHelp[] = {
     "    eca_sdii[,R]  ifile ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile be a time series of the daily precipitation amount RR, then the mean ",
-    "    precipitation amount at wet days (RR > R) is written to ofile. ",
-    "    R is an optional parameter with default R = 1 mm.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    Let ifile be a time series of the daily precipitation amount RR, then the mean precipitation amount at ",
+    "    wet days (RR > R) is written to ofile. R is an optional parameter with default R = 1 mm.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - simple_daily_intensitiy_index_per_time_period",
     "",
     "PARAMETER",
-    "    R  FLOAT   Precipitation threshold (mm, default: R = 1 mm)",
+    "    R  FLOAT   Precipitation threshold (unit: mm; default: R = 1 mm)",
     NULL
 };
 
@@ -4879,17 +4876,15 @@ static char *EcaSuHelp[] = {
     "    eca_su[,T]  ifile ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile be a time series of the daily maximum temperature TX,",
-    "    then the number of days where TX > T is counted. The number T is",
-    "    an optional parameter with default T = 25 °C. Note that TX",
-    "    have to be given in units of Kelvin, whereas T have to be given in degrees Celsius.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    Let ifile be a time series of the daily maximum temperature TX, then the number of days where ",
+    "    TX > T is counted. The number T is an optional parameter with default T = 25°C. ",
+    "    Note that TX have to be given in units of Kelvin, whereas T have to be given in degrees Celsius.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - summer_days_index_per_time_period",
     "",
     "PARAMETER",
-    "    T  FLOAT   Temperature threshold (degree Celsius, default: T = 25� Celsius)",
+    "    T  FLOAT   Temperature threshold (unit: °C; default: T = 25°C)",
     NULL
 };
 
@@ -4967,15 +4962,12 @@ static char *EcaTn90pHelp[] = {
     "    eca_tn90p  ifile1 ifile2 ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile1 be a time series of the daily minimum temperature TN, and",
-    "    ifile2 be the 90th percentile TNn90 of daily minimum temperatures",
-    "    for any period used as reference. Then the percentage of time where TN > TNn90 ",
-    "    is calculated.",
-    "    TNn90 is calculated as the 90th percentile of daily minimum temperatures of a five ",
-    "    day window centred on each calendar day of a given climate reference period.",
-    "    Note that both TN and TNn90 have to be given in the same units.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile1.",
+    "    Let ifile1 be a time series of the daily minimum temperature TN, and ifile2 be the ",
+    "    90th percentile TNn90 of daily minimum temperatures for any period used as reference. ",
+    "    Then the percentage of time where TN > TNn90 is calculated. TNn90 is calculated as the 90th percentile",
+    "    of daily minimum temperatures of a five day window centred on each calendar day of a given climate",
+    "    reference period. Note that both TN and TNn90 have to be given in the same units.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile1.",
     "    The following variables are created: ",
     "    - warm_nights_percent_wrt_90th_percentile_of_reference_period",
     NULL
@@ -4989,17 +4981,15 @@ static char *EcaTrHelp[] = {
     "    eca_tr[,T]  ifile ofile",
     "",
     "DESCRIPTION",
-    "    Let ifile be a time series of the daily minimum temperature TN,",
-    "    then the number of days where TN > T is counted. The number T is",
-    "    an optional parameter with default T = 20 °C. Note that TN",
-    "    have to be given in units of Kelvin, whereas T have to be given in degrees Celsius.",
-    "    The date information of a timestep in ofile is the date of",
-    "    the last contributing timestep in ifile.",
+    "    Let ifile be a time series of the daily minimum temperature TN, then the number of days where ",
+    "    TN > T is counted. The number T is an optional parameter with default T = 20°C. ",
+    "    Note that TN have to be given in units of Kelvin, whereas T have to be given in degrees Celsius.",
+    "    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.",
     "    The following variables are created: ",
     "    - tropical_nights_index_per_time_period",
     "",
     "PARAMETER",
-    "    T  FLOAT   Temperature threshold (� Celsius, default: T = 20� Celsius)",
+    "    T  FLOAT   Temperature threshold (unit: °C; default: T = 20°C)",
     NULL
 };
 
diff --git a/src/par_io.c b/src/par_io.c
index 78f4ed3..5bc3a96 100644
--- a/src/par_io.c
+++ b/src/par_io.c
@@ -1,8 +1,8 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 #  include <pthread.h>
 #endif
 
@@ -39,13 +39,13 @@ void parReadRecord(int streamID, int *varID, int *levelID, double *array, int *n
 {
   int lpario = FALSE;
   int recID = 0, nrecs = 0;
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_t thrID;
   /* pthread_attr_t attr; */
   int rval;
 #endif
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( parIO )
     {
       lpario = TRUE;
@@ -66,7 +66,7 @@ void parReadRecord(int streamID, int *varID, int *levelID, double *array, int *n
 
       readRecord(&read_arg);
     }
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   else
     {
       /* fprintf(stderr, "parIO1: %ld streamID %d %d %d\n", (long)thrID, streamID, recID, nrecs); */
diff --git a/src/par_io.h b/src/par_io.h
index b6505e8..3b59c5a 100644
--- a/src/par_io.h
+++ b/src/par_io.h
@@ -1,11 +1,11 @@
 #ifndef _PAR_IO_H
 #define _PAR_IO_H
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 #  include <pthread.h>
 #endif
 
@@ -24,7 +24,7 @@ typedef struct {
   int array_size;
   int recID, nrecs;
   read_arg_t read_arg;
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_t thrID;
   pthread_attr_t attr;
 #endif
diff --git a/src/pipe.c b/src/pipe.c
index 86e14e8..026e5a8 100644
--- a/src/pipe.c
+++ b/src/pipe.c
@@ -16,7 +16,7 @@
 */
 
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -30,7 +30,7 @@
 #include "error.h"
 #include "dmemory.h"
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 
 static int PipeDebug = 0;
 
@@ -43,7 +43,7 @@ void pipe_init(pipe_t *pipe)
   pthread_mutexattr_init(&m_attr);
   pthread_condattr_init(&c_attr);
   /*
-#if defined (_POSIX_THREAD_PROCESS_SHARED)
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
   if ( PipeDebug )
     {
       Message("setpshared mutexattr to PTHREAD_PROCESS_SHARED");
diff --git a/src/pipe.h b/src/pipe.h
index c373d99..8a9470e 100644
--- a/src/pipe.h
+++ b/src/pipe.h
@@ -18,13 +18,13 @@
 #ifndef _PIPE_H
 #define _PIPE_H
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
 #include <sys/types.h>
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 
 #include <pthread.h>
 #include "pthread_debug.h"
@@ -57,7 +57,7 @@ typedef struct {
   char          *name;
   char         **mfnames;
   varlist_t     *varlist;
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   void          *argument;
   struct pipe_s *pipe;
   pthread_t     rthreadID; /* read  thread ID */
@@ -66,7 +66,7 @@ typedef struct {
 } pstream_t;
 
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 
 struct pipe_s {
   int     nrecs, EOP;
diff --git a/src/printinfo.h b/src/printinfo.h
index c7ab8e7..2ad9706 100644
--- a/src/printinfo.h
+++ b/src/printinfo.h
@@ -213,9 +213,7 @@ void printGridInfo(int vlistID)
 	      fprintf(stdout, "%*s", nbyte0, "");
 	      fprintf(stdout, "%-9s : first = %.9g", yname, yfirst);
 	      if ( ysize > 1 ) fprintf(stdout, "  last = %.9g", ylast);
-	      if ( IS_NOT_EQUAL(yinc, 0) &&
-		   (gridtype == GRID_LONLAT || gridtype == GRID_SINUSOIDAL ||
-		    gridtype == GRID_LCC2 || gridtype == GRID_LAEA) )
+	      if ( IS_NOT_EQUAL(yinc, 0) && gridtype != GRID_GAUSSIAN && gridtype != GRID_GAUSSIAN_REDUCED )
 		fprintf(stdout, "  inc = %.9g", yinc);
 	      fprintf(stdout, "  %s", yunits);
 	      fprintf(stdout, "\n");
@@ -278,28 +276,37 @@ void printGridInfo(int vlistID)
 	  nd = gridInqGMEnd(gridID);
 	  fprintf(stdout, "size      : dim = %d  nd = %d  ni = %d\n", gridsize, nd, ni);
 	}
-      else if ( gridtype == GRID_REFERENCE )
-	{
-	  int number, position;
-	  number   = gridInqNumber(gridID);
-	  position = gridInqPosition(gridID);
-	  fprintf(stdout, "size      : dim = %d\n", gridsize);
-	  fprintf(stdout, "%*s", nbyte0, "");
-	  fprintf(stdout, "grid      : number = %d  position = %d\n", number, position);
-	  if ( gridInqReference(gridID, NULL) )
-	    {
-	      char reference_link[8192];
-	      gridInqReference(gridID, reference_link);
-	      fprintf(stdout, "%*s", nbyte0, "");
-	      fprintf(stdout, "path      : %s\n", reference_link);
-	    }
-	}
       else if ( gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED )
 	{
 	  if ( gridtype == GRID_CURVILINEAR )
-	    fprintf(stdout, "size      : dim = %d  nx = %d  ny = %d\n", gridsize, xsize, ysize);
+	    fprintf(stdout, "size      : dim = %d  nx = %d  ny = %d", gridsize, xsize, ysize);
 	  else
-	    fprintf(stdout, "size      : dim = %d  nvertex = %d\n", gridsize, gridInqNvertex(gridID));
+	    fprintf(stdout, "size      : dim = %d", gridsize);
+
+          if ( gridtype == GRID_UNSTRUCTURED && gridInqNvertex(gridID) > 0 )
+	    fprintf(stdout, "  nvertex = %d", gridInqNvertex(gridID));
+
+          fprintf(stdout, "\n");
+
+          if ( gridtype == GRID_UNSTRUCTURED )
+            {
+              int number   = gridInqNumber(gridID);
+              int position = gridInqPosition(gridID);
+
+              if ( number > 0 )
+                {
+                  fprintf(stdout, "%*s", nbyte0, "");
+                  fprintf(stdout, "grid      : number = %d  position = %d\n", number, position);
+                }
+
+              if ( gridInqReference(gridID, NULL) )
+                {
+                  char reference_link[8192];
+                  gridInqReference(gridID, reference_link);
+                  fprintf(stdout, "%*s", nbyte0, "");
+                  fprintf(stdout, "uri       : %s\n", reference_link);
+                }
+            }
 
 	  if ( gridInqXvals(gridID, NULL) && gridInqYvals(gridID, NULL) )
 	    {
diff --git a/src/process.c b/src/process.c
index 358b418..1160916 100644
--- a/src/process.c
+++ b/src/process.c
@@ -15,18 +15,18 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if  defined  (HAVE_PTHREAD_H)
+#if defined(HAVE_PTHREAD_H)
 #  include <pthread.h>
 #endif
 
 #include <stdio.h>
 #include <string.h>
 
-#if  defined  (HAVE_GLOB_H)
+#if defined(HAVE_GLOB_H)
 #include <glob.h>
 #endif
 
@@ -55,7 +55,7 @@ typedef struct {
 operator_t;
 
 typedef struct {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_t   threadID;
   int         l_threadID;
 #endif
@@ -90,7 +90,7 @@ static process_t Process[MAX_PROCESS];
 static int NumProcess = 0;
 static int NumProcessActive = 0;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 pthread_mutex_t processMutex = PTHREAD_MUTEX_INITIALIZER;
 #endif
 
@@ -99,21 +99,21 @@ int processCreate(void)
 {
   int processID;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_lock(&processMutex);
 #endif
 
   processID = NumProcess++;
   NumProcessActive++;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_unlock(&processMutex);  
 #endif
 
   if ( processID >= MAX_PROCESS )
     Error("Limit of %d processes reached!", MAX_PROCESS);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   Process[processID].threadID     = pthread_self();
   Process[processID].l_threadID   = 1;
 #endif
@@ -139,7 +139,7 @@ int processCreate(void)
 int processSelf(void)
 {
   int processID = 0;
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_t thID = pthread_self();
 
   pthread_mutex_lock(&processMutex);
@@ -168,13 +168,13 @@ int processNums(void)
 {
   int pnums = 0;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_lock(&processMutex);
 #endif
 
   pnums = NumProcess;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_unlock(&processMutex);  
 #endif
 
@@ -186,13 +186,13 @@ int processNumsActive(void)
 {
   int pnums = 0;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_lock(&processMutex);
 #endif
 
   pnums = NumProcessActive;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_unlock(&processMutex);  
 #endif
 
@@ -330,7 +330,7 @@ const char *processInqPrompt(void)
   return (Process[processID].prompt);
 }
 
-#if  defined  (HAVE_GLOB_H)
+#if defined(HAVE_GLOB_H)
 /* Convert a wildcard pattern into a list of blank-separated filenames which match the wildcard. */
 argument_t *glob_pattern(const char *restrict wildcard)
 {
@@ -557,7 +557,7 @@ int expand_wildcards(int processID, int streamCnt)
   for ( i = 0; i < len; ++i ) if ( streamname0[i] == '?' || streamname0[i] == '*' || streamname0[i] == '[' ) break;
   if ( i < len )
     {
-#if  defined  (HAVE_GLOB_H)
+#if defined(HAVE_GLOB_H)
       argument_t *glob_arg = glob_pattern(streamname0);
 
       if ( strcmp(streamname0, glob_arg->args) != 0 )
@@ -795,14 +795,14 @@ void processDelete(void)
   int processID = processSelf();
 
   //fprintf(stderr, "delete processID %d\n", processID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_lock(&processMutex);
 
   Process[processID].l_threadID = 0;
 #endif
   NumProcessActive--;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pthread_mutex_unlock(&processMutex);  
 #endif
 }
diff --git a/src/pstream.c b/src/pstream.c
index 5a3310e..bc4246b 100644
--- a/src/pstream.c
+++ b/src/pstream.c
@@ -15,11 +15,11 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #  include <omp.h>
 #endif
 
@@ -57,7 +57,7 @@ static void pstream_initialize(void);
 
 static int _pstream_init = FALSE;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 #include <pthread.h>
 #include "pthread_debug.h"
 
@@ -200,7 +200,7 @@ void pstream_init_entry(pstream_t *pstreamptr)
   pstreamptr->name       = NULL;
   pstreamptr->mfnames    = NULL;
   pstreamptr->varlist    = NULL;
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   pstreamptr->argument   = NULL;
   pstreamptr->pipe       = NULL;
   //  pstreamptr->rthreadID  = 0;
@@ -246,7 +246,7 @@ void pstream_initialize(void)
 {
   char *env;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   /* initialize global API mutex lock */
   pthread_mutex_init(&_pstream_mutex, NULL);
 #endif
@@ -321,7 +321,7 @@ int pstreamOpenRead(const argument_t *argument)
   */
   if ( ispipe )
     {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       char *operatorArg;
       char *operatorName;
       char *newarg;
@@ -536,7 +536,7 @@ int pstreamOpenRead(const argument_t *argument)
 
       if ( PSTREAM_Debug ) Message("file %s", filename);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO )
 	pthread_mutex_lock(&streamMutex);
       else
@@ -552,7 +552,7 @@ int pstreamOpenRead(const argument_t *argument)
 	cdoDefaultInstID = streamInqInstID(fileID);
       */
       cdoInqHistory(fileID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO )
 	pthread_mutex_unlock(&streamMutex);
       else
@@ -641,7 +641,7 @@ int pstreamOpenWrite(const argument_t *argument, int filetype)
 
   if ( ispipe )
     {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( PSTREAM_Debug ) Message("pipe %s", argument->args);
       pstreamID = pstreamFindID(argument->args);
       if ( pstreamID == -1 ) Error("%s is not open!", argument->args);
@@ -678,14 +678,14 @@ int pstreamOpenWrite(const argument_t *argument, int filetype)
 	}
 
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_write);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO )
 	pthread_mutex_lock(&streamMutex);
       else
 	pthread_mutex_lock(&streamOpenWriteMutex);
 #endif
       fileID = streamOpenWrite(argument->args, filetype);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO )
 	pthread_mutex_unlock(&streamMutex);
       else
@@ -769,14 +769,14 @@ int pstreamOpenAppend(const argument_t *argument)
       if ( PSTREAM_Debug ) Message("file %s", argument->args);
 
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_write);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO )
 	pthread_mutex_lock(&streamMutex);
       else
 	pthread_mutex_lock(&streamOpenReadMutex);
 #endif
       fileID = streamOpenAppend(argument->args);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO )
 	pthread_mutex_unlock(&streamMutex);
       else
@@ -810,7 +810,7 @@ void pstreamClose(int pstreamID)
 
   if ( pstreamptr->ispipe )
     {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       pipe_t *pipe;
       int lread = FALSE, lwrite = FALSE;
       pthread_t threadID = pthread_self();
@@ -889,11 +889,11 @@ void pstreamClose(int pstreamID)
 	  processAddNvals(streamNvals(pstreamptr->fileID));
 	}
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamClose(pstreamptr->fileID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
 
@@ -932,7 +932,7 @@ int pstreamInqVlist(int pstreamID)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     {
       vlistID = pipeInqVlist(pstreamptr);
@@ -945,11 +945,11 @@ int pstreamInqVlist(int pstreamID)
       extern int cdoDefaultTimeType;
 
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_read);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       vlistID = streamInqVlist(pstreamptr->fileID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_read);
@@ -1065,7 +1065,7 @@ void pstreamDefVlist(int pstreamID, int vlistID)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     {
       int vlistIDcp = vlistDuplicate(vlistID);
@@ -1105,11 +1105,11 @@ void pstreamDefVlist(int pstreamID, int vlistID)
       pstreamDefVarlist(pstreamptr, vlistID);
 
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_write);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamDefVlist(pstreamptr->fileID, vlistID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_write);
@@ -1123,18 +1123,18 @@ int pstreamInqRecord(int pstreamID, int *varID, int *levelID)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     pipeInqRecord(pstreamptr, varID, levelID);
   else
 #endif
     {
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_read);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamInqRecord(pstreamptr->fileID, varID, levelID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_read);
@@ -1152,7 +1152,7 @@ void pstreamDefRecord(int pstreamID, int varID, int levelID)
   
   pstreamptr->varID = varID;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     {
       pipeDefRecord(pstreamptr, varID, levelID);
@@ -1161,11 +1161,11 @@ void pstreamDefRecord(int pstreamID, int varID, int levelID)
 #endif
     {
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_write);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamDefRecord(pstreamptr->fileID, varID, levelID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_write);
@@ -1181,18 +1181,18 @@ void pstreamReadRecord(int pstreamID, double *data, int *nmiss)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     pipeReadRecord(pstreamptr, data, nmiss);
   else
 #endif
     {
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_read);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamReadRecord(pstreamptr->fileID, data, nmiss);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_read);
@@ -1277,7 +1277,7 @@ void pstreamWriteRecord(int pstreamID, double *data, int nmiss)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     {
       pipeWriteRecord(pstreamptr, data, nmiss);
@@ -1292,11 +1292,11 @@ void pstreamWriteRecord(int pstreamID, double *data, int nmiss)
 	if ( pstreamptr->varlist[varID].check_datarange )
 	  pstreamCheckDatarange(pstreamptr, varID, data, nmiss);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamWriteRecord(pstreamptr->fileID, data, nmiss);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
 
@@ -1313,7 +1313,7 @@ void pstreamWriteRecordF(int pstreamID, float *data, int nmiss)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     {
       cdoAbort("pipeWriteRecord not implemented for memtype float!");
@@ -1329,11 +1329,11 @@ void pstreamWriteRecordF(int pstreamID, float *data, int nmiss)
 	if ( pstreamptr->varlist[varID].check_datarange )
 	  pstreamCheckDatarange(pstreamptr, varID, data, nmiss);
       */
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamWriteRecordF(pstreamptr->fileID, data, nmiss);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_write);
@@ -1348,7 +1348,7 @@ int pstreamInqTimestep(int pstreamID, int tsID)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     nrecs = pipeInqTimestep(pstreamptr, tsID);
   else
@@ -1359,11 +1359,11 @@ int pstreamInqTimestep(int pstreamID, int tsID)
       if ( pstreamptr->mfiles ) tsID -= pstreamptr->tsID0;
 
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_read);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       nrecs = streamInqTimestep(pstreamptr->fileID, tsID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_read);
@@ -1387,7 +1387,7 @@ int pstreamInqTimestep(int pstreamID, int tsID)
 	  strcpy(filename, pstreamptr->mfnames[nfile]);
 	  pstreamptr->nfiles++;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 	  if ( cdoLockIO )
 	    pthread_mutex_lock(&streamMutex);
 	  else
@@ -1402,7 +1402,7 @@ int pstreamInqTimestep(int pstreamID, int tsID)
 
 	  vlistCompare(vlistIDold, vlistIDnew, CMP_HRD);
 	  vlistDestroy(vlistIDold);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 	  if ( cdoLockIO )
 	    pthread_mutex_unlock(&streamMutex);
 	  else
@@ -1416,11 +1416,11 @@ int pstreamInqTimestep(int pstreamID, int tsID)
 	  pstreamptr->fileID = fileID;
 
 	  if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_read);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
 	  nrecs = streamInqTimestep(pstreamptr->fileID, 0);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
 	  if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_read);
@@ -1446,7 +1446,7 @@ void pstreamDefTimestep(int pstreamID, int tsID)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     pipeDefTimestep(pstreamptr, tsID);
   else
@@ -1464,11 +1464,11 @@ void pstreamDefTimestep(int pstreamID, int tsID)
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_start(timer_write);
       /* don't use sync -> very slow on GPFS */
       //  if ( tsID > 0 ) streamSync(pstreamptr->fileID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamDefTimestep(pstreamptr->fileID, tsID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
       if ( processNums() == 1 && ompNumThreads == 1 ) timer_stop(timer_write);
@@ -1486,7 +1486,7 @@ void pstreamCopyRecord(int pstreamIDdest, int pstreamIDsrc)
   pstreamptr_dest = pstream_to_pointer(pstreamIDdest);
   pstreamptr_src  = pstream_to_pointer(pstreamIDsrc);
   /*
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr_dest->ispipe || pstreamptr_src->ispipe )
     {
       pipeCopyRecord(pstreamptr_dest, pstreamptr_src);
@@ -1495,11 +1495,11 @@ void pstreamCopyRecord(int pstreamIDdest, int pstreamIDsrc)
 #endif
   */
     {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_lock(&streamMutex);
 #endif
       streamCopyRecord(pstreamptr_dest->fileID, pstreamptr_src->fileID);
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
       if ( cdoLockIO ) pthread_mutex_unlock(&streamMutex);
 #endif
     }
@@ -1514,13 +1514,13 @@ void pstreamDebug(int debug)
 
 void cdoInitialize(void *argument)
 {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   omp_set_num_threads(ompNumThreads); /* Have to be called for every module (pthread)! */
 #endif
 
   processCreate();
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( PSTREAM_Debug )
      Message("process %d  thread %ld", processSelf(), pthread_self());
 #endif
@@ -1543,7 +1543,7 @@ void cdoFinish(void)
   double p_cputime = 0, p_usertime = 0, p_systime = 0;
   pstream_t *pstreamptr;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( PSTREAM_Debug )
     Message("process %d  thread %ld", processID, pthread_self());
 #endif
@@ -1557,7 +1557,7 @@ void cdoFinish(void)
       if ( nvals > 0 )
 	{
 	  if ( sizeof(INT64) > sizeof(long) )
-#if defined (_WIN32)
+#if defined(_WIN32)
 	    fprintf(stderr, "%s: Processed %I64d value%s from %d variable%s",
 #else
 	    fprintf(stderr, "%s: Processed %jd value%s from %d variable%s",
@@ -1599,7 +1599,7 @@ void cdoFinish(void)
   c_systime  = e_stime - s_stime;
   c_cputime  = c_usertime + c_systime;
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pthreadScope == PTHREAD_SCOPE_PROCESS )
     {
       c_usertime /= processNums();
@@ -1640,7 +1640,7 @@ void cdoFinish(void)
 	}
     }
 
-#if defined (HAVE_SYS_TIMES_H)
+#if defined(HAVE_SYS_TIMES_H)
   if ( cdoBenchmark )
     fprintf(stderr, " ( %.2fs %.2fs %.2fs %s)\n", c_usertime, c_systime, c_cputime, memstring);
   else
@@ -1678,7 +1678,7 @@ int pstreamInqFiletype(int pstreamID)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     filetype = pstreamptr->filetype;
   else
@@ -1696,7 +1696,7 @@ int pstreamInqByteorder(int pstreamID)
 
   pstreamptr = pstream_to_pointer(pstreamID);
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( pstreamptr->ispipe )
     byteorder = pstreamptr->filetype;
   else
@@ -1709,7 +1709,7 @@ int pstreamInqByteorder(int pstreamID)
 
 void openLock(void)
 {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( cdoLockIO )
     pthread_mutex_lock(&streamMutex);
   else
@@ -1720,7 +1720,7 @@ void openLock(void)
 
 void openUnlock(void)
 {
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
   if ( cdoLockIO )
     pthread_mutex_unlock(&streamMutex);
   else
diff --git a/src/pthread_debug.c b/src/pthread_debug.c
index 0c3b12d..a645597 100644
--- a/src/pthread_debug.c
+++ b/src/pthread_debug.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -6,7 +6,7 @@
 
 
 
-#if  defined  (HAVE_LIBPTHREAD)
+#if defined(HAVE_LIBPTHREAD)
 #include <pthread.h>
 #include <errno.h>
 #include "error.h"
@@ -56,7 +56,7 @@ void print_pthread_attr(const char *caller, pthread_attr_t *attr)
   pthread_attr_getdetachstate(attr, &detachstate);
   POUT2(caller, detachstate, PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED);
 
-#if defined (SCHED_FIFO)
+#if defined(SCHED_FIFO)
   pthread_attr_getschedpolicy(attr, &policy);
   POUT3(caller, policy, SCHED_FIFO, SCHED_RR, SCHED_OTHER);
   pthread_attr_getschedparam(attr, &param);
@@ -64,7 +64,7 @@ void print_pthread_attr(const char *caller, pthread_attr_t *attr)
   fprintf(stderr, "%-18s :  %-14s = %d\n", caller, "priority", priority);
 #endif
 
-#if defined (PTHREAD_INHERIT_SCHED)
+#if defined(PTHREAD_INHERIT_SCHED)
   pthread_attr_getinheritsched(attr, &inherit);
   POUT2(caller, inherit, PTHREAD_INHERIT_SCHED, PTHREAD_EXPLICIT_SCHED);
 #endif
@@ -80,7 +80,7 @@ void print_pthread_attr(const char *caller, pthread_attr_t *attr)
 void print_pthread_mutexattr(const char *caller,  pthread_mutexattr_t *m_attr)
 {
   /*
-#if defined (_POSIX_THREAD_PRIO_PROTECT) && defined (_POSIX_THREAD_PRIO_INHERIT)
+#if defined(_POSIX_THREAD_PRIO_PROTECT) && defined(_POSIX_THREAD_PRIO_INHERIT)
   {
   int protocol;
   pthread_mutexattr_getprotocol(m_attr, &protocol);
@@ -88,7 +88,7 @@ void print_pthread_mutexattr(const char *caller,  pthread_mutexattr_t *m_attr)
   }
 #endif
   */
-#if defined (PTHREAD_MUTEX_FAST_NP)
+#if defined(PTHREAD_MUTEX_FAST_NP)
   {
   int kind;
   pthread_mutexattr_getkind_np(m_attr, &kind);
@@ -96,7 +96,7 @@ void print_pthread_mutexattr(const char *caller,  pthread_mutexattr_t *m_attr)
   }
 #endif
 
-#if defined (_POSIX_THREAD_PROCESS_SHARED)
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
   {
   int pshared;
   pthread_mutexattr_getpshared(m_attr, &pshared);
@@ -108,7 +108,7 @@ void print_pthread_mutexattr(const char *caller,  pthread_mutexattr_t *m_attr)
 
 void print_pthread_condattr(const char *caller, pthread_condattr_t *c_attr)
 {
-#if defined (_POSIX_THREAD_PROCESS_SHARED)
+#if defined(_POSIX_THREAD_PROCESS_SHARED)
   {
   int pshared;
   pthread_condattr_getpshared(c_attr, &pshared);
diff --git a/src/realtime.c b/src/realtime.c
index 24166d6..adcc31a 100644
--- a/src/realtime.c
+++ b/src/realtime.c
@@ -1,6 +1,6 @@
 /* Portable CPU-timer (User + Sys); also WALL CLOCK-timer */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -9,7 +9,7 @@
 #include <time.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#if defined (HAVE_SYS_TIMES_H)
+#if defined(HAVE_SYS_TIMES_H)
 #include <sys/times.h>
 #endif
 /* #include <sys/param.h> */
@@ -30,7 +30,7 @@ int util_cputime(double *user_time, double *system_time)
   *user_time   = dclock()-clock0;
   *system_time = (double) 0;
 #else
-#if defined (HAVE_SYS_TIMES_H)
+#if defined(HAVE_SYS_TIMES_H)
   struct tms tbuf;
   if (times(&tbuf) == ((clock_t)-1)) return ((int) (-1)); 
 
@@ -48,7 +48,7 @@ int util_cputime(double *user_time, double *system_time)
 double util_walltime(void)
 {
   double time_in_secs = 0;
-#if defined (HAVE_SYS_TIMES_H)
+#if defined(HAVE_SYS_TIMES_H)
   static double time_init = 0.;
 
   struct timeval tbuf;
@@ -124,7 +124,7 @@ void util_diff_real_time(void *it1, void *it2, double *t)
       +1.0e-9*( (double)tb2->tb_low - (double)tb1->tb_low ));
 } 
 
-#elif defined (_HIGH_RESOLUTION_TIMER) && (defined (SX) || defined (ES)) 
+#elif defined(_HIGH_RESOLUTION_TIMER) && (defined (SX) || defined(ES)) 
 
 #define CPU_CLOCK 2.0e-9    /* SX-6: 500 MHz */
 
@@ -154,7 +154,7 @@ void util_diff_real_time(void *it1, void *it2, double *t)
   *t = *t2 - *t1;
 } 
 
-#elif defined (_HIGH_RESOLUTION_TIMER) && defined (LINUX)
+#elif defined(_HIGH_RESOLUTION_TIMER) && defined(LINUX)
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/src/remap.h b/src/remap.h
index 279efaa..fd411f3 100644
--- a/src/remap.h
+++ b/src/remap.h
@@ -1,4 +1,4 @@
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #include <omp.h>
 #endif
 
@@ -24,7 +24,7 @@ typedef RESTR_TYPE restr_t;
 #  define RESTR_ABS(x)   fabs(x)
 */
 
-#define TINY_FRAC 1.e-10
+#define  TINY_FRAC     1.e-10
 
 #define  NORM_OPT_NONE      1
 #define  NORM_OPT_DESTAREA  2
diff --git a/src/remap_scrip_io.c b/src/remap_scrip_io.c
new file mode 100644
index 0000000..5a50d9b
--- /dev/null
+++ b/src/remap_scrip_io.c
@@ -0,0 +1,762 @@
+#if defined(HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
+#if defined(HAVE_LIBNETCDF)
+#  include "netcdf.h"
+#endif
+
+#include <time.h>
+
+#include <cdi.h>
+#include "cdo.h"
+#include "cdo_int.h"
+#include "grid.h"
+#include "remap.h"
+
+
+void remapGridInitPointer(remapgrid_t *rg);
+void remapGridRealloc(int map_type, remapgrid_t *rg);
+
+
+#if defined(HAVE_LIBNETCDF)
+static
+void nce(int istat)
+{
+  /*
+    This routine provides a simple interface to netCDF error message routine.
+  */
+
+  if ( istat != NC_NOERR ) cdoAbort(nc_strerror(istat));
+}
+#endif
+
+
+void write_remap_scrip(const char *interp_file, int map_type, int submap_type, 
+		       int remap_order, remapgrid_t rg, remapvars_t rv)
+{
+  /*
+    Writes remap data to a netCDF file using SCRIP conventions
+  */
+  /*
+    Input variables:
+
+    interp_file  ! filename for remap data
+  */
+
+#if defined(HAVE_LIBNETCDF)
+
+  /* Local variables */
+
+  int nc_file_id;           /* id for netCDF file                       */
+  int nc_srcgrdsize_id;     /* id for source grid size                  */
+  int nc_dstgrdsize_id;     /* id for destination grid size             */
+  int nc_srcgrdcorn_id = 0; /* id for number of source grid corners     */
+  int nc_dstgrdcorn_id = 0; /* id for number of dest grid corners       */
+  int nc_srcgrdrank_id;     /* id for source grid rank                  */
+  int nc_dstgrdrank_id;     /* id for dest grid rank                    */
+  int nc_numlinks_id;       /* id for number of links in mapping        */
+  int nc_numwgts_id;        /* id for number of weights for mapping     */
+  int nc_srcgrddims_id;     /* id for source grid dimensions            */
+  int nc_dstgrddims_id;     /* id for dest grid dimensions              */
+  int nc_srcgrdcntrlat_id;  /* id for source grid center latitude       */
+  int nc_dstgrdcntrlat_id;  /* id for dest grid center latitude         */
+  int nc_srcgrdcntrlon_id;  /* id for source grid center longitude      */
+  int nc_dstgrdcntrlon_id;  /* id for dest grid center longitude        */
+  int nc_srcgrdimask_id;    /* id for source grid mask                  */
+  int nc_dstgrdimask_id;    /* id for dest grid mask                    */
+  int nc_srcgrdcrnrlat_id;  /* id for latitude of source grid corners   */
+  int nc_srcgrdcrnrlon_id;  /* id for longitude of source grid corners  */
+  int nc_dstgrdcrnrlat_id;  /* id for latitude of dest grid corners     */
+  int nc_dstgrdcrnrlon_id;  /* id for longitude of dest grid corners    */
+  int nc_srcgrdarea_id;     /* id for area of source grid cells         */
+  int nc_dstgrdarea_id;     /* id for area of dest grid cells           */
+  int nc_srcgrdfrac_id;     /* id for area fraction on source grid      */
+  int nc_dstgrdfrac_id;     /* id for area fraction on dest grid        */
+  int nc_srcadd_id;         /* id for map source address                */
+  int nc_dstadd_id;         /* id for map destination address           */
+  int nc_rmpmatrix_id;      /* id for remapping matrix                  */
+
+  int nc_dims2_id[2];       /* netCDF ids for 2d array dims             */
+
+  char *map_name = "SCRIP remapping with CDO";
+  char normalize_opt[64] = "unknown";
+  char map_method[64] = "unknown";
+  char tmp_string[64] = "unknown";
+  char history[1024] = "date and time";
+  char grid1_name[64] = "source grid";
+  char grid2_name[64] = "dest grid";
+  char *grid1_units = "radians";
+  char *grid2_units = "radians";
+  time_t date_and_time_in_sec;
+  struct tm *date_and_time;
+  long i;
+  int lgridarea = FALSE;
+  int writemode = NC_CLOBBER;
+
+  switch ( rv.norm_opt )
+    {
+    case NORM_OPT_NONE:
+      strcpy(normalize_opt, "none");
+      break;
+    case NORM_OPT_FRACAREA:
+      strcpy(normalize_opt, "fracarea");
+      break;
+    case NORM_OPT_DESTAREA:
+      strcpy(normalize_opt, "destarea");
+      break;
+    }
+
+  switch ( map_type )
+    {
+    case MAP_TYPE_CONSERV:
+      lgridarea = TRUE;
+      if ( submap_type == SUBMAP_TYPE_LAF )
+	{
+	  strcpy(map_method, "Largest area fraction");
+	  break;
+	}
+      else
+	{
+	  strcpy(map_method, "Conservative remapping");
+	  break;
+	}
+    case MAP_TYPE_BILINEAR:
+      strcpy(map_method, "Bilinear remapping");
+      break;
+    case MAP_TYPE_BICUBIC:
+      strcpy(map_method, "Bicubic remapping");
+      break;
+    case MAP_TYPE_DISTWGT:
+      strcpy(map_method, "Distance weighted avg of nearest neighbors");
+      break;
+    case MAP_TYPE_DISTWGT1:
+      strcpy(map_method, "Nearest neighbor");
+      break;
+    }
+
+  {
+    size_t filesize;
+    size_t nele1, nele2;
+
+    nele1 = 4*8 + 4;
+    nele2 = 4*8 + 4;
+    if ( rg.lneed_grid1_corners ) nele1 += rg.grid1_corners*2*8;
+    if ( rg.lneed_grid2_corners ) nele2 += rg.grid2_corners*2*8;
+    filesize = rg.grid1_size*(nele1) +
+               rg.grid2_size*(nele2) +
+               rv.num_links*(4 + 4 + rv.num_wts*8);
+
+    if ( cdoVerbose )
+      cdoPrint("Filesize for remap weights: ~%lu", (unsigned long) filesize);
+    
+    if ( filesize > 0x7FFFFC00 ) /* 2**31 - 1024 (<2GB) */
+      {
+#if defined(NC_64BIT_OFFSET)
+	writemode = NC_CLOBBER | NC_64BIT_OFFSET;
+#else
+	cdoAbort("Filesize for remap weights maybe too large!");
+#endif
+      }
+  }
+
+  /* Create netCDF file for mapping and define some global attributes */
+  nce(nc_create(interp_file, writemode, &nc_file_id));
+
+  /* Map name */
+  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "title", strlen(map_name), map_name));
+
+  /* Normalization option */
+  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "normalization", strlen(normalize_opt), normalize_opt));
+
+  /* Map method */
+  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "map_method", strlen(map_method), map_method));
+
+  /* Remap order */
+  if ( map_type == MAP_TYPE_CONSERV && submap_type == SUBMAP_TYPE_NONE )
+    nce(nc_put_att_int(nc_file_id, NC_GLOBAL, "remap_order", NC_INT, 1L, &remap_order));
+
+  /* History */
+  date_and_time_in_sec = time(NULL);
+
+  if ( date_and_time_in_sec != -1 )
+    {
+      date_and_time = localtime(&date_and_time_in_sec);
+      (void) strftime(history, 1024, "%d %b %Y : ", date_and_time);
+      strcat(history, commandLine());
+    }
+
+  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "history", strlen(history), history));
+
+  /* File convention */
+  strcpy(tmp_string, "SCRIP");
+  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "conventions", strlen(tmp_string), tmp_string));
+
+  /* Source and destination grid names */
+  gridName(gridInqType(rg.gridID1), grid1_name);
+  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "source_grid", strlen(grid1_name), grid1_name));
+
+  gridName(gridInqType(rg.gridID2), grid2_name);
+  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "dest_grid", strlen(grid2_name), grid2_name));
+
+  /* Prepare netCDF dimension info */
+
+  /* Define grid size dimensions */
+  nce(nc_def_dim(nc_file_id, "src_grid_size", rg.grid1_size, &nc_srcgrdsize_id));
+  nce(nc_def_dim(nc_file_id, "dst_grid_size", rg.grid2_size, &nc_dstgrdsize_id));
+
+  /* Define grid corner dimension */
+  if ( rg.lneed_grid1_corners )
+    nce(nc_def_dim(nc_file_id, "src_grid_corners", rg.grid1_corners, &nc_srcgrdcorn_id));
+  if ( rg.lneed_grid2_corners )
+    nce(nc_def_dim(nc_file_id, "dst_grid_corners", rg.grid2_corners, &nc_dstgrdcorn_id));
+
+  /* Define grid rank dimension */
+  nce(nc_def_dim(nc_file_id, "src_grid_rank", rg.grid1_rank, &nc_srcgrdrank_id));
+  nce(nc_def_dim(nc_file_id, "dst_grid_rank", rg.grid2_rank, &nc_dstgrdrank_id));
+
+  /* Define map size dimensions */
+  nce(nc_def_dim(nc_file_id, "num_links", rv.num_links, &nc_numlinks_id));
+  nce(nc_def_dim(nc_file_id, "num_wgts", rv.num_wts, &nc_numwgts_id));
+       
+  /* Define grid dimensions */
+  nce(nc_def_var(nc_file_id, "src_grid_dims", NC_INT, 1, &nc_srcgrdrank_id, &nc_srcgrddims_id));
+  nce(nc_def_var(nc_file_id, "dst_grid_dims", NC_INT, 1, &nc_dstgrdrank_id, &nc_dstgrddims_id));
+
+  /* Define all arrays for netCDF descriptors */
+
+  /* Define grid center latitude array */
+  nce(nc_def_var(nc_file_id, "src_grid_center_lat", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdcntrlat_id));
+  nce(nc_def_var(nc_file_id, "dst_grid_center_lat", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdcntrlat_id));
+
+  /* Define grid center longitude array */
+  nce(nc_def_var(nc_file_id, "src_grid_center_lon", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdcntrlon_id));
+  nce(nc_def_var(nc_file_id, "dst_grid_center_lon", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdcntrlon_id));
+
+  /* Define grid corner lat/lon arrays */
+
+  nc_dims2_id[0] = nc_srcgrdsize_id;
+  nc_dims2_id[1] = nc_srcgrdcorn_id;
+
+  if ( rg.lneed_grid1_corners )
+    {
+      nce(nc_def_var(nc_file_id, "src_grid_corner_lat", NC_DOUBLE, 2, nc_dims2_id, &nc_srcgrdcrnrlat_id));
+      nce(nc_def_var(nc_file_id, "src_grid_corner_lon", NC_DOUBLE, 2, nc_dims2_id, &nc_srcgrdcrnrlon_id));
+    }
+
+  nc_dims2_id[0] = nc_dstgrdsize_id;
+  nc_dims2_id[1] = nc_dstgrdcorn_id;
+
+  if ( rg.lneed_grid2_corners )
+    {
+      nce(nc_def_var(nc_file_id, "dst_grid_corner_lat", NC_DOUBLE, 2, nc_dims2_id, &nc_dstgrdcrnrlat_id));
+      nce(nc_def_var(nc_file_id, "dst_grid_corner_lon", NC_DOUBLE, 2, nc_dims2_id, &nc_dstgrdcrnrlon_id));
+    }
+
+  /* Define units for all coordinate arrays */
+  nce(nc_put_att_text(nc_file_id, nc_srcgrdcntrlat_id, "units", strlen(grid1_units), grid1_units));
+  nce(nc_put_att_text(nc_file_id, nc_dstgrdcntrlat_id, "units", strlen(grid2_units), grid2_units));
+  nce(nc_put_att_text(nc_file_id, nc_srcgrdcntrlon_id, "units", strlen(grid1_units), grid1_units));
+  nce(nc_put_att_text(nc_file_id, nc_dstgrdcntrlon_id, "units", strlen(grid2_units), grid2_units));
+  if ( rg.lneed_grid1_corners )
+    {
+      nce(nc_put_att_text(nc_file_id, nc_srcgrdcrnrlat_id, "units", strlen(grid1_units), grid1_units));
+      nce(nc_put_att_text(nc_file_id, nc_srcgrdcrnrlon_id, "units", strlen(grid1_units), grid1_units));
+    }
+  if ( rg.lneed_grid2_corners )
+    {
+      nce(nc_put_att_text(nc_file_id, nc_dstgrdcrnrlat_id, "units", strlen(grid2_units), grid2_units));
+      nce(nc_put_att_text(nc_file_id, nc_dstgrdcrnrlon_id, "units", strlen(grid2_units), grid2_units));
+    }
+
+  /* Define grid mask */
+
+  nce(nc_def_var(nc_file_id, "src_grid_imask", NC_INT, 1, &nc_srcgrdsize_id, &nc_srcgrdimask_id));
+  nce(nc_put_att_text(nc_file_id, nc_srcgrdimask_id, "units", 8, "unitless"));
+
+  nce(nc_def_var(nc_file_id, "dst_grid_imask", NC_INT, 1, &nc_dstgrdsize_id, &nc_dstgrdimask_id));
+  nce(nc_put_att_text(nc_file_id, nc_dstgrdimask_id, "units", 8, "unitless"));
+
+  /* Define grid area arrays */
+
+  if ( lgridarea )
+    {
+      nce(nc_def_var(nc_file_id, "src_grid_area", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdarea_id));
+      nce(nc_put_att_text(nc_file_id, nc_srcgrdarea_id, "units", 14, "square radians"));
+
+      nce(nc_def_var(nc_file_id, "dst_grid_area", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdarea_id));   
+      nce(nc_put_att_text(nc_file_id, nc_dstgrdarea_id, "units", 14, "square radians"));
+    }
+
+  /* Define grid fraction arrays */
+
+  nce(nc_def_var(nc_file_id, "src_grid_frac", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdfrac_id));
+  nce(nc_put_att_text(nc_file_id, nc_srcgrdfrac_id, "units", 8, "unitless"));
+
+  nce(nc_def_var(nc_file_id, "dst_grid_frac", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdfrac_id));
+  nce(nc_put_att_text(nc_file_id, nc_dstgrdfrac_id, "units", 8, "unitless"));
+
+  /* Define mapping arrays */
+
+  nce(nc_def_var(nc_file_id, "src_address", NC_INT, 1, &nc_numlinks_id, &nc_srcadd_id));      
+  nce(nc_def_var(nc_file_id, "dst_address", NC_INT, 1, &nc_numlinks_id, &nc_dstadd_id));
+
+  nc_dims2_id[0] = nc_numlinks_id;
+  nc_dims2_id[1] = nc_numwgts_id;
+
+  nce(nc_def_var(nc_file_id, "remap_matrix", NC_DOUBLE, 2, nc_dims2_id, &nc_rmpmatrix_id));
+
+  /* End definition stage */
+  
+  nce(nc_enddef(nc_file_id));
+
+
+  /* Write mapping data */
+
+  nce(nc_put_var_int(nc_file_id, nc_srcgrddims_id, rg.grid1_dims));
+  nce(nc_put_var_int(nc_file_id, nc_dstgrddims_id, rg.grid2_dims));
+
+  nce(nc_put_var_int(nc_file_id, nc_srcgrdimask_id, rg.grid1_mask));
+  nce(nc_put_var_int(nc_file_id, nc_dstgrdimask_id, rg.grid2_mask));
+
+  nce(nc_put_var_double(nc_file_id, nc_srcgrdcntrlat_id, rg.grid1_center_lat)); 
+  nce(nc_put_var_double(nc_file_id, nc_srcgrdcntrlon_id, rg.grid1_center_lon));
+
+  if ( rg.lneed_grid1_corners )
+    {
+      nce(nc_put_var_double(nc_file_id, nc_srcgrdcrnrlat_id, rg.grid1_corner_lat));
+      nce(nc_put_var_double(nc_file_id, nc_srcgrdcrnrlon_id, rg.grid1_corner_lon));
+    }
+
+  nce(nc_put_var_double(nc_file_id, nc_dstgrdcntrlat_id, rg.grid2_center_lat));
+  nce(nc_put_var_double(nc_file_id, nc_dstgrdcntrlon_id, rg.grid2_center_lon));
+
+  if ( rg.lneed_grid2_corners )
+    {
+      nce(nc_put_var_double(nc_file_id, nc_dstgrdcrnrlat_id, rg.grid2_corner_lat));
+      nce(nc_put_var_double(nc_file_id, nc_dstgrdcrnrlon_id, rg.grid2_corner_lon));
+    }
+  /*
+  if ( luse_grid1_area )
+    nce(nc_put_var_double(nc_file_id, nc_srcgrdarea_id, rg.grid1_area_in));
+  else
+  */
+  if ( lgridarea )
+    nce(nc_put_var_double(nc_file_id, nc_srcgrdarea_id, rg.grid1_area));
+
+  nce(nc_put_var_double(nc_file_id, nc_srcgrdfrac_id, rg.grid1_frac));
+
+  /*
+  if ( luse_grid2_area )
+    nce(nc_put_var_double(nc_file_id, nc_dstgrdarea_id, rg.grid2_area_in));
+  else
+  */
+  if ( lgridarea )
+    nce(nc_put_var_double(nc_file_id, nc_dstgrdarea_id, rg.grid2_area));
+
+  nce(nc_put_var_double(nc_file_id, nc_dstgrdfrac_id, rg.grid2_frac));
+
+  for ( i = 0; i < rv.num_links; i++ )
+    {
+      rv.grid1_add[i]++;
+      rv.grid2_add[i]++;
+    }
+
+  nce(nc_put_var_int(nc_file_id, nc_srcadd_id, rv.grid1_add));
+  nce(nc_put_var_int(nc_file_id, nc_dstadd_id, rv.grid2_add));
+
+  nce(nc_put_var_double(nc_file_id, nc_rmpmatrix_id, rv.wts));
+
+  nce(nc_close(nc_file_id));
+
+#else
+  cdoAbort("netCDF support not compiled in!");
+#endif
+
+}  /* write_remap_scrip */
+
+/*****************************************************************************/
+
+void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, int *map_type, int *submap_type,
+		      int *remap_order, remapgrid_t *rg, remapvars_t *rv)
+{
+  /*
+    The routine reads a netCDF file to extract remapping info in SCRIP format
+  */
+  /*
+    Input variables
+
+    interp_file        ! filename for remap data
+  */
+#if defined(HAVE_LIBNETCDF)
+
+  /* Local variables */
+
+  int lgridarea = FALSE;
+  int status;
+  int nc_file_id;           /* id for netCDF file                       */
+  int nc_srcgrdsize_id;     /* id for source grid size                  */
+  int nc_dstgrdsize_id;     /* id for destination grid size             */
+  int nc_srcgrdcorn_id;     /* id for number of source grid corners     */
+  int nc_dstgrdcorn_id;     /* id for number of dest grid corners       */
+  int nc_srcgrdrank_id;     /* id for source grid rank                  */
+  int nc_dstgrdrank_id;     /* id for dest grid rank                    */
+  int nc_numlinks_id;       /* id for number of links in mapping        */
+  int nc_numwgts_id;        /* id for number of weights for mapping     */
+  int nc_srcgrddims_id;     /* id for source grid dimensions            */
+  int nc_dstgrddims_id;     /* id for dest grid dimensions              */
+  int nc_srcgrdcntrlat_id;  /* id for source grid center latitude       */
+  int nc_dstgrdcntrlat_id;  /* id for dest grid center latitude         */
+  int nc_srcgrdcntrlon_id;  /* id for source grid center longitude      */
+  int nc_dstgrdcntrlon_id;  /* id for dest grid center longitude        */
+  int nc_srcgrdimask_id;    /* id for source grid mask                  */
+  int nc_dstgrdimask_id;    /* id for dest grid mask                    */
+  int nc_srcgrdcrnrlat_id;  /* id for latitude of source grid corners   */
+  int nc_srcgrdcrnrlon_id;  /* id for longitude of source grid corners  */
+  int nc_dstgrdcrnrlat_id;  /* id for latitude of dest grid corners     */
+  int nc_dstgrdcrnrlon_id;  /* id for longitude of dest grid corners    */
+  int nc_srcgrdarea_id;     /* id for area of source grid cells         */
+  int nc_dstgrdarea_id;     /* id for area of dest grid cells           */
+  int nc_srcgrdfrac_id;     /* id for area fraction on source grid      */
+  int nc_dstgrdfrac_id;     /* id for area fraction on dest grid        */
+  int nc_srcadd_id;         /* id for map source address                */
+  int nc_dstadd_id;         /* id for map destination address           */
+  int nc_rmpmatrix_id;      /* id for remapping matrix                  */
+
+  long i;                   /* dummy index */
+
+  char map_name[1024];
+  char map_method[64];      /* character string for map_type             */
+  char normalize_opt[64];   /* character string for normalization option */
+  char convention[64];      /* character string for output convention    */
+  char grid1_name[64];      /* grid name for source grid                 */
+  char grid2_name[64];      /* grid name for dest   grid                 */
+  char grid1_units[64];
+  char grid2_units[64];
+  size_t attlen, dimlen;
+
+  int gridID1_gme_c = -1;
+
+
+  /* Open file and read some global information */
+
+  /* nce(nc_open(interp_file, NC_NOWRITE, &nc_file_id)); */
+  nc_file_id = cdf_openread(interp_file);
+
+  /* Map name */
+
+  nce(nc_get_att_text(nc_file_id, NC_GLOBAL, "title", map_name));
+  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "title", &attlen));
+  map_name[attlen] = 0;
+
+  if ( cdoVerbose )
+    {
+      cdoPrint("Reading remapping: %s", map_name);
+      cdoPrint("From file: %s", interp_file);
+    }
+
+  /* Normalization option */
+
+  nce(nc_get_att_text(nc_file_id, NC_GLOBAL, "normalization", normalize_opt));
+  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "normalization", &attlen));
+  normalize_opt[attlen] = 0;
+
+  if ( strcmp(normalize_opt, "none") == 0 )
+    rv->norm_opt = NORM_OPT_NONE;
+  else if ( strcmp(normalize_opt, "fracarea") == 0 )
+    rv->norm_opt = NORM_OPT_FRACAREA;
+  else if ( strcmp(normalize_opt, "destarea") == 0 )
+    rv->norm_opt = NORM_OPT_DESTAREA;
+  else
+    {
+      cdoPrint("normalize_opt = %s", normalize_opt);
+      cdoAbort("Invalid normalization option");
+    }
+
+  if ( cdoVerbose )
+    cdoPrint("normalize_opt = %s", normalize_opt);
+
+  /* Map method */
+
+  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "map_method", map_method));
+  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "map_method", &attlen));
+  map_method[attlen] = 0;
+
+  *submap_type = SUBMAP_TYPE_NONE;
+  *remap_order = 1;
+
+  if ( memcmp(map_method, "Conservative", 12) == 0 )
+    {
+      int iatt;
+      rv->map_type = MAP_TYPE_CONSERV;
+      status = nc_get_att_int(nc_file_id, NC_GLOBAL, "remap_order", &iatt);
+      if ( status == NC_NOERR ) *remap_order = iatt;
+    }
+  else if ( memcmp(map_method, "Bilinear", 8) == 0 ) rv->map_type = MAP_TYPE_BILINEAR;
+  else if ( memcmp(map_method, "Bicubic",  7) == 0 ) rv->map_type = MAP_TYPE_BICUBIC;
+  else if ( memcmp(map_method, "Distance", 8) == 0 ) rv->map_type = MAP_TYPE_DISTWGT;
+  else if ( memcmp(map_method, "Nearest",  7) == 0 ) rv->map_type = MAP_TYPE_DISTWGT1;
+  else if ( memcmp(map_method, "Largest",  7) == 0 )
+    {
+      rv->map_type = MAP_TYPE_CONSERV;
+      *submap_type = SUBMAP_TYPE_LAF;
+    }
+  else
+    {
+      cdoPrint("map_type = %s", map_method);
+      cdoAbort("Invalid Map Type");
+    }
+
+  if ( cdoVerbose )
+    cdoPrint("map_type = %s", map_method);
+
+  if ( rv->map_type == MAP_TYPE_CONSERV ) lgridarea = TRUE;
+
+  *map_type = rv->map_type;
+
+  /* File convention */
+
+  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "conventions", convention));
+  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "conventions", &attlen));
+  convention[attlen] = 0;
+
+  if ( strcmp(convention, "SCRIP") != 0 )
+    {
+      cdoPrint("convention = %s", convention);
+      if ( strcmp(convention, "NCAR-CSM") == 0 )
+        cdoAbort("Unsupported file convention!");
+      else
+        cdoAbort("Unknown file convention!");
+    }
+
+  /* Read some additional global attributes */
+
+  /* Source and destination grid names */
+
+  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "source_grid", grid1_name));
+  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "source_grid", &attlen));
+  grid1_name[attlen] = 0;
+  
+  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "dest_grid", grid2_name));
+  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "dest_grid", &attlen));
+  grid2_name[attlen] = 0;
+ 
+  if ( cdoVerbose )
+    cdoPrint("Remapping between: %s and %s", grid1_name, grid2_name);
+
+  /* Read dimension information */
+
+  nce(nc_inq_dimid(nc_file_id, "src_grid_size", &nc_srcgrdsize_id));
+  nce(nc_inq_dimlen(nc_file_id, nc_srcgrdsize_id, &dimlen));
+  rg->grid1_size = dimlen;
+  /*
+  if (  rg->grid1_size != gridInqSize(gridID1) )
+    cdoAbort("Source grids have different size!");
+  */
+  nce(nc_inq_dimid(nc_file_id, "dst_grid_size", &nc_dstgrdsize_id));
+  nce(nc_inq_dimlen(nc_file_id, nc_dstgrdsize_id, &dimlen));
+  rg->grid2_size = dimlen;
+  /*
+  if ( rg->grid2_size != gridInqSize(gridID2) )
+    cdoAbort("Target grids have different size!");
+  */
+  rg->grid1_corners = 0;
+  rg->luse_grid1_corners = FALSE;
+  rg->lneed_grid1_corners = FALSE;
+  status = nc_inq_dimid(nc_file_id, "src_grid_corners", &nc_srcgrdcorn_id);
+  if ( status == NC_NOERR )
+    {
+      nce(nc_inq_dimlen(nc_file_id, nc_srcgrdcorn_id, &dimlen));
+      rg->grid1_corners = dimlen;
+      rg->luse_grid1_corners = TRUE;
+      rg->lneed_grid1_corners = TRUE;
+    }
+
+  rg->grid2_corners = 0;
+  rg->luse_grid2_corners = FALSE;
+  rg->lneed_grid2_corners = FALSE;
+  status = nc_inq_dimid(nc_file_id, "dst_grid_corners", &nc_dstgrdcorn_id);
+  if ( status == NC_NOERR )
+    {
+      nce(nc_inq_dimlen(nc_file_id, nc_dstgrdcorn_id, &dimlen));
+      rg->grid2_corners = dimlen;
+      rg->luse_grid2_corners = TRUE;
+      rg->lneed_grid2_corners = TRUE;
+    }
+
+  nce(nc_inq_dimid(nc_file_id, "src_grid_rank", &nc_srcgrdrank_id));
+  nce(nc_inq_dimlen(nc_file_id, nc_srcgrdrank_id, &dimlen));
+  rg->grid1_rank = dimlen;
+
+  nce(nc_inq_dimid(nc_file_id, "dst_grid_rank", &nc_dstgrdrank_id));
+  nce(nc_inq_dimlen(nc_file_id, nc_dstgrdrank_id, &dimlen));
+  rg->grid2_rank = dimlen;
+
+  nce(nc_inq_dimid(nc_file_id, "num_links", &nc_numlinks_id));
+  nce(nc_inq_dimlen(nc_file_id, nc_numlinks_id, &dimlen));
+  rv->num_links = dimlen;
+
+  nce(nc_inq_dimid(nc_file_id, "num_wgts", &nc_numwgts_id));
+  nce(nc_inq_dimlen(nc_file_id, nc_numwgts_id, &dimlen));
+  rv->num_wts = dimlen;
+
+  rg->gridID1 = gridID1;
+  rg->gridID2 = gridID2;
+
+  /* Initialize all pointer */
+  rg->pinit = FALSE;
+  remapGridInitPointer(rg);
+
+  if ( gridInqType(gridID1) == GRID_GME )
+    {
+      rg->grid1_nvgp = gridInqSize(gridID1);
+      gridID1_gme_c = gridToUnstructured(gridID1, 1);
+    }
+
+  remapGridRealloc(rv->map_type, rg);
+
+  if ( gridInqType(gridID1) == GRID_GME ) gridInqMaskGME(gridID1_gme_c, rg->grid1_vgpm);    
+
+  rv->pinit = TRUE;
+  rv->wts = NULL;
+
+  rv->max_links = rv->num_links;
+
+  rv->resize_increment = (int) (0.1 * MAX(rg->grid1_size, rg->grid2_size));
+
+  /* Allocate address and weight arrays for mapping 1 */
+
+  rv->grid1_add = (int *) malloc(rv->num_links*sizeof(int));
+  rv->grid2_add = (int *) malloc(rv->num_links*sizeof(int));
+
+  rv->wts = (double *) malloc(rv->num_wts*rv->num_links*sizeof(double));
+
+  /* Get variable ids */
+
+  nce(nc_inq_varid(nc_file_id, "src_grid_dims", &nc_srcgrddims_id));
+  nce(nc_inq_varid(nc_file_id, "src_grid_imask", &nc_srcgrdimask_id));
+  nce(nc_inq_varid(nc_file_id, "src_grid_center_lat", &nc_srcgrdcntrlat_id));
+  nce(nc_inq_varid(nc_file_id, "src_grid_center_lon", &nc_srcgrdcntrlon_id));
+  if ( rg->grid1_corners )
+    {
+      nce(nc_inq_varid(nc_file_id, "src_grid_corner_lat", &nc_srcgrdcrnrlat_id));
+      nce(nc_inq_varid(nc_file_id, "src_grid_corner_lon", &nc_srcgrdcrnrlon_id));
+    }
+  if ( lgridarea )
+    {
+      nce(nc_inq_varid(nc_file_id, "src_grid_area", &nc_srcgrdarea_id));
+    }
+  nce(nc_inq_varid(nc_file_id, "src_grid_frac", &nc_srcgrdfrac_id));
+
+  nce(nc_inq_varid(nc_file_id, "dst_grid_dims", &nc_dstgrddims_id));
+  nce(nc_inq_varid(nc_file_id, "dst_grid_imask", &nc_dstgrdimask_id));
+  nce(nc_inq_varid(nc_file_id, "dst_grid_center_lat", &nc_dstgrdcntrlat_id));
+  nce(nc_inq_varid(nc_file_id, "dst_grid_center_lon", &nc_dstgrdcntrlon_id));
+  if ( rg->grid2_corners )
+    {
+      nce(nc_inq_varid(nc_file_id, "dst_grid_corner_lat", &nc_dstgrdcrnrlat_id));
+      nce(nc_inq_varid(nc_file_id, "dst_grid_corner_lon", &nc_dstgrdcrnrlon_id));
+    }
+  if ( lgridarea )
+    {
+      nce(nc_inq_varid(nc_file_id, "dst_grid_area", &nc_dstgrdarea_id));
+    }
+  nce(nc_inq_varid(nc_file_id, "dst_grid_frac", &nc_dstgrdfrac_id));
+
+  nce(nc_inq_varid(nc_file_id, "src_address", &nc_srcadd_id));
+  nce(nc_inq_varid(nc_file_id, "dst_address", &nc_dstadd_id));
+  nce(nc_inq_varid(nc_file_id, "remap_matrix", &nc_rmpmatrix_id));
+
+  /* Read all variables */
+
+  nce(nc_get_var_int(nc_file_id, nc_srcgrddims_id, rg->grid1_dims));
+
+  nce(nc_get_var_int(nc_file_id, nc_srcgrdimask_id, rg->grid1_mask));
+
+  nce(nc_get_var_double(nc_file_id, nc_srcgrdcntrlat_id, rg->grid1_center_lat));
+  nce(nc_get_var_double(nc_file_id, nc_srcgrdcntrlon_id, rg->grid1_center_lon));
+
+  nce(nc_get_att_text(nc_file_id, nc_srcgrdcntrlat_id, "units", grid1_units));
+  nce(nc_inq_attlen(nc_file_id, nc_srcgrdcntrlat_id, "units", &attlen));
+  grid1_units[attlen] = 0;
+
+  grid_to_radian(grid1_units, rg->grid1_size, rg->grid1_center_lon, "grid1 center lon"); 
+  grid_to_radian(grid1_units, rg->grid1_size, rg->grid1_center_lat, "grid1 center lat"); 
+
+  if ( rg->grid1_corners )
+    {
+      nce(nc_get_var_double(nc_file_id, nc_srcgrdcrnrlat_id, rg->grid1_corner_lat));
+      nce(nc_get_var_double(nc_file_id, nc_srcgrdcrnrlon_id, rg->grid1_corner_lon));
+
+      nce(nc_get_att_text(nc_file_id, nc_srcgrdcrnrlat_id, "units", grid1_units));
+      nce(nc_inq_attlen(nc_file_id, nc_srcgrdcrnrlat_id, "units", &attlen));
+      grid1_units[attlen] = 0;
+
+      grid_to_radian(grid1_units, rg->grid1_corners*rg->grid1_size, rg->grid1_corner_lon, "grid1 corner lon"); 
+      grid_to_radian(grid1_units, rg->grid1_corners*rg->grid1_size, rg->grid1_corner_lat, "grid1 corner lat"); 
+    }
+
+  if ( lgridarea )
+    nce(nc_get_var_double(nc_file_id, nc_srcgrdarea_id, rg->grid1_area));
+
+  nce(nc_get_var_double(nc_file_id, nc_srcgrdfrac_id, rg->grid1_frac));
+
+  nce(nc_get_var_int(nc_file_id, nc_dstgrddims_id, rg->grid2_dims));
+
+  nce(nc_get_var_int(nc_file_id, nc_dstgrdimask_id, rg->grid2_mask));
+
+  nce(nc_get_var_double(nc_file_id, nc_dstgrdcntrlat_id, rg->grid2_center_lat));
+  nce(nc_get_var_double(nc_file_id, nc_dstgrdcntrlon_id, rg->grid2_center_lon));
+
+  nce(nc_get_att_text(nc_file_id, nc_dstgrdcntrlat_id, "units", grid2_units));
+  nce(nc_inq_attlen(nc_file_id, nc_dstgrdcntrlat_id, "units", &attlen));
+  grid2_units[attlen] = 0;
+
+  grid_to_radian(grid2_units, rg->grid2_size, rg->grid2_center_lon, "grid2 center lon"); 
+  grid_to_radian(grid2_units, rg->grid2_size, rg->grid2_center_lat, "grid2 center lat"); 
+
+  if ( rg->grid2_corners )
+    {
+      nce(nc_get_var_double(nc_file_id, nc_dstgrdcrnrlat_id, rg->grid2_corner_lat));
+      nce(nc_get_var_double(nc_file_id, nc_dstgrdcrnrlon_id, rg->grid2_corner_lon));
+
+      nce(nc_get_att_text(nc_file_id, nc_dstgrdcrnrlat_id, "units", grid2_units));
+      nce(nc_inq_attlen(nc_file_id, nc_dstgrdcrnrlat_id, "units", &attlen));
+      grid2_units[attlen] = 0;
+      
+      grid_to_radian(grid2_units, rg->grid2_corners*rg->grid2_size, rg->grid2_corner_lon, "grid2 corner lon"); 
+      grid_to_radian(grid2_units, rg->grid2_corners*rg->grid2_size, rg->grid2_corner_lat, "grid2 corner lat"); 
+    }
+
+  if ( lgridarea )
+    nce(nc_get_var_double(nc_file_id, nc_dstgrdarea_id, rg->grid2_area));
+
+  nce(nc_get_var_double(nc_file_id, nc_dstgrdfrac_id, rg->grid2_frac));
+
+  nce(nc_get_var_int(nc_file_id, nc_srcadd_id, rv->grid1_add));
+  nce(nc_get_var_int(nc_file_id, nc_dstadd_id, rv->grid2_add));
+
+  for ( i = 0; i < rv->num_links; i++ )
+    {
+      rv->grid1_add[i]--;
+      rv->grid2_add[i]--;
+    }
+
+  nce(nc_get_var_double(nc_file_id, nc_rmpmatrix_id, rv->wts));
+
+  /* Close input file */
+
+  nce(nc_close(nc_file_id));
+
+#else
+  cdoAbort("netCDF support not compiled in!");
+#endif
+
+  rv->links.option    = FALSE;
+  rv->links.max_links = 0;
+  rv->links.num_blks  = 0;
+  rv->links.num_links = NULL;
+  rv->links.src_add   = NULL;
+  rv->links.dst_add   = NULL;
+  rv->links.w_index   = NULL;
+}  /* read_remap_scrip */
diff --git a/src/remaplib.c b/src/remaplib.c
index 21c0fd5..702b864 100644
--- a/src/remaplib.c
+++ b/src/remaplib.c
@@ -45,7 +45,7 @@
  */
 
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -430,7 +430,7 @@ void boundbox_from_corners(long size, long nc, const double *restrict corner_lon
   long i4, inc, i, j;
   restr_t clon, clat;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none)        \
   shared(bound_box, corner_lat, corner_lon, nc, size)	\
   private(i4, inc, i, j, clon, clat)
@@ -465,7 +465,7 @@ void boundbox_from_center(int lonIsCyclic, long size, long nx, long ny, const do
   long n_add, e_add, ne_add;
   restr_t tmp_lats[4], tmp_lons[4];  /* temps for computing bounding boxes */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none)        \
   shared(lonIsCyclic, size, nx, ny, center_lon, center_lat, bound_box)	\
   private(n4, i, j, k, n, ip1, jp1, n_add, e_add, ne_add, tmp_lats, tmp_lons)
@@ -535,7 +535,7 @@ void check_lon_range(long nlons, double *lons)
 {
   long n;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) shared(nlons, lons)
 #endif
   for ( n = 0; n < nlons; ++n )
@@ -550,7 +550,7 @@ void check_lat_range(long nlats, double *lats)
 {
   long n;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) shared(nlats, lats)
 #endif
   for ( n = 0; n < nlats; ++n )
@@ -565,7 +565,7 @@ void check_lon_boundbox_range(long nlons, restr_t *bound_box)
 {
   long n, n4;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) shared(nlons, bound_box) private(n4)
 #endif
   for ( n = 0; n < nlons; ++n )
@@ -584,7 +584,7 @@ void check_lat_boundbox_range(long nlats, restr_t *restrict bound_box, double *r
 {
   long n, n4;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) shared(nlats, bound_box, lats) private(n4)
 #endif
   for ( n = 0; n < nlats; ++n )
@@ -654,7 +654,7 @@ int expand_curvilinear_grid(int gridID)
   int gridIDnew;
   long gridsize, gridsize_new;
   long nx, ny, nxp4, nyp4;
-  long i,j;
+  long i, j;
   double *xvals, *yvals;
 
   gridsize = gridInqSize(gridID);
@@ -773,7 +773,7 @@ void calc_lat_bins(remapgrid_t *rg, int map_type)
       rg->bin_addr1[n2+1] = 0;
     }
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   private(n, n2, nele4)		       \
   shared(grid1_size, nbins, rg)
@@ -787,7 +787,7 @@ void calc_lat_bins(remapgrid_t *rg, int map_type)
 	  if ( rg->grid1_bound_box[nele4  ] <= rg->bin_lats[n2+1] &&
 	       rg->grid1_bound_box[nele4+1] >= rg->bin_lats[n2  ] )
 	    {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	      {
@@ -808,7 +808,7 @@ void calc_lat_bins(remapgrid_t *rg, int map_type)
 	  rg->bin_addr2[n2+1] = 0;
 	}
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   private(n, n2, nele4)		       \
   shared(grid2_size, nbins, rg)
@@ -822,7 +822,7 @@ void calc_lat_bins(remapgrid_t *rg, int map_type)
 	      if ( rg->grid2_bound_box[nele4  ] <= rg->bin_lats[n2+1] &&
 		   rg->grid2_bound_box[nele4+1] >= rg->bin_lats[n2  ] )
 		{
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 		  {
@@ -987,16 +987,28 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem
       rg->gridID1 = gridID1 = expand_lonlat_grid(gridID1);
     }
 
-  if ( gridInqType(rg->gridID1) == GRID_REFERENCE )
+  if ( gridInqType(gridID1) == GRID_UNSTRUCTURED )
     {
-      rg->gridID1 = gridID1 = referenceToGrid(gridID1);
-      if ( gridID1 == -1 ) cdoAbort("grid1 reference not found!");
+      if ( gridInqYvals(gridID1, NULL) == 0 || gridInqXvals(gridID1, NULL) == 0 )
+	{
+	  if ( gridInqNumber(gridID1) > 0 )
+	    {
+	      rg->gridID1 = gridID1 = referenceToGrid(gridID1);
+	      if ( gridID1 == -1 ) cdoAbort("Reference to source grid not found!");
+	    }
+	}
     }
 
-  if ( gridInqType(rg->gridID2) == GRID_REFERENCE )
+  if ( gridInqType(gridID2) == GRID_UNSTRUCTURED )
     {
-      rg->gridID2 = gridID2 = referenceToGrid(gridID2);
-      if ( gridID2 == -1 ) cdoAbort("grid2 reference not found!");
+      if ( gridInqYvals(gridID2, NULL) == 0 || gridInqXvals(gridID2, NULL) == 0 )
+	{
+	  if ( gridInqNumber(gridID2) > 0 )
+	    {
+	      rg->gridID2 = gridID2 = referenceToGrid(gridID2);
+	      if ( gridID2 == -1 ) cdoAbort("Reference to target grid not found!");
+	    }
+	}
     }
 
   if ( gridInqSize(rg->gridID1) > 1 && 
@@ -1118,7 +1130,7 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem
 
   /* Initialize logical mask */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) shared(grid1_size, rg)
 #endif
   for ( i = 0; i < grid1_size; ++i ) rg->grid1_mask[i] = TRUE;
@@ -1181,7 +1193,7 @@ void remapGridInit(int map_type, int lextrapolate, int gridID1, int gridID2, rem
     }
   else
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) shared(grid2_size, rg)
 #endif
       for ( i = 0; i < grid2_size; ++i ) rg->grid2_mask[i] = TRUE;
@@ -1378,8 +1390,7 @@ void remapVarsInit(int map_type, remapgrid_t *rg, remapvars_t *rv)
 /*****************************************************************************/
 
 /*
-   This routine resizes remapping arrays by increasing(decreasing)
-   the max_links by increment
+   This routine resizes remapping arrays by increasing(decreasing) the max_links by increment
 */
 void resize_remap_vars(remapvars_t *rv, int increment)
 {
@@ -1585,7 +1596,7 @@ void remap_laf(double *restrict dst_array, double missval, long dst_size, long n
   double wts;
   double *src_cls;
   double *src_wts;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   double **src_cls2;
   double **src_wts2;
   int ompthID;
@@ -1597,7 +1608,7 @@ void remap_laf(double *restrict dst_array, double missval, long dst_size, long n
 
   max_cls = get_max_add(num_links, dst_size, dst_add);
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   src_cls2 = (double **) malloc(ompNumThreads*sizeof(double *));
   src_wts2 = (double **) malloc(ompNumThreads*sizeof(double *));
   for ( i = 0; i < ompNumThreads; ++i )
@@ -1613,7 +1624,7 @@ void remap_laf(double *restrict dst_array, double missval, long dst_size, long n
   for ( n = 0; n < num_links; ++n )
     if ( DBL_IS_EQUAL(dst_array[dst_add[n]], missval) ) dst_array[dst_add[n]] = ZERO;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(dst_size, src_cls2, src_wts2, num_links, dst_add, src_add, src_array, map_wts, \
 	 num_wts, dst_array, max_cls)					\
@@ -1622,7 +1633,7 @@ void remap_laf(double *restrict dst_array, double missval, long dst_size, long n
 #endif
   for ( i = 0; i < dst_size; ++i )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       ompthID = omp_get_thread_num();
       src_cls = src_cls2[ompthID];
       src_wts = src_wts2[ompthID];
@@ -1702,7 +1713,7 @@ void remap_laf(double *restrict dst_array, double missval, long dst_size, long n
 	}
     }
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   for ( i = 0; i < ompNumThreads; ++i )
     {
       free(src_cls2[i]);
@@ -1769,7 +1780,7 @@ void remap_sum(double *restrict dst_array, double missval, long dst_size, long n
 
 #define  DEFAULT_MAX_ITER  100
 
-static long    Max_Iter = DEFAULT_MAX_ITER;  /* Max iteration count for i,j iteration */
+static long    Max_Iter = DEFAULT_MAX_ITER;  /* Max iteration count for i, j iteration */
 static double  converge = 1.e-10;            /* Convergence criterion */
 
 void remap_set_max_iter(long max_iter)
@@ -2047,42 +2058,41 @@ void store_link_bilin(remapvars_t *rv, int dst_add, const int *restrict src_add,
     int src_add[4]    ! addresses on source grid
     double weights[4] ! array of remapping weights for these links
   */
-  long n;             /* dummy index */
-  long num_links_old; /* placeholder for old link number */
+  long n;
+  long nlink;
 
   /*
      Increment number of links and check to see if remap arrays need
-     to be increased to accomodate the new link.  Then store the link.
+     to be increased to accomodate the new link. Then store the link.
   */
-  num_links_old = rv->num_links;
-  rv->num_links = num_links_old + 4;
+  nlink = rv->num_links;
+  rv->num_links += 4;
 
   if ( rv->num_links >= rv->max_links ) 
     resize_remap_vars(rv, rv->resize_increment);
 
   for ( n = 0; n < 4; ++n )
     {
-      rv->grid1_add[num_links_old+n] = src_add[n];
-      rv->grid2_add[num_links_old+n] = dst_add;
-      rv->wts      [num_links_old+n] = weights[n];
+      rv->grid1_add[nlink+n] = src_add[n];
+      rv->grid2_add[nlink+n] = dst_add;
+      rv->wts      [nlink+n] = weights[n];
     }
 
 } /* store_link_bilin */
 
 static
-long find_ij_weights(double plon, double plat, double *restrict src_lats, double *restrict src_lons,
-		     double *ig, double *jg)
+long find_ij_weights(double plon, double plat, double *restrict src_lats, double *restrict src_lons, double *ig, double *jg)
 {
   long iter;                     /*  iteration counters   */
   double iguess, jguess;         /*  current guess for bilinear coordinate  */
-  double deli, delj;             /*  corrections to i,j                     */
+  double deli, delj;             /*  corrections to iw,jw                   */
   double dth1, dth2, dth3;       /*  some latitude  differences             */
   double dph1, dph2, dph3;       /*  some longitude differences             */
   double dthp, dphp;             /*  difference between point and sw corner */
   double mat1, mat2, mat3, mat4; /*  matrix elements                        */
   double determinant;            /*  matrix determinant                     */
 
-  /* Iterate to find i,j for bilinear approximation  */
+  /* Iterate to find iw,jw for bilinear approximation  */
 
   dth1 = src_lats[1] - src_lats[0];
   dth2 = src_lats[3] - src_lats[0];
@@ -2160,8 +2170,6 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv)
   double wgts[4];                /*  bilinear weights for four corners      */
 
   double plat, plon;             /*  lat/lon coords of destination point    */
-  double iguess, jguess;         /*  current guess for bilinear coordinate  */
-  double sum_wgts;               /*  sum of weights for normalization       */
   double findex = 0;
 
   if ( cdoTimer ) timer_start(timer_remap_bil);
@@ -2177,21 +2185,20 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv)
 
   /* Loop over destination grid */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, cdoTimer, cdoVerbose, grid2_size, rg, rv, Max_Iter, converge, lwarn, findex) \
-  private(dst_add, n, icount, iter, src_add, src_lats, src_lons, \
-	  wgts, plat, plon, iguess, jguess, sum_wgts, search_result)					\
+  private(dst_add, n, icount, iter, src_add, src_lats, src_lons, wgts, plat, plon, search_result)    \
   schedule(dynamic,1)
 #endif
   /* grid_loop1 */
   for ( dst_add = 0; dst_add < grid2_size; ++dst_add )
     {
       int lprogress = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       if ( omp_get_thread_num() != 0 ) lprogress = 0;
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       findex++;
@@ -2217,23 +2224,25 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv)
 	    if ( ! rg->grid1_mask[src_add[n]] ) search_result = 0;
 	}
 
-      /* If point found, find local i,j coordinates for weights  */
+      /* If point found, find local iw,jw coordinates for weights  */
       if ( search_result > 0 )
 	{
+	  double iw, jw;  /*  current guess for bilinear coordinate  */
+
           rg->grid2_frac[dst_add] = ONE;
 
-	  iter = find_ij_weights(plon, plat, src_lats, src_lons, &iguess, &jguess);
+	  iter = find_ij_weights(plon, plat, src_lats, src_lons, &iw, &jw);
 
           if ( iter < Max_Iter )
 	    {
-	      /* Successfully found i,j - compute weights */
+	      /* Successfully found iw,jw - compute weights */
 
-	      wgts[0] = (ONE-iguess)*(ONE-jguess);
-	      wgts[1] = iguess*(ONE-jguess);
-	      wgts[2] = iguess*jguess;
-	      wgts[3] = (ONE-iguess)*jguess;
+	      wgts[0] = (ONE-iw) * (ONE-jw);
+	      wgts[1] =      iw  * (ONE-jw);
+	      wgts[2] =      iw  *      jw;
+	      wgts[3] = (ONE-iw) *      jw;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	      store_link_bilin(rv, dst_add, src_add, wgts);
@@ -2252,14 +2261,14 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv)
 		  cdoPrint("Src grid lons: %g %g %g %g",
 			   rg->grid1_center_lon[src_add[0]], rg->grid1_center_lon[src_add[1]],
 			   rg->grid1_center_lon[src_add[2]], rg->grid1_center_lon[src_add[3]]);
-		  cdoPrint("Current i,j : %g %g", iguess, jguess);
+		  cdoPrint("Current iw,jw : %g %g", iw, jw);
 		}
 
 	      if ( cdoVerbose || lwarn )
 		{
 		  lwarn = FALSE;
-		  //  cdoWarning("Iteration for i,j exceed max iteration count of %d!", Max_Iter);
-		  cdoWarning("Bilinear interpolation failed for some grid points - use a distance-weighted average instead!");
+		  //  cdoWarning("Iteration for iw,jw exceed max iteration count of %d!", Max_Iter);
+		  cdoWarning("Bilinear interpolation failed for some grid points - used a distance-weighted average instead!");
 		}
 
 	      search_result = -1;
@@ -2283,14 +2292,14 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv)
           if ( icount > 0 )
 	    {
 	      /* Renormalize weights */
-	      sum_wgts = 0.0;
+	      double sum_wgts = 0.0; /* sum of weights for normalization */
 	      /* 2012-05-08 Uwe Schulzweida: using absolute value of src_lats (bug fix) */
 	      for ( n = 0; n < 4; ++n ) sum_wgts += fabs(src_lats[n]);
 	      for ( n = 0; n < 4; ++n ) wgts[n] = fabs(src_lats[n])/sum_wgts;
 
 	      rg->grid2_frac[dst_add] = ONE;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	      store_link_bilin(rv, dst_add, src_add, wgts);
@@ -2309,9 +2318,8 @@ void remap_bilin(remapgrid_t *rg, remapvars_t *rv)
 /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
 
 /*
-  This routine stores the address and weight for four links 
-  associated with one destination point in the appropriate address 
-  and weight arrays and resizes those arrays if necessary.
+  This routine stores the address and weight for four links associated with one destination 
+  point in the appropriate address and weight arrays and resizes those arrays if necessary.
 */
 static
 void store_link_bicub(remapvars_t *rv, int dst_add, const int *restrict src_add, double weights[4][4])
@@ -2322,25 +2330,25 @@ void store_link_bicub(remapvars_t *rv, int dst_add, const int *restrict src_add,
     int src_add[4]       ! addresses on source grid
     double weights[4][4] ! array of remapping weights for these links
   */
-  long n, k;          /* dummy index */
-  long num_links_old; /* placeholder for old link number */
+  long n, k;
+  long nlink;
 
   /*
      Increment number of links and check to see if remap arrays need
-     to be increased to accomodate the new link.  then store the link.
+     to be increased to accomodate the new link. Then store the link.
   */
-  num_links_old = rv->num_links;
-  rv->num_links = num_links_old + 4;
+  nlink = rv->num_links;
+  rv->num_links += 4;
 
   if ( rv->num_links >= rv->max_links ) 
     resize_remap_vars(rv, rv->resize_increment);
 
   for ( n = 0; n < 4; ++n )
     {
-      rv->grid1_add[num_links_old+n] = src_add[n];
-      rv->grid2_add[num_links_old+n] = dst_add;
+      rv->grid1_add[nlink+n] = src_add[n];
+      rv->grid2_add[nlink+n] = dst_add;
       for ( k = 0; k < 4; ++k )
-	rv->wts[4*(num_links_old+n)+k] = weights[k][n];
+	rv->wts[4*(nlink+n)+k] = weights[k][n];
     }
 
 } /* store_link_bicub */
@@ -2369,8 +2377,6 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv)
   double wgts[4][4];  /*  bicubic weights for four corners    */
 
   double plat, plon;             /*  lat/lon coords of destination point    */
-  double iguess, jguess;         /*  current guess for bilinear coordinate  */
-  double sum_wgts;               /*  sum of weights for normalization       */
   double findex = 0;
 
   progressInit();
@@ -2382,20 +2388,20 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv)
 
   /* Loop over destination grid */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, cdoTimer, cdoVerbose, rg, rv, Max_Iter, converge, lwarn, findex) \
-  private(dst_add, n, icount, iter, src_add, src_lats, src_lons, wgts, plat, plon, iguess, jguess, sum_wgts, search_result)					\
+  private(dst_add, n, icount, iter, src_add, src_lats, src_lons, wgts, plat, plon, search_result) \
   schedule(dynamic,1)
 #endif
   /* grid_loop1 */
   for ( dst_add = 0; dst_add < rg->grid2_size; ++dst_add )
     {
       int lprogress = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       if ( omp_get_thread_num() != 0 ) lprogress = 0;
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       findex++;
@@ -2419,51 +2425,37 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv)
 	    if ( ! rg->grid1_mask[src_add[n]] ) search_result = 0;
 	}
 
-      /* If point found, find local i,j coordinates for weights  */
+      /* If point found, find local iw,jw coordinates for weights  */
       if ( search_result > 0 )
 	{
+	  double iw, jw;  /*  current guess for bilinear coordinate  */
+
           rg->grid2_frac[dst_add] = ONE;
 
-	  iter = find_ij_weights(plon, plat, src_lats, src_lons, &iguess, &jguess);
+	  iter = find_ij_weights(plon, plat, src_lats, src_lons, &iw, &jw);
 
           if ( iter < Max_Iter )
 	    {
-	      /* Successfully found i,j - compute weights */
-
-	      wgts[0][0] = (ONE - jguess*jguess*(THREE-TWO*jguess))*
-		           (ONE - iguess*iguess*(THREE-TWO*iguess));
-	      wgts[0][1] = (ONE - jguess*jguess*(THREE-TWO*jguess))*
-                                  iguess*iguess*(THREE-TWO*iguess);
-	      wgts[0][2] =        jguess*jguess*(THREE-TWO*jguess)*
-                                  iguess*iguess*(THREE-TWO*iguess);
-	      wgts[0][3] =        jguess*jguess*(THREE-TWO*jguess)*
-                           (ONE - iguess*iguess*(THREE-TWO*iguess));
-	      wgts[1][0] = (ONE - jguess*jguess*(THREE-TWO*jguess))*
-                                  iguess*(iguess-ONE)*(iguess-ONE);
-	      wgts[1][1] = (ONE - jguess*jguess*(THREE-TWO*jguess))*
-                                  iguess*iguess*(iguess-ONE);
-	      wgts[1][2] =        jguess*jguess*(THREE-TWO*jguess)*
-                                  iguess*iguess*(iguess-ONE);
-	      wgts[1][3] =        jguess*jguess*(THREE-TWO*jguess)*
-                                  iguess*(iguess-ONE)*(iguess-ONE);
-	      wgts[2][0] =        jguess*(jguess-ONE)*(jguess-ONE)*
-                           (ONE - iguess*iguess*(THREE-TWO*iguess));
-	      wgts[2][1] =        jguess*(jguess-ONE)*(jguess-ONE)*
-                                  iguess*iguess*(THREE-TWO*iguess);
-	      wgts[2][2] =        jguess*jguess*(jguess-ONE)*
-                                  iguess*iguess*(THREE-TWO*iguess);
-	      wgts[2][3] =        jguess*jguess*(jguess-ONE)*
-                           (ONE - iguess*iguess*(THREE-TWO*iguess));
-	      wgts[3][0] =        iguess*(iguess-ONE)*(iguess-ONE)*
-                                  jguess*(jguess-ONE)*(jguess-ONE);
-              wgts[3][1] =        iguess*iguess*(iguess-ONE)*
-                                  jguess*(jguess-ONE)*(jguess-ONE);
-	      wgts[3][2] =        iguess*iguess*(iguess-ONE)*
-                                  jguess*jguess*(jguess-ONE);
-	      wgts[3][3] =        iguess*(iguess-ONE)*(iguess-ONE)*
-                                  jguess*jguess*(jguess-ONE);
-
-#if defined (_OPENMP)
+	      /* Successfully found iw,jw - compute weights */
+
+	      wgts[0][0] = (ONE-jw*jw*(THREE-TWO*jw)) * (ONE-iw*iw*(THREE-TWO*iw));
+	      wgts[0][1] = (ONE-jw*jw*(THREE-TWO*jw)) *      iw*iw*(THREE-TWO*iw);
+	      wgts[0][2] =      jw*jw*(THREE-TWO*jw)  *      iw*iw*(THREE-TWO*iw);
+	      wgts[0][3] =      jw*jw*(THREE-TWO*jw)  * (ONE-iw*iw*(THREE-TWO*iw));
+	      wgts[1][0] = (ONE-jw*jw*(THREE-TWO*jw)) *      iw*(iw-ONE)*(iw-ONE);
+	      wgts[1][1] = (ONE-jw*jw*(THREE-TWO*jw)) *      iw*iw*(iw-ONE);
+	      wgts[1][2] =      jw*jw*(THREE-TWO*jw)  *      iw*iw*(iw-ONE);
+	      wgts[1][3] =      jw*jw*(THREE-TWO*jw)  *      iw*(iw-ONE)*(iw-ONE);
+	      wgts[2][0] =      jw*(jw-ONE)*(jw-ONE)  * (ONE-iw*iw*(THREE-TWO*iw));
+	      wgts[2][1] =      jw*(jw-ONE)*(jw-ONE)  *      iw*iw*(THREE-TWO*iw);
+	      wgts[2][2] =      jw*jw*(jw-ONE)        *      iw*iw*(THREE-TWO*iw);
+	      wgts[2][3] =      jw*jw*(jw-ONE)        * (ONE-iw*iw*(THREE-TWO*iw));
+	      wgts[3][0] =      iw*(iw-ONE)*(iw-ONE)  *      jw*(jw-ONE)*(jw-ONE);
+              wgts[3][1] =      iw*iw*(iw-ONE)        *      jw*(jw-ONE)*(jw-ONE);
+	      wgts[3][2] =      iw*iw*(iw-ONE)        *      jw*jw*(jw-ONE);
+	      wgts[3][3] =      iw*(iw-ONE)*(iw-ONE)  *      jw*jw*(jw-ONE);
+
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	      store_link_bicub(rv, dst_add, src_add, wgts);
@@ -2473,8 +2465,8 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv)
 	      if ( cdoVerbose || lwarn )
 		{
 		  lwarn = FALSE;
-		  // cdoWarning("Iteration for i,j exceed max iteration count of %d!", Max_Iter);
-		  cdoWarning("Bicubic interpolation failed for some grid points - use a distance-weighted average instead!");
+		  // cdoWarning("Iteration for iw,jw exceed max iteration count of %d!", Max_Iter);
+		  cdoWarning("Bicubic interpolation failed for some grid points - used a distance-weighted average instead!");
 		}
 
 	      search_result = -1;
@@ -2498,7 +2490,7 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv)
           if ( icount > 0 )
 	    {
 	      /* Renormalize weights */
-	      sum_wgts = 0.0;
+	      double sum_wgts = 0.0; /* sum of weights for normalization */
 	      /* 2012-05-08 Uwe Schulzweida: using absolute value of src_lats (bug fix) */
 	      for ( n = 0; n < 4; ++n ) sum_wgts += fabs(src_lats[n]);
 	      for ( n = 0; n < 4; ++n ) wgts[0][n] = fabs(src_lats[n])/sum_wgts;
@@ -2508,7 +2500,7 @@ void remap_bicub(remapgrid_t *rg, remapvars_t *rv)
 
 	      rg->grid2_frac[dst_add] = ONE;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	      store_link_bicub(rv, dst_add, src_add, wgts);
@@ -2684,9 +2676,8 @@ void grid_search_nbr(remapgrid_t *rg, int *restrict nbr_add, double *restrict nb
 }  /*  grid_search_nbr  */
 
 /*
-  This routine stores the address and weight for this link in
-  the appropriate address and weight arrays and resizes those
-  arrays if necessary.
+  This routine stores the address and weight for this link in the appropriate 
+  address and weight arrays and resizes those arrays if necessary.
 */
 static
 void store_link_nbr(remapvars_t *rv, int add1, int add2, double weights)
@@ -2701,18 +2692,17 @@ void store_link_nbr(remapvars_t *rv, int add1, int add2, double weights)
 
   /*
      Increment number of links and check to see if remap arrays need
-     to be increased to accomodate the new link.  Then store the link.
+     to be increased to accomodate the new link. Then store the link.
   */
   nlink = rv->num_links;
-
   rv->num_links++;
+
   if ( rv->num_links >= rv->max_links ) 
     resize_remap_vars(rv, rv->resize_increment);
 
   rv->grid1_add[nlink] = add1;
   rv->grid2_add[nlink] = add2;
-
-  rv->wts[nlink] = weights;
+  rv->wts[nlink]       = weights;
 
 } /* store_link_nbr */
 
@@ -2760,7 +2750,7 @@ void remap_distwgt(remapgrid_t *rg, remapvars_t *rv)
   sinlat = (double *) malloc(grid1_size*sizeof(double));
   sinlon = (double *) malloc(grid1_size*sizeof(double));
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(rg, grid1_size, coslat, coslon, sinlat, sinlon)
 #endif
@@ -2774,7 +2764,7 @@ void remap_distwgt(remapgrid_t *rg, remapvars_t *rv)
 
   /* Loop over destination grid  */
   /* grid_loop1 */
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, cdoTimer, rg, rv, grid2_size, coslat, coslon, sinlat, sinlon, findex) \
   private(dst_add, n, coslat_dst, coslon_dst, sinlat_dst, sinlon_dst, dist_tot, \
@@ -2784,10 +2774,10 @@ void remap_distwgt(remapgrid_t *rg, remapvars_t *rv)
   for ( dst_add = 0; dst_add < grid2_size; ++dst_add )
     {
       int lprogress = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       if ( omp_get_thread_num() != 0 ) lprogress = 0;
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       findex++;
@@ -2838,7 +2828,7 @@ void remap_distwgt(remapgrid_t *rg, remapvars_t *rv)
 	      wgtstmp = nbr_dist[n]/dist_tot;
 
 	      rg->grid2_frac[dst_add] = ONE;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	      store_link_nbr(rv, nbr_add[n]-1, dst_add, wgtstmp);
@@ -3002,7 +2992,7 @@ void remap_distwgt1(remapgrid_t *rg, remapvars_t *rv)
   sinlat = (double *) malloc(grid1_size*sizeof(double));
   sinlon = (double *) malloc(grid1_size*sizeof(double));
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(rg, grid1_size, coslat, coslon, sinlat, sinlon)
 #endif
@@ -3016,7 +3006,7 @@ void remap_distwgt1(remapgrid_t *rg, remapvars_t *rv)
 
   /* Loop over destination grid  */
   /* grid_loop1 */
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, cdoTimer, rg, rv, grid2_size, coslat, coslon, sinlat, sinlon, findex) \
   private(dst_add, n, coslat_dst, coslon_dst, sinlat_dst, sinlon_dst, nbr_add, nbr_dist, nbr_mask, wgtstmp)	\
@@ -3025,10 +3015,10 @@ void remap_distwgt1(remapgrid_t *rg, remapvars_t *rv)
   for ( dst_add = 0; dst_add < grid2_size; ++dst_add )
     {
       int lprogress = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       if ( omp_get_thread_num() != 0 ) lprogress = 0;
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       findex++;
@@ -3071,7 +3061,7 @@ void remap_distwgt1(remapgrid_t *rg, remapvars_t *rv)
 	  wgtstmp = ONE;
 
 	  rg->grid2_frac[dst_add] = ONE;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 	  store_link_nbr(rv, nbr_add-1, dst_add, wgtstmp);
@@ -4269,7 +4259,7 @@ void store_link_cnsrv(remapvars_t *rv, long add1, long add2, double *restrict we
 
   /* If the link already exists, add the weight to the current weight arrays */
 
-#if  defined (SX)
+#if defined(SX)
 #define STRIPED 1
 #if STRIPED
 #define STRIPLENGTH 4096
@@ -4399,7 +4389,7 @@ long get_srch_cells(long grid1_add, long nbins, int *bin_addr1, int *bin_addr2,
   return (num_srch_cells);
 }
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 static
 void *alloc_srch_corner(size_t n)
 {
@@ -4462,7 +4452,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
   long    srch_corners;     /* num of corners of srch cells           */
   long    nsrch_corners;
   int    *srch_add;         /* global address of cells in srch arrays */
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   int **srch_add2;
   int ompthID, i;
 #endif
@@ -4518,7 +4508,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
       link_add2[0] = (int *) malloc(grid2_size*sizeof(int));
       link_add2[1] = (int *) malloc(grid2_size*sizeof(int));
 
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
       for ( n = 0; n < grid1_size; ++n )
@@ -4527,7 +4517,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 	  link_add1[1][n] = -1;
 	}
 
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
       for ( n = 0; n < grid2_size; ++n )
@@ -4558,7 +4548,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
   /*  Integrate around each cell on grid1 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   srch_add2 = (int **) malloc(ompNumThreads*sizeof(int *));
   for ( i = 0; i < ompNumThreads; ++i )
     srch_add2[i] = (int *) malloc(grid2_size*sizeof(int));
@@ -4573,7 +4563,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
   if ( cdoTimer ) timer_start(timer_remap_con_l1);
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, cdoTimer, nbins, grid1_centroid_lon, grid1_centroid_lat, \
          grid_store, link_add1, link_add2, rv, cdoVerbose, max_subseg, \
@@ -4587,12 +4577,12 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
   for ( grid1_add = 0; grid1_add < grid1_size; ++grid1_add )
     {
       int lprogress = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       ompthID = omp_get_thread_num();
       srch_add = srch_add2[ompthID];
       if ( ompthID != 0 ) lprogress = 0;
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       findex++;
@@ -4611,7 +4601,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
       /* Create search arrays */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 	  srch_corner_lat = (double *) alloc_srch_corner(srch_corners*num_srch_cells);
 	  srch_corner_lon = (double *) alloc_srch_corner(srch_corners*num_srch_cells);
 #else
@@ -4731,7 +4721,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 		  if ( grid2_add != -1 )
 		    if ( rg->grid1_mask[grid1_add] )
 		      {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 			{
@@ -4756,7 +4746,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 	    }
           /* End of segment */
         }
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       free_srch_corner(srch_corner_lat);
       free_srch_corner(srch_corner_lon);
 #endif
@@ -4766,12 +4756,12 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
   /* Finished with all cells: deallocate search arrays */
 
-#if ! defined (_OPENMP)
+#if ! defined(_OPENMP)
   if ( srch_corner_lon ) free(srch_corner_lon);
   if ( srch_corner_lat ) free(srch_corner_lat);
 #endif
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   for ( i = 0; i < ompNumThreads; ++i )
     free(srch_add2[i]);
 
@@ -4782,7 +4772,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
   /* Integrate around each cell on grid2 */
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   srch_add2 = (int **) malloc(ompNumThreads*sizeof(int *));
   for ( i = 0; i < ompNumThreads; ++i )
     srch_add2[i] = (int *) malloc(grid1_size*sizeof(int));
@@ -4799,7 +4789,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
   findex = 0;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(ompNumThreads, cdoTimer, nbins, grid2_centroid_lon, grid2_centroid_lat, \
          grid_store, link_add1, link_add2, rv, cdoVerbose, max_subseg, \
@@ -4813,12 +4803,12 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
   for ( grid2_add = 0; grid2_add < grid2_size; ++grid2_add )
     {
       int lprogress = 1;
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       ompthID = omp_get_thread_num();
       srch_add = srch_add2[ompthID];
       if ( ompthID != 0 ) lprogress = 0;
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp atomic
 #endif
       findex++;
@@ -4837,7 +4827,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
       /* Create search arrays */
       
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 	  srch_corner_lat = (double *) alloc_srch_corner(srch_corners*num_srch_cells);
 	  srch_corner_lon = (double *) alloc_srch_corner(srch_corners*num_srch_cells);
 #else
@@ -4958,7 +4948,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 		  if ( ! lcoinc && grid1_add != -1 )
 		    if ( rg->grid1_mask[grid1_add] )
 		      {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp critical
 #endif
 			{
@@ -4983,7 +4973,7 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 	    }
           /* End of segment */
 	}
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       free_srch_corner(srch_corner_lat);
       free_srch_corner(srch_corner_lon);
 #endif
@@ -4993,12 +4983,12 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
   /* Finished with all cells: deallocate search arrays */
 
-#if ! defined (_OPENMP)
+#if ! defined(_OPENMP)
   if ( srch_corner_lon ) free(srch_corner_lon);
   if ( srch_corner_lat ) free(srch_corner_lat);
 #endif
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   for ( i = 0; i < ompNumThreads; ++i )
     free(srch_add2[i]);
 
@@ -5193,10 +5183,10 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
 
   if ( rv->norm_opt == NORM_OPT_DESTAREA )
     {
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(num_links, rv, rg, grid1_centroid_lat, grid1_centroid_lon)		\
   private(n, n3, grid1_add, grid2_add, weights, norm_factor)
@@ -5219,10 +5209,10 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
     }
   else if ( rv->norm_opt == NORM_OPT_FRACAREA )
     {
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(num_links, rv, rg, grid1_centroid_lat, grid1_centroid_lon)		\
   private(n, n3, grid1_add, grid2_add, weights, norm_factor)
@@ -5245,10 +5235,10 @@ void remap_conserv(remapgrid_t *rg, remapvars_t *rv)
     }
   else if ( rv->norm_opt == NORM_OPT_NONE )
     {
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none) \
   shared(num_links, rv, rg, grid1_centroid_lat, grid1_centroid_lon)	\
   private(n, n3, grid1_add, grid2_add, weights, norm_factor)
@@ -5436,7 +5426,7 @@ void remap_stat(int remap_order, remapgrid_t rg, remapvars_t rv, const double *r
 
   for ( n = 0; n < rg.grid2_size; ++n ) grid2_count[n] = 0;
 
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
   for ( n = 0; n < rv.num_links; ++n ) grid2_count[rv.grid2_add[n]]++;
@@ -5498,7 +5488,7 @@ void remap_gradients(remapgrid_t rg, const double *restrict array, double *restr
   nx = rg.grid1_dims[0];
   ny = rg.grid1_dims[1];
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(none)        \
   shared(grid1_size, grad1_lat, grad1_lon, grad1_latlon, rg, nx, ny, array) \
   private(n, i, j, ip1, im1, jp1, jm1, in, is, ie, iw, ine, inw, ise, isw, delew, delns, grad1_lat_zero, grad1_lon_zero)
@@ -5762,738 +5752,3 @@ void reorder_links(remapvars_t *rv)
       printf("loop %ld  nlinks %ld\n", j+1, nlinks);
     }
 }
-
-
-/*****************************************************************************/
-
-#if  defined  (HAVE_LIBNETCDF)
-#  include "netcdf.h"
-#endif
-
-
-#if  defined  (HAVE_LIBNETCDF)
-static
-void nce(int istat)
-{
-  /*
-    This routine provides a simple interface to netCDF error message routine.
-  */
-
-  if ( istat != NC_NOERR ) cdoAbort(nc_strerror(istat));
-}
-#endif
-
-
-void write_remap_scrip(const char *interp_file, int map_type, int submap_type, 
-		       int remap_order, remapgrid_t rg, remapvars_t rv)
-{
-  /*
-    Writes remap data to a netCDF file using SCRIP conventions
-  */
-  /*
-    Input variables:
-
-    interp_file  ! filename for remap data
-  */
-
-#if  defined  (HAVE_LIBNETCDF)
-
-  /* Local variables */
-
-  int nc_file_id;           /* id for netCDF file                       */
-  int nc_srcgrdsize_id;     /* id for source grid size                  */
-  int nc_dstgrdsize_id;     /* id for destination grid size             */
-  int nc_srcgrdcorn_id = 0; /* id for number of source grid corners     */
-  int nc_dstgrdcorn_id = 0; /* id for number of dest grid corners       */
-  int nc_srcgrdrank_id;     /* id for source grid rank                  */
-  int nc_dstgrdrank_id;     /* id for dest grid rank                    */
-  int nc_numlinks_id;       /* id for number of links in mapping        */
-  int nc_numwgts_id;        /* id for number of weights for mapping     */
-  int nc_srcgrddims_id;     /* id for source grid dimensions            */
-  int nc_dstgrddims_id;     /* id for dest grid dimensions              */
-  int nc_srcgrdcntrlat_id;  /* id for source grid center latitude       */
-  int nc_dstgrdcntrlat_id;  /* id for dest grid center latitude         */
-  int nc_srcgrdcntrlon_id;  /* id for source grid center longitude      */
-  int nc_dstgrdcntrlon_id;  /* id for dest grid center longitude        */
-  int nc_srcgrdimask_id;    /* id for source grid mask                  */
-  int nc_dstgrdimask_id;    /* id for dest grid mask                    */
-  int nc_srcgrdcrnrlat_id;  /* id for latitude of source grid corners   */
-  int nc_srcgrdcrnrlon_id;  /* id for longitude of source grid corners  */
-  int nc_dstgrdcrnrlat_id;  /* id for latitude of dest grid corners     */
-  int nc_dstgrdcrnrlon_id;  /* id for longitude of dest grid corners    */
-  int nc_srcgrdarea_id;     /* id for area of source grid cells         */
-  int nc_dstgrdarea_id;     /* id for area of dest grid cells           */
-  int nc_srcgrdfrac_id;     /* id for area fraction on source grid      */
-  int nc_dstgrdfrac_id;     /* id for area fraction on dest grid        */
-  int nc_srcadd_id;         /* id for map source address                */
-  int nc_dstadd_id;         /* id for map destination address           */
-  int nc_rmpmatrix_id;      /* id for remapping matrix                  */
-
-  int nc_dims2_id[2];       /* netCDF ids for 2d array dims             */
-
-  char map_name[] = "SCRIP remapping with CDO";
-  char normalize_opt[64] = "unknown";
-  char map_method[64] = "unknown";
-  char tmp_string[64] = "unknown";
-  char history[1024] = "date and time";
-  char grid1_name[64] = "source grid";
-  char grid2_name[64] = "dest grid";
-  char grid1_units[] = "radians";
-  char grid2_units[] = "radians";
-  time_t date_and_time_in_sec;
-  struct tm *date_and_time;
-  long i;
-  int writemode = NC_CLOBBER;
-
-  switch ( rv.norm_opt )
-    {
-    case NORM_OPT_NONE:
-      strcpy(normalize_opt, "none");
-      break;
-    case NORM_OPT_FRACAREA:
-      strcpy(normalize_opt, "fracarea");
-      break;
-    case NORM_OPT_DESTAREA:
-      strcpy(normalize_opt, "destarea");
-      break;
-    }
-
-  switch ( map_type )
-    {
-    case MAP_TYPE_CONSERV:
-      if ( submap_type == SUBMAP_TYPE_LAF )
-	{
-	  strcpy(map_method, "Largest area fraction");
-	  break;
-	}
-      else
-	{
-	  strcpy(map_method, "Conservative remapping");
-	  break;
-	}
-    case MAP_TYPE_BILINEAR:
-      strcpy(map_method, "Bilinear remapping");
-      break;
-    case MAP_TYPE_DISTWGT:
-      strcpy(map_method, "Distance weighted avg of nearest neighbors");
-      break;
-    case MAP_TYPE_DISTWGT1:
-      strcpy(map_method, "Nearest neighbor");
-      break;
-    case MAP_TYPE_BICUBIC:
-      strcpy(map_method, "Bicubic remapping");
-      break;
-    }
-
-  {
-    size_t filesize;
-    size_t nele1, nele2;
-
-    nele1 = 4*8 + 4;
-    nele2 = 4*8 + 4;
-    if ( rg.lneed_grid1_corners ) nele1 += rg.grid1_corners*2*8;
-    if ( rg.lneed_grid2_corners ) nele2 += rg.grid2_corners*2*8;
-    filesize = rg.grid1_size*(nele1) +
-               rg.grid2_size*(nele2) +
-               rv.num_links*(4 + 4 + rv.num_wts*8);
-
-    if ( cdoVerbose )
-      cdoPrint("Filesize for remap weights: ~%lu", (unsigned long) filesize);
-    
-    if ( filesize > 0x7FFFFC00 ) /* 2**31 - 1024 (<2GB) */
-      {
-#if  defined  (NC_64BIT_OFFSET)
-	writemode = NC_CLOBBER | NC_64BIT_OFFSET;
-#else
-	cdoAbort("Filesize for remap weights maybe too large!");
-#endif
-      }
-  }
-
-  /* Create netCDF file for mapping and define some global attributes */
-  nce(nc_create(interp_file, writemode, &nc_file_id));
-
-  /* Map name */
-  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "title", strlen(map_name), map_name));
-
-  /* Normalization option */
-  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "normalization", strlen(normalize_opt), normalize_opt));
-
-  /* Map method */
-  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "map_method", strlen(map_method), map_method));
-
-  /* Remap order */
-  if ( map_type == MAP_TYPE_CONSERV && submap_type == SUBMAP_TYPE_NONE )
-    nce(nc_put_att_int(nc_file_id, NC_GLOBAL, "remap_order", NC_INT, 1L, &remap_order));
-
-  /* History */
-  date_and_time_in_sec = time(NULL);
-
-  if ( date_and_time_in_sec != -1 )
-    {
-      date_and_time = localtime(&date_and_time_in_sec);
-      (void) strftime(history, 1024, "%d %b %Y : ", date_and_time);
-      strcat(history, commandLine());
-    }
-
-  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "history", strlen(history), history));
-
-  /* File convention */
-  strcpy(tmp_string, "SCRIP");
-  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "conventions", strlen(tmp_string), tmp_string));
-
-  /* Source and destination grid names */
-  gridName(gridInqType(rg.gridID1), grid1_name);
-  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "source_grid", strlen(grid1_name), grid1_name));
-
-  gridName(gridInqType(rg.gridID2), grid2_name);
-  nce(nc_put_att_text(nc_file_id, NC_GLOBAL, "dest_grid", strlen(grid2_name), grid2_name));
-
-  /* Prepare netCDF dimension info */
-
-  /* Define grid size dimensions */
-  nce(nc_def_dim(nc_file_id, "src_grid_size", rg.grid1_size, &nc_srcgrdsize_id));
-  nce(nc_def_dim(nc_file_id, "dst_grid_size", rg.grid2_size, &nc_dstgrdsize_id));
-
-  /* Define grid corner dimension */
-  if ( rg.lneed_grid1_corners )
-    nce(nc_def_dim(nc_file_id, "src_grid_corners", rg.grid1_corners, &nc_srcgrdcorn_id));
-  if ( rg.lneed_grid2_corners )
-    nce(nc_def_dim(nc_file_id, "dst_grid_corners", rg.grid2_corners, &nc_dstgrdcorn_id));
-
-  /* Define grid rank dimension */
-  nce(nc_def_dim(nc_file_id, "src_grid_rank", rg.grid1_rank, &nc_srcgrdrank_id));
-  nce(nc_def_dim(nc_file_id, "dst_grid_rank", rg.grid2_rank, &nc_dstgrdrank_id));
-
-  /* Define map size dimensions */
-  nce(nc_def_dim(nc_file_id, "num_links", rv.num_links, &nc_numlinks_id));
-  nce(nc_def_dim(nc_file_id, "num_wgts", rv.num_wts, &nc_numwgts_id));
-       
-  /* Define grid dimensions */
-  nce(nc_def_var(nc_file_id, "src_grid_dims", NC_INT, 1, &nc_srcgrdrank_id, &nc_srcgrddims_id));
-  nce(nc_def_var(nc_file_id, "dst_grid_dims", NC_INT, 1, &nc_dstgrdrank_id, &nc_dstgrddims_id));
-
-  /* Define all arrays for netCDF descriptors */
-
-  /* Define grid center latitude array */
-  nce(nc_def_var(nc_file_id, "src_grid_center_lat", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdcntrlat_id));
-  nce(nc_def_var(nc_file_id, "dst_grid_center_lat", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdcntrlat_id));
-
-  /* Define grid center longitude array */
-  nce(nc_def_var(nc_file_id, "src_grid_center_lon", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdcntrlon_id));
-  nce(nc_def_var(nc_file_id, "dst_grid_center_lon", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdcntrlon_id));
-
-  /* Define grid corner lat/lon arrays */
-
-  nc_dims2_id[0] = nc_srcgrdsize_id;
-  nc_dims2_id[1] = nc_srcgrdcorn_id;
-
-  if ( rg.lneed_grid1_corners )
-    {
-      nce(nc_def_var(nc_file_id, "src_grid_corner_lat", NC_DOUBLE, 2, nc_dims2_id, &nc_srcgrdcrnrlat_id));
-      nce(nc_def_var(nc_file_id, "src_grid_corner_lon", NC_DOUBLE, 2, nc_dims2_id, &nc_srcgrdcrnrlon_id));
-    }
-
-  nc_dims2_id[0] = nc_dstgrdsize_id;
-  nc_dims2_id[1] = nc_dstgrdcorn_id;
-
-  if ( rg.lneed_grid2_corners )
-    {
-      nce(nc_def_var(nc_file_id, "dst_grid_corner_lat", NC_DOUBLE, 2, nc_dims2_id, &nc_dstgrdcrnrlat_id));
-      nce(nc_def_var(nc_file_id, "dst_grid_corner_lon", NC_DOUBLE, 2, nc_dims2_id, &nc_dstgrdcrnrlon_id));
-    }
-
-  /* Define units for all coordinate arrays */
-  nce(nc_put_att_text(nc_file_id, nc_srcgrdcntrlat_id, "units", 7, grid1_units));
-  nce(nc_put_att_text(nc_file_id, nc_dstgrdcntrlat_id, "units", 7, grid2_units));
-  nce(nc_put_att_text(nc_file_id, nc_srcgrdcntrlon_id, "units", 7, grid1_units));
-  nce(nc_put_att_text(nc_file_id, nc_dstgrdcntrlon_id, "units", 7, grid2_units));
-  if ( rg.lneed_grid1_corners )
-    {
-      nce(nc_put_att_text(nc_file_id, nc_srcgrdcrnrlat_id, "units", 7, grid1_units));
-      nce(nc_put_att_text(nc_file_id, nc_srcgrdcrnrlon_id, "units", 7, grid1_units));
-    }
-  if ( rg.lneed_grid2_corners )
-    {
-      nce(nc_put_att_text(nc_file_id, nc_dstgrdcrnrlat_id, "units", 7, grid2_units));
-      nce(nc_put_att_text(nc_file_id, nc_dstgrdcrnrlon_id, "units", 7, grid2_units));
-    }
-
-  /* Define grid mask */
-
-  nce(nc_def_var(nc_file_id, "src_grid_imask", NC_INT, 1, &nc_srcgrdsize_id, &nc_srcgrdimask_id));
-  nce(nc_put_att_text(nc_file_id, nc_srcgrdimask_id, "units", 8, "unitless"));
-
-  nce(nc_def_var(nc_file_id, "dst_grid_imask", NC_INT, 1, &nc_dstgrdsize_id, &nc_dstgrdimask_id));
-  nce(nc_put_att_text(nc_file_id, nc_dstgrdimask_id, "units", 8, "unitless"));
-
-  /* Define grid area arrays */
-
-  nce(nc_def_var(nc_file_id, "src_grid_area", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdarea_id));
-  nce(nc_put_att_text(nc_file_id, nc_srcgrdarea_id, "units", 14, "square radians"));
-
-  nce(nc_def_var(nc_file_id, "dst_grid_area", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdarea_id));   
-  nce(nc_put_att_text(nc_file_id, nc_dstgrdarea_id, "units", 14, "square radians"));
-
-  /* Define grid fraction arrays */
-
-  nce(nc_def_var(nc_file_id, "src_grid_frac", NC_DOUBLE, 1, &nc_srcgrdsize_id, &nc_srcgrdfrac_id));
-  nce(nc_put_att_text(nc_file_id, nc_srcgrdfrac_id, "units", 8, "unitless"));
-
-  nce(nc_def_var(nc_file_id, "dst_grid_frac", NC_DOUBLE, 1, &nc_dstgrdsize_id, &nc_dstgrdfrac_id));
-  nce(nc_put_att_text(nc_file_id, nc_dstgrdfrac_id, "units", 8, "unitless"));
-
-  /* Define mapping arrays */
-
-  nce(nc_def_var(nc_file_id, "src_address", NC_INT, 1, &nc_numlinks_id, &nc_srcadd_id));      
-  nce(nc_def_var(nc_file_id, "dst_address", NC_INT, 1, &nc_numlinks_id, &nc_dstadd_id));
-
-  nc_dims2_id[0] = nc_numlinks_id;
-  nc_dims2_id[1] = nc_numwgts_id;
-
-  nce(nc_def_var(nc_file_id, "remap_matrix", NC_DOUBLE, 2, nc_dims2_id, &nc_rmpmatrix_id));
-
-  /* End definition stage */
-  
-  nce(nc_enddef(nc_file_id));
-
-
-  /* Write mapping data */
-
-  nce(nc_put_var_int(nc_file_id, nc_srcgrddims_id, rg.grid1_dims));
-  nce(nc_put_var_int(nc_file_id, nc_dstgrddims_id, rg.grid2_dims));
-
-  nce(nc_put_var_int(nc_file_id, nc_srcgrdimask_id, rg.grid1_mask));
-  nce(nc_put_var_int(nc_file_id, nc_dstgrdimask_id, rg.grid2_mask));
-
-  nce(nc_put_var_double(nc_file_id, nc_srcgrdcntrlat_id, rg.grid1_center_lat)); 
-  nce(nc_put_var_double(nc_file_id, nc_srcgrdcntrlon_id, rg.grid1_center_lon));
-
-  if ( rg.lneed_grid1_corners )
-    {
-      nce(nc_put_var_double(nc_file_id, nc_srcgrdcrnrlat_id, rg.grid1_corner_lat));
-      nce(nc_put_var_double(nc_file_id, nc_srcgrdcrnrlon_id, rg.grid1_corner_lon));
-    }
-
-  nce(nc_put_var_double(nc_file_id, nc_dstgrdcntrlat_id, rg.grid2_center_lat));
-  nce(nc_put_var_double(nc_file_id, nc_dstgrdcntrlon_id, rg.grid2_center_lon));
-
-  if ( rg.lneed_grid2_corners )
-    {
-      nce(nc_put_var_double(nc_file_id, nc_dstgrdcrnrlat_id, rg.grid2_corner_lat));
-      nce(nc_put_var_double(nc_file_id, nc_dstgrdcrnrlon_id, rg.grid2_corner_lon));
-    }
-  /*
-  if ( luse_grid1_area )
-    nce(nc_put_var_double(nc_file_id, nc_srcgrdarea_id, rg.grid1_area_in));
-  else
-  */
-  if ( map_type == MAP_TYPE_CONSERV )
-    nce(nc_put_var_double(nc_file_id, nc_srcgrdarea_id, rg.grid1_area));
-
-  nce(nc_put_var_double(nc_file_id, nc_srcgrdfrac_id, rg.grid1_frac));
-
-  /*
-  if ( luse_grid2_area )
-    nce(nc_put_var_double(nc_file_id, nc_dstgrdarea_id, rg.grid2_area_in));
-  else
-  */
-  if ( map_type == MAP_TYPE_CONSERV )
-    nce(nc_put_var_double(nc_file_id, nc_dstgrdarea_id, rg.grid2_area));
-
-  nce(nc_put_var_double(nc_file_id, nc_dstgrdfrac_id, rg.grid2_frac));
-
-  for ( i = 0; i < rv.num_links; i++ )
-    {
-      rv.grid1_add[i]++;
-      rv.grid2_add[i]++;
-    }
-
-  nce(nc_put_var_int(nc_file_id, nc_srcadd_id, rv.grid1_add));
-  nce(nc_put_var_int(nc_file_id, nc_dstadd_id, rv.grid2_add));
-
-  nce(nc_put_var_double(nc_file_id, nc_rmpmatrix_id, rv.wts));
-
-  nce(nc_close(nc_file_id));
-
-#else
-  cdoAbort("netCDF support not compiled in!");
-#endif
-
-}  /* write_remap_scrip */
-
-/*****************************************************************************/
-
-void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, int *map_type, int *submap_type,
-		      int *remap_order, remapgrid_t *rg, remapvars_t *rv)
-{
-  /*
-    The routine reads a netCDF file to extract remapping info
-    in SCRIP format
-  */
-  /*
-    Input variables
-
-    interp_file        ! filename for remap data
-  */
-#if  defined  (HAVE_LIBNETCDF)
-
-  /* Local variables */
-
-  int status;
-  int nc_file_id;           /* id for netCDF file                       */
-  int nc_srcgrdsize_id;     /* id for source grid size                  */
-  int nc_dstgrdsize_id;     /* id for destination grid size             */
-  int nc_srcgrdcorn_id;     /* id for number of source grid corners     */
-  int nc_dstgrdcorn_id;     /* id for number of dest grid corners       */
-  int nc_srcgrdrank_id;     /* id for source grid rank                  */
-  int nc_dstgrdrank_id;     /* id for dest grid rank                    */
-  int nc_numlinks_id;       /* id for number of links in mapping        */
-  int nc_numwgts_id;        /* id for number of weights for mapping     */
-  int nc_srcgrddims_id;     /* id for source grid dimensions            */
-  int nc_dstgrddims_id;     /* id for dest grid dimensions              */
-  int nc_srcgrdcntrlat_id;  /* id for source grid center latitude       */
-  int nc_dstgrdcntrlat_id;  /* id for dest grid center latitude         */
-  int nc_srcgrdcntrlon_id;  /* id for source grid center longitude      */
-  int nc_dstgrdcntrlon_id;  /* id for dest grid center longitude        */
-  int nc_srcgrdimask_id;    /* id for source grid mask                  */
-  int nc_dstgrdimask_id;    /* id for dest grid mask                    */
-  int nc_srcgrdcrnrlat_id;  /* id for latitude of source grid corners   */
-  int nc_srcgrdcrnrlon_id;  /* id for longitude of source grid corners  */
-  int nc_dstgrdcrnrlat_id;  /* id for latitude of dest grid corners     */
-  int nc_dstgrdcrnrlon_id;  /* id for longitude of dest grid corners    */
-  int nc_srcgrdarea_id;     /* id for area of source grid cells         */
-  int nc_dstgrdarea_id;     /* id for area of dest grid cells           */
-  int nc_srcgrdfrac_id;     /* id for area fraction on source grid      */
-  int nc_dstgrdfrac_id;     /* id for area fraction on dest grid        */
-  int nc_srcadd_id;         /* id for map source address                */
-  int nc_dstadd_id;         /* id for map destination address           */
-  int nc_rmpmatrix_id;      /* id for remapping matrix                  */
-
-  long i;                   /* dummy index */
-
-  char map_name[1024];
-  char map_method[64];      /* character string for map_type             */
-  char normalize_opt[64];   /* character string for normalization option */
-  char convention[64];      /* character string for output convention    */
-  char grid1_name[64];      /* grid name for source grid                 */
-  char grid2_name[64];      /* grid name for dest   grid                 */
-  char grid1_units[64];
-  char grid2_units[64];
-  size_t attlen, dimlen;
-
-  int gridID1_gme_c = -1;
-
-
-  /* Open file and read some global information */
-
-  /* nce(nc_open(interp_file, NC_NOWRITE, &nc_file_id)); */
-  nc_file_id = cdf_openread(interp_file);
-
-  /* Map name */
-
-  nce(nc_get_att_text(nc_file_id, NC_GLOBAL, "title", map_name));
-  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "title", &attlen));
-  map_name[attlen] = 0;
-
-  if ( cdoVerbose )
-    {
-      cdoPrint("Reading remapping: %s", map_name);
-      cdoPrint("From file: %s", interp_file);
-    }
-
-  /* Normalization option */
-
-  nce(nc_get_att_text(nc_file_id, NC_GLOBAL, "normalization", normalize_opt));
-  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "normalization", &attlen));
-  normalize_opt[attlen] = 0;
-
-  if ( strcmp(normalize_opt, "none") == 0 )
-    rv->norm_opt = NORM_OPT_NONE;
-  else if ( strcmp(normalize_opt, "fracarea") == 0 )
-    rv->norm_opt = NORM_OPT_FRACAREA;
-  else if ( strcmp(normalize_opt, "destarea") == 0 )
-    rv->norm_opt = NORM_OPT_DESTAREA;
-  else
-    {
-      cdoPrint("normalize_opt = %s", normalize_opt);
-      cdoAbort("Invalid normalization option");
-    }
-
-  if ( cdoVerbose )
-    cdoPrint("normalize_opt = %s", normalize_opt);
-
-  /* Map method */
-
-  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "map_method", map_method));
-  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "map_method", &attlen));
-  map_method[attlen] = 0;
-
-  *submap_type = SUBMAP_TYPE_NONE;
-  *remap_order = 1;
-
-  if ( memcmp(map_method, "Conservative", 12) == 0 )
-    {
-      int iatt;
-      rv->map_type = MAP_TYPE_CONSERV;
-      status = nc_get_att_int(nc_file_id, NC_GLOBAL, "remap_order", &iatt);
-      if ( status == NC_NOERR ) *remap_order = iatt;
-    }
-  else if ( memcmp(map_method, "Bilinear", 8) == 0 ) rv->map_type = MAP_TYPE_BILINEAR;
-  else if ( memcmp(map_method, "Distance", 8) == 0 ) rv->map_type = MAP_TYPE_DISTWGT;
-  else if ( memcmp(map_method, "Nearest", 7) == 0 )  rv->map_type = MAP_TYPE_DISTWGT1;
-  else if ( memcmp(map_method, "Bicubic", 7) == 0 )  rv->map_type = MAP_TYPE_BICUBIC;
-  else if ( memcmp(map_method, "Largest", 7) == 0 )
-    {
-      rv->map_type = MAP_TYPE_CONSERV;
-      *submap_type = SUBMAP_TYPE_LAF;
-    }
-  else
-    {
-      cdoPrint("map_type = %s", map_method);
-      cdoAbort("Invalid Map Type");
-    }
-
-  if ( cdoVerbose )
-    cdoPrint("map_type = %s", map_method);
-
-  *map_type = rv->map_type;
-
-  /* File convention */
-
-  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "conventions", convention));
-  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "conventions", &attlen));
-  convention[attlen] = 0;
-
-  if ( strcmp(convention, "SCRIP") != 0 )
-    {
-      cdoPrint("convention = %s", convention);
-      if ( strcmp(convention, "NCAR-CSM") == 0 )
-        cdoAbort("Unsupported file convention!");
-      else
-        cdoAbort("Unknown file convention!");
-    }
-
-  /* Read some additional global attributes */
-
-  /* Source and destination grid names */
-
-  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "source_grid", grid1_name));
-  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "source_grid", &attlen));
-  grid1_name[attlen] = 0;
-  
-  nce(nc_get_att_text (nc_file_id, NC_GLOBAL, "dest_grid", grid2_name));
-  nce(nc_inq_attlen(nc_file_id, NC_GLOBAL, "dest_grid", &attlen));
-  grid2_name[attlen] = 0;
- 
-  if ( cdoVerbose )
-    cdoPrint("Remapping between: %s and %s", grid1_name, grid2_name);
-
-  /* Read dimension information */
-
-  nce(nc_inq_dimid(nc_file_id, "src_grid_size", &nc_srcgrdsize_id));
-  nce(nc_inq_dimlen(nc_file_id, nc_srcgrdsize_id, &dimlen));
-  rg->grid1_size = dimlen;
-  /*
-  if (  rg->grid1_size != gridInqSize(gridID1) )
-    cdoAbort("Source grids have different size!");
-  */
-  nce(nc_inq_dimid(nc_file_id, "dst_grid_size", &nc_dstgrdsize_id));
-  nce(nc_inq_dimlen(nc_file_id, nc_dstgrdsize_id, &dimlen));
-  rg->grid2_size = dimlen;
-  /*
-  if ( rg->grid2_size != gridInqSize(gridID2) )
-    cdoAbort("Target grids have different size!");
-  */
-  rg->grid1_corners = 0;
-  rg->luse_grid1_corners = FALSE;
-  rg->lneed_grid1_corners = FALSE;
-  status = nc_inq_dimid(nc_file_id, "src_grid_corners", &nc_srcgrdcorn_id);
-  if ( status == NC_NOERR )
-    {
-      nce(nc_inq_dimlen(nc_file_id, nc_srcgrdcorn_id, &dimlen));
-      rg->grid1_corners = dimlen;
-      rg->luse_grid1_corners = TRUE;
-      rg->lneed_grid1_corners = TRUE;
-    }
-
-  rg->grid2_corners = 0;
-  rg->luse_grid2_corners = FALSE;
-  rg->lneed_grid2_corners = FALSE;
-  status = nc_inq_dimid(nc_file_id, "dst_grid_corners", &nc_dstgrdcorn_id);
-  if ( status == NC_NOERR )
-    {
-      nce(nc_inq_dimlen(nc_file_id, nc_dstgrdcorn_id, &dimlen));
-      rg->grid2_corners = dimlen;
-      rg->luse_grid2_corners = TRUE;
-      rg->lneed_grid2_corners = TRUE;
-    }
-
-  nce(nc_inq_dimid(nc_file_id, "src_grid_rank", &nc_srcgrdrank_id));
-  nce(nc_inq_dimlen(nc_file_id, nc_srcgrdrank_id, &dimlen));
-  rg->grid1_rank = dimlen;
-
-  nce(nc_inq_dimid(nc_file_id, "dst_grid_rank", &nc_dstgrdrank_id));
-  nce(nc_inq_dimlen(nc_file_id, nc_dstgrdrank_id, &dimlen));
-  rg->grid2_rank = dimlen;
-
-  nce(nc_inq_dimid(nc_file_id, "num_links", &nc_numlinks_id));
-  nce(nc_inq_dimlen(nc_file_id, nc_numlinks_id, &dimlen));
-  rv->num_links = dimlen;
-
-  nce(nc_inq_dimid(nc_file_id, "num_wgts", &nc_numwgts_id));
-  nce(nc_inq_dimlen(nc_file_id, nc_numwgts_id, &dimlen));
-  rv->num_wts = dimlen;
-
-  rg->gridID1 = gridID1;
-  rg->gridID2 = gridID2;
-
-  /* Initialize all pointer */
-  rg->pinit = FALSE;
-  remapGridInitPointer(rg);
-
-  if ( gridInqType(gridID1) == GRID_GME )
-    {
-      rg->grid1_nvgp = gridInqSize(gridID1);
-      gridID1_gme_c = gridToUnstructured(gridID1, 1);
-    }
-
-  remapGridRealloc(rv->map_type, rg);
-
-  if ( gridInqType(gridID1) == GRID_GME ) gridInqMaskGME(gridID1_gme_c, rg->grid1_vgpm);    
-
-  rv->pinit = TRUE;
-  rv->wts = NULL;
-
-  rv->max_links = rv->num_links;
-
-  rv->resize_increment = (int) (0.1 * MAX(rg->grid1_size, rg->grid2_size));
-
-  /* Allocate address and weight arrays for mapping 1 */
-
-  rv->grid1_add = (int *) malloc(rv->num_links*sizeof(int));
-  rv->grid2_add = (int *) malloc(rv->num_links*sizeof(int));
-
-  rv->wts = (double *) malloc(rv->num_wts*rv->num_links*sizeof(double));
-
-  /* Get variable ids */
-
-  nce(nc_inq_varid(nc_file_id, "src_grid_dims", &nc_srcgrddims_id));
-  nce(nc_inq_varid(nc_file_id, "src_grid_imask", &nc_srcgrdimask_id));
-  nce(nc_inq_varid(nc_file_id, "src_grid_center_lat", &nc_srcgrdcntrlat_id));
-  nce(nc_inq_varid(nc_file_id, "src_grid_center_lon", &nc_srcgrdcntrlon_id));
-  if ( rg->grid1_corners )
-    {
-      nce(nc_inq_varid(nc_file_id, "src_grid_corner_lat", &nc_srcgrdcrnrlat_id));
-      nce(nc_inq_varid(nc_file_id, "src_grid_corner_lon", &nc_srcgrdcrnrlon_id));
-    }
-  nce(nc_inq_varid(nc_file_id, "src_grid_area", &nc_srcgrdarea_id));
-  nce(nc_inq_varid(nc_file_id, "src_grid_frac", &nc_srcgrdfrac_id));
-  nce(nc_inq_varid(nc_file_id, "dst_grid_dims", &nc_dstgrddims_id));
-  nce(nc_inq_varid(nc_file_id, "dst_grid_imask", &nc_dstgrdimask_id));
-  nce(nc_inq_varid(nc_file_id, "dst_grid_center_lat", &nc_dstgrdcntrlat_id));
-  nce(nc_inq_varid(nc_file_id, "dst_grid_center_lon", &nc_dstgrdcntrlon_id));
-  if ( rg->grid2_corners )
-    {
-      nce(nc_inq_varid(nc_file_id, "dst_grid_corner_lat", &nc_dstgrdcrnrlat_id));
-      nce(nc_inq_varid(nc_file_id, "dst_grid_corner_lon", &nc_dstgrdcrnrlon_id));
-    }
-  nce(nc_inq_varid(nc_file_id, "dst_grid_area", &nc_dstgrdarea_id));
-  nce(nc_inq_varid(nc_file_id, "dst_grid_frac", &nc_dstgrdfrac_id));    
-  nce(nc_inq_varid(nc_file_id, "src_address", &nc_srcadd_id));
-  nce(nc_inq_varid(nc_file_id, "dst_address", &nc_dstadd_id));
-  nce(nc_inq_varid(nc_file_id, "remap_matrix", &nc_rmpmatrix_id));
-
-  /* Read all variables */
-
-  nce(nc_get_var_int(nc_file_id, nc_srcgrddims_id, rg->grid1_dims));
-
-  nce(nc_get_var_int(nc_file_id, nc_srcgrdimask_id, rg->grid1_mask));
-
-  nce(nc_get_var_double(nc_file_id, nc_srcgrdcntrlat_id, rg->grid1_center_lat));
-  nce(nc_get_var_double(nc_file_id, nc_srcgrdcntrlon_id, rg->grid1_center_lon));
-
-  nce(nc_get_att_text(nc_file_id, nc_srcgrdcntrlat_id, "units", grid1_units));
-  nce(nc_inq_attlen(nc_file_id, nc_srcgrdcntrlat_id, "units", &attlen));
-  grid1_units[attlen] = 0;
-
-  grid_to_radian(grid1_units, rg->grid1_size, rg->grid1_center_lon, "grid1 center lon"); 
-  grid_to_radian(grid1_units, rg->grid1_size, rg->grid1_center_lat, "grid1 center lat"); 
-
-  if ( rg->grid1_corners )
-    {
-      nce(nc_get_var_double(nc_file_id, nc_srcgrdcrnrlat_id, rg->grid1_corner_lat));
-      nce(nc_get_var_double(nc_file_id, nc_srcgrdcrnrlon_id, rg->grid1_corner_lon));
-
-      nce(nc_get_att_text(nc_file_id, nc_srcgrdcrnrlat_id, "units", grid1_units));
-      nce(nc_inq_attlen(nc_file_id, nc_srcgrdcrnrlat_id, "units", &attlen));
-      grid1_units[attlen] = 0;
-
-      grid_to_radian(grid1_units, rg->grid1_corners*rg->grid1_size, rg->grid1_corner_lon, "grid1 corner lon"); 
-      grid_to_radian(grid1_units, rg->grid1_corners*rg->grid1_size, rg->grid1_corner_lat, "grid1 corner lat"); 
-    }
-
-  if ( rv->map_type == MAP_TYPE_CONSERV )
-    nce(nc_get_var_double(nc_file_id, nc_srcgrdarea_id, rg->grid1_area));
-
-  nce(nc_get_var_double(nc_file_id, nc_srcgrdfrac_id, rg->grid1_frac));
-
-  nce(nc_get_var_int(nc_file_id, nc_dstgrddims_id, rg->grid2_dims));
-
-  nce(nc_get_var_int(nc_file_id, nc_dstgrdimask_id, rg->grid2_mask));
-
-  nce(nc_get_var_double(nc_file_id, nc_dstgrdcntrlat_id, rg->grid2_center_lat));
-  nce(nc_get_var_double(nc_file_id, nc_dstgrdcntrlon_id, rg->grid2_center_lon));
-
-  nce(nc_get_att_text(nc_file_id, nc_dstgrdcntrlat_id, "units", grid2_units));
-  nce(nc_inq_attlen(nc_file_id, nc_dstgrdcntrlat_id, "units", &attlen));
-  grid2_units[attlen] = 0;
-
-  grid_to_radian(grid2_units, rg->grid2_size, rg->grid2_center_lon, "grid2 center lon"); 
-  grid_to_radian(grid2_units, rg->grid2_size, rg->grid2_center_lat, "grid2 center lat"); 
-
-  if ( rg->grid2_corners )
-    {
-      nce(nc_get_var_double(nc_file_id, nc_dstgrdcrnrlat_id, rg->grid2_corner_lat));
-      nce(nc_get_var_double(nc_file_id, nc_dstgrdcrnrlon_id, rg->grid2_corner_lon));
-
-      nce(nc_get_att_text(nc_file_id, nc_dstgrdcrnrlat_id, "units", grid2_units));
-      nce(nc_inq_attlen(nc_file_id, nc_dstgrdcrnrlat_id, "units", &attlen));
-      grid2_units[attlen] = 0;
-      
-      grid_to_radian(grid2_units, rg->grid2_corners*rg->grid2_size, rg->grid2_corner_lon, "grid2 corner lon"); 
-      grid_to_radian(grid2_units, rg->grid2_corners*rg->grid2_size, rg->grid2_corner_lat, "grid2 corner lat"); 
-    }
-
-  if ( rv->map_type == MAP_TYPE_CONSERV )
-    nce(nc_get_var_double(nc_file_id, nc_dstgrdarea_id, rg->grid2_area));
-
-  nce(nc_get_var_double(nc_file_id, nc_dstgrdfrac_id, rg->grid2_frac));
-
-  nce(nc_get_var_int(nc_file_id, nc_srcadd_id, rv->grid1_add));
-  nce(nc_get_var_int(nc_file_id, nc_dstadd_id, rv->grid2_add));
-
-  for ( i = 0; i < rv->num_links; i++ )
-    {
-      rv->grid1_add[i]--;
-      rv->grid2_add[i]--;
-    }
-
-  nce(nc_get_var_double(nc_file_id, nc_rmpmatrix_id, rv->wts));
-
-  /* Close input file */
-
-  nce(nc_close(nc_file_id));
-
-#else
-  cdoAbort("netCDF support not compiled in!");
-#endif
-
-  rv->links.option    = FALSE;
-  rv->links.max_links = 0;
-  rv->links.num_blks  = 0;
-  rv->links.num_links = NULL;
-  rv->links.src_add   = NULL;
-  rv->links.dst_add   = NULL;
-  rv->links.w_index   = NULL;
-}  /* read_remap_scrip */
diff --git a/src/remapsort.c b/src/remapsort.c
index 19ab522..8defb29 100644
--- a/src/remapsort.c
+++ b/src/remapsort.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -641,7 +641,7 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
 
   depth = (int) (log(parent)/log(2));
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
   /* Allow for nested parallelism */
   if ( omp_in_parallel() && depth<par_depth ) 
     {
@@ -658,7 +658,7 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
   //      printf("\n\nSplitting thread into %i!! (I AM %i) depth %i parallel_depth %i add_srt[0]%i add_srt[1] %i\n",
   //	     nsplit,parent,depth,par_depth,add_srt[0],add_srt[1]);
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( depth < par_depth ) \
         private(i, n, m, wgttmp, who_am_i)   \
         shared(weights) num_threads(2)
@@ -669,7 +669,7 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
       who_am_i = nsplit*parent+i;
       //    my_depth = (int) (log(parent)/log(2))+1;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       //      if ( 1 )
       //	printf("I am %i (parent %i), my_depth is: %i thread_num %i (%i) \n",
       //	       who_am_i,parent,my_depth,omp_get_thread_num()+1,omp_get_num_threads());
@@ -700,13 +700,13 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
                                                               /* ********************** */
   tmp = (int *) malloc(num_links*sizeof(int));
   
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( depth < par_depth ) private(i) num_threads(2)
 #endif
   for ( i = 0; i < num_links; i++ )
     tmp[i] = add1[idx[i]];
   
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( depth < par_depth ) private(i) num_threads(2)
 #endif
   for ( i = 0; i < num_links; i++ )
@@ -715,7 +715,7 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
       tmp[i] = add2[idx[i]];
     }
   
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( depth < par_depth ) private(i) num_threads(2)
 #endif
   for ( i = 0; i < num_links; i++ )
@@ -726,14 +726,14 @@ void sort_par(long num_links, long num_wts, int *restrict add1, int *restrict ad
   
   tmp2 = (double *) malloc(num_links*num_wts*sizeof(double) );
   
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( depth < par_depth ) private(i,n) num_threads(2)
 #endif
   for ( i = 0; i < num_links; i++ )
     for ( n = 0; n < num_wts; n++ )
       tmp2[num_wts*i + n] = weights[num_wts*idx[i]+n];
   
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for if ( depth < par_depth ) private(i,n) num_threads(2)
 #endif
   for ( i = 0; i < num_links; i++ )
diff --git a/src/specspace.c b/src/specspace.c
index c433fee..b089e15 100644
--- a/src/specspace.c
+++ b/src/specspace.c
@@ -65,19 +65,19 @@ void legini_old(int ntr, int nlat, double *poli, double *pold,
 
   gaussaw(gmu, gwt, nlat);
 
-#if ! defined (_OPENMP)
+#if ! defined(_OPENMP)
   pnm    = (double *) malloc(dimsp * sizeof(double));
   hnm    = (double *) malloc(dimsp * sizeof(double));
   ztemp1 = (double *) malloc((waves<<1) * sizeof(double));
   ztemp2 = (double *) malloc((waves<<1) * sizeof(double));
 #endif
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(jm, jn, jsp, gmusq, hnm, pnm, ztemp1, ztemp2)
 #endif
   for ( jgl = 0; jgl < nlat; jgl++ )
     {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       pnm    = (double *) malloc(dimsp * sizeof(double));
       hnm    = (double *) malloc(dimsp * sizeof(double));
       ztemp1 = (double *) malloc((waves<<1) * sizeof(double));
@@ -101,7 +101,7 @@ void legini_old(int ntr, int nlat, double *poli, double *pold,
                                   (PlanetRadius    * gmusq);
 	    jsp += nlat;
 	  }
-#if defined (_OPENMP)
+#if defined(_OPENMP)
       free(ztemp2);
       free(ztemp1);
       free(pnm);
@@ -109,7 +109,7 @@ void legini_old(int ntr, int nlat, double *poli, double *pold,
 #endif
     }
 
-#if ! defined (_OPENMP)
+#if ! defined(_OPENMP)
   free(ztemp2);
   free(ztemp1);
   free(pnm);
@@ -150,7 +150,7 @@ void legini(int ntr, int nlat, double *poli, double *pold, double *rcoslat)
       isp = 0;
       for ( jm = 0; jm < waves; jm++ )
 	{
-#if defined (SX)
+#if defined(SX)
 #pragma vdir nodep
 #endif
 	  for ( jn = 0; jn < waves - jm; jn++ )
@@ -414,7 +414,7 @@ void uv2dv(double *fu, double *fv, double *sd, double *sv,
   nsp2 = (nt+1)*(nt+2);
   nfc  = (nt+1)*2;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(jmm, jfc, lat, po2, po3, ful, fvl, sdl, svl, ufr, ufi, vfr, vfi, dir, dii, vor, voi)
 #endif
   for ( lev = 0; lev < klev; lev++ )
diff --git a/src/statistic.c b/src/statistic.c
index 038cfac..6d99994 100644
--- a/src/statistic.c
+++ b/src/statistic.c
@@ -1330,7 +1330,7 @@ void annihilate_1side(double **M, long i, long j, long k, long n)
   tmp = fabs(gamma/sqrt(alpha*beta));
 
   if ( tmp < fnorm_precision ) {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
     #pragma omp critical 
 #endif
     {
@@ -1421,7 +1421,7 @@ int jacobi_1side(double **M, double *A, long n)
     n_finished = 0;
     if ( n%2 == 1 ) {
       for(m=0;m<n;m++) {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 	#pragma omp parallel for private(i,idx,i_ann,j_ann) shared(M,annihilations,n) reduction(+:n_finished)
 #endif
         for(i=0;i<n/2;i++) {
@@ -1435,7 +1435,7 @@ int jacobi_1side(double **M, double *A, long n)
     }
     else { // n%2 == 0                                                                               
       for(m=0;m<n;m++) {
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 	#pragma omp parallel for private(i,idx,i_ann,j_ann) shared(M,annihilations,n) reduction(+:n_finished)
 #endif
         for(i=0;i<n/2-(m%2);i++) {
diff --git a/src/template_parser.h b/src/template_parser.h
index 9063c71..42b4dba 100644
--- a/src/template_parser.h
+++ b/src/template_parser.h
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <locale.h>
 
-#if  defined  (HAVE_LIBXML2)
+#if defined(HAVE_LIBXML2)
 #include<libxml/parser.h>
 #include<libxml/tree.h>
 
diff --git a/src/timer.c b/src/timer.c
index a465f43..2783b68 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -15,21 +15,21 @@
   GNU General Public License for more details.
 */
 
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#if defined (HAVE_SYS_TIMES_H)
+#if defined(HAVE_SYS_TIMES_H)
 #include <sys/times.h>
 #endif
 
 
 void cdoProcessTime(double *utime, double *stime)
 {
-#if defined (HAVE_SYS_TIMES_H)
+#if defined(HAVE_SYS_TIMES_H)
   struct tms tbuf;
   double clock_ticks = 0;
 
@@ -40,7 +40,7 @@ void cdoProcessTime(double *utime, double *stime)
     }
   else
     {
-#if defined (_SC_CLK_TCK)
+#if defined(_SC_CLK_TCK)
       clock_ticks = (double) sysconf(_SC_CLK_TCK);
 #endif
       if ( clock_ticks > 0 )
diff --git a/src/userlog.c b/src/userlog.c
index ca098f8..18250b5 100644
--- a/src/userlog.c
+++ b/src/userlog.c
@@ -1,4 +1,4 @@
-#if  defined  (HAVE_CONFIG_H)
+#if defined(HAVE_CONFIG_H)
 #  include "config.h"
 #endif
 
@@ -17,7 +17,7 @@
 #include "dtypes.h"
 #include "process.h"
 
-#if ! defined (VERSION)
+#if ! defined(VERSION)
 #  define  VERSION  "0.0.1"
 #endif
 
@@ -27,11 +27,11 @@
 #define  LOGOSIZE  40
 
 #undef HAVE_LOCK
-#if defined (F_UNLCK) && defined (F_RDLCK) && defined (F_WRLCK)
+#if defined(F_UNLCK) && defined(F_RDLCK) && defined(F_WRLCK)
 #define HAVE_LOCK
 #endif
 
-#if defined (HAVE_LOCK)
+#if defined(HAVE_LOCK)
 static
 void filestatus(struct flock *lock)
 {
@@ -52,8 +52,8 @@ void filestatus(struct flock *lock)
 
 void cdolog(const char *prompt, double cputime)
 {
-#if defined (HAVE_LOCK)
-#if defined (LOGPATH)
+#if defined(HAVE_LOCK)
+#if defined(LOGPATH)
 #define  XSTRING(x)	#x
 #define  STRING(x)	XSTRING(x)
   char logfilename[] = STRING(LOGPATH) "/cdo.log";
@@ -299,8 +299,8 @@ int flt2ibm(float x, unsigned char *ibm) {
 
 void cdologs(int noper)
 {
-#if defined (HAVE_LOCK)
-#if defined (LOGPATH)
+#if defined(HAVE_LOCK)
+#if defined(LOGPATH)
 #define  XSTRING(x)	#x
 #define  STRING(x)	XSTRING(x)
   char logfilename[] = STRING(LOGPATH) "/cdo.logs";
@@ -453,7 +453,7 @@ void cdologs(int noper)
 
 void dumplogs(const char *logfilename)
 {
-#if defined (HAVE_LOCK)
+#if defined(HAVE_LOCK)
   int  logfileno;
   int status;
   int date0 = 0, ncdo0, noper0, nhours0;
@@ -691,8 +691,8 @@ void monlogs(const char *logfilename)
 
 void cdologo(int noper)
 {
-#if defined (HAVE_LOCK)
-#if defined (LOGPATH)
+#if defined(HAVE_LOCK)
+#if defined(LOGPATH)
 #define  XSTRING(x)	#x
 #define  STRING(x)	XSTRING(x)
   char logfilename[] = STRING(LOGPATH) "/cdo.logo";
@@ -912,7 +912,7 @@ int cmplogname(const void *s1, const void *s2)
 
 void dumplogo(const char *logfilename, int dumptype)
 {
-#if defined (HAVE_LOCK)
+#if defined(HAVE_LOCK)
   int logfileno;
   int status;
   int nocc;
diff --git a/src/util.c b/src/util.c
index 764ba05..bf10e52 100644
--- a/src/util.c
+++ b/src/util.c
@@ -30,7 +30,7 @@ char *getProgname(char *string)
 {
   char *progname;
 
-#if defined (_WIN32)
+#if defined(_WIN32)
   /*  progname = strrchr(string, '\\'); */
   progname = " cdo";
 #else
@@ -340,6 +340,8 @@ void progressStatus(double offset, double refval, double curval)
 {
   int ival;
 
+  if ( cdoSilentMode ) return;
+
   if ( !stdout_is_tty ) return;
 
   offset = offset < 0 ? 0: offset;
diff --git a/src/vinterp.c b/src/vinterp.c
index c6cf9e0..884410b 100644
--- a/src/vinterp.c
+++ b/src/vinterp.c
@@ -100,7 +100,7 @@ void genind(int *nx, const double * restrict plev, const double * restrict fullp
 
   memset(nx, 0, ngp*nplev*sizeof(int));
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, lh, pres, nxl)
 #endif
   for ( lp = 0; lp < nplev; lp++ )
@@ -123,7 +123,7 @@ void genindmiss(int *nx, const double * restrict plev, int ngp, int nplev, const
   int *nxl;
   double pres;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, pres, nxl)
 #endif
   for ( lp = 0; lp < nplev; lp++ )
@@ -292,7 +292,7 @@ void interp_X(const double * restrict gt, double *pt, const double * restrict hy
   double *ptl;
   double pres;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, pres, nl, nh, nxl, ptl)
 #endif
   for ( lp = 0; lp < nplev; lp++ )
@@ -329,7 +329,7 @@ void interp_T(const double * restrict geop, const double * restrict gt, double *
   double *ptl;
   double pres;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, pres, nl, nh, nxl, ptl)
 #endif
   for ( lp = 0; lp < nplev; lp++ )
@@ -337,7 +337,7 @@ void interp_T(const double * restrict geop, const double * restrict gt, double *
       pres = plev[lp];
       nxl  = nx + lp*ngp;
       ptl  = pt + lp*ngp;
-#if defined (CRAY)
+#if defined(CRAY)
 #pragma _CRI inline extra_T
 #endif
       for ( i = 0; i < ngp; i++ )
@@ -352,7 +352,7 @@ void interp_T(const double * restrict geop, const double * restrict gt, double *
 		  if ( Mars )
 		    ptl[i] = gt[(nhlev-1)*ngp+i];
 		  else
-#if defined (SX)
+#if defined(SX)
 #pragma cdir inline
 #endif
 		    ptl[i] = extra_T(pres, halfp[nhlev*ngp+i],
@@ -382,7 +382,7 @@ void interp_Z(const double * restrict geop, const double * restrict gz, double *
   double *pzl;
   double pres;
 
-#if defined (_OPENMP)
+#if defined(_OPENMP)
 #pragma omp parallel for default(shared) private(i, pres, nl, nh, nxl, pzl)
 #endif
   for ( lp = 0; lp < nplev; lp++ )
@@ -390,7 +390,7 @@ void interp_Z(const double * restrict geop, const double * restrict gz, double *
       pres = plev[lp];
       nxl  = nx + lp*ngp;
       pzl  = pz + lp*ngp;
-#if defined (CRAY)
+#if defined(CRAY)
 #pragma _CRI inline extra_Z
 #endif
       for ( i = 0; i < ngp; i++ )
@@ -407,7 +407,7 @@ void interp_Z(const double * restrict geop, const double * restrict gz, double *
 		  if ( Mars )
 		    pzl[i] = gt[(nhlev-1)*ngp+i];
 		  else
-#if defined (SX)
+#if defined(SX)
 #pragma cdir inline
 #endif
 		    pzl[i] = extra_Z(pres, halfp[nhlev*ngp+i],
diff --git a/test/Makefile.am b/test/Makefile.am
index c754a4d..df43eeb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,8 +2,13 @@ CLEANFILES =
 
 export
 
-TESTS = $(top_srcdir)/test/test_info.py
+TESTS = $(top_srcdir)/test/test_Gridarea.sh \
+        $(top_srcdir)/test/test_Remap.sh \
+        $(top_srcdir)/test/test_Spectral.sh \
+        $(top_srcdir)/test/test_Timstat.sh \
+        $(top_srcdir)/test/test_Vertint.sh
 
+#       $(top_srcdir)/test/test_info.py
 #	$(top_srcdir)/test/test_diff.py
 #	$(top_srcdir)/test/test_Arith.py
 #	$(top_srcdir)/test/test_Arithc.py
@@ -14,6 +19,8 @@ EXTRA_DIST = $(TESTS) $(top_srcdir)/test/testStreams.py
 
 CDO   = $(top_builddir)/src/cdo
 
+DATAPATH   = $(top_srcdir)/test/data
+
 PYTHONPATH = $(top_srcdir)/contrib/python:$(top_srcdir)/test
 
 listTests:
@@ -24,3 +31,5 @@ test: $(TESTS)
 .PHONY: $(TESTS)
 
 CLEANFILES += `ls *.pyc`
+
+AUTOMAKE_OPTIONS = color-tests
diff --git a/test/Makefile.in b/test/Makefile.in
index fee302a..6c7e84c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -71,8 +71,21 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+# If stdout is a non-dumb tty, use colors.  If test -t is not supported,
+# then this fails; a conservative approach.  Of course do not redirect
+# stdout here, just stderr.
 am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
+red=; grn=; lgn=; blu=; std=; \
+test "X$(AM_COLOR_TESTS)" != Xno \
+&& test "X$$TERM" != Xdumb \
+&& { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
+&& { \
+  red=''; \
+  grn=''; \
+  lgn=''; \
+  blu=''; \
+  std=''; \
+}
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -89,6 +102,8 @@ CLDFLAGS = @CLDFLAGS@
 CLIBS = @CLIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CURL_INCLUDE = @CURL_INCLUDE@
+CURL_LDFLAGS = @CURL_LDFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -236,8 +251,14 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 CLEANFILES = `ls *.pyc`
-TESTS = $(top_srcdir)/test/test_info.py
+TESTS = $(top_srcdir)/test/test_Gridarea.sh \
+        $(top_srcdir)/test/test_Remap.sh \
+        $(top_srcdir)/test/test_Spectral.sh \
+        $(top_srcdir)/test/test_Timstat.sh \
+        $(top_srcdir)/test/test_Vertint.sh
 
+
+#       $(top_srcdir)/test/test_info.py
 #	$(top_srcdir)/test/test_diff.py
 #	$(top_srcdir)/test/test_Arith.py
 #	$(top_srcdir)/test/test_Arithc.py
@@ -245,7 +266,9 @@ TESTS = $(top_srcdir)/test/test_info.py
 #	$(top_srcdir)/test/test_intgridbil.py
 EXTRA_DIST = $(TESTS) $(top_srcdir)/test/testStreams.py
 CDO = $(top_builddir)/src/cdo
+DATAPATH = $(top_srcdir)/test/data
 PYTHONPATH = $(top_srcdir)/contrib/python:$(top_srcdir)/test
+AUTOMAKE_OPTIONS = color-tests
 all: all-am
 
 .SUFFIXES:
diff --git a/test/data/Makefile.am b/test/data/Makefile.am
new file mode 100644
index 0000000..081892b
--- /dev/null
+++ b/test/data/Makefile.am
@@ -0,0 +1,8 @@
+INPUTDATA = ts_mm_5years hl_l19.grb t21_geosp_tsurf.grb bathy4.grb
+
+TIMSTAT_REF  = timmin_ref timmax_ref timsum_ref timavg_ref timmean_ref timstd_ref timstd1_ref timvar_ref timvar1_ref
+SPECTRAL_REF = sp2gp_ref sp2gpl_ref gp2sp_ref gp2spl_ref
+VERTINT_REF  = ml2pl_ref
+REMAP_REF    = n16_bic_ref n16_bil_ref n16_con_ref n16_laf_ref n16_nn_ref  n32_bic_ref n32_bil_ref n32_con_ref n32_laf_ref n32_nn_ref
+
+EXTRA_DIST = $(INPUTDATA) $(TIMSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF)
diff --git a/contrib/Makefile.in b/test/data/Makefile.in
similarity index 88%
copy from contrib/Makefile.in
copy to test/data/Makefile.in
index 0ef17c3..b491ffa 100644
--- a/contrib/Makefile.in
+++ b/test/data/Makefile.in
@@ -50,9 +50,8 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
- at MAINTAINER_MODE_TRUE@am__append_1 = `ls cdoCompletion.*`
-subdir = contrib
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING
+subdir = test/data
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
 	$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -88,6 +87,8 @@ CLDFLAGS = @CLDFLAGS@
 CLIBS = @CLIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CURL_INCLUDE = @CURL_INCLUDE@
+CURL_LDFLAGS = @CURL_LDFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -234,8 +235,12 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXTRA_DIST = makecompl.rb cdoCompletion.bash cdoCompletion.tcsh cdoCompletion.zsh python/cdo.py
-CLEANFILES = $(am__append_1)
+INPUTDATA = ts_mm_5years hl_l19.grb t21_geosp_tsurf.grb bathy4.grb
+TIMSTAT_REF = timmin_ref timmax_ref timsum_ref timavg_ref timmean_ref timstd_ref timstd1_ref timvar_ref timvar1_ref
+SPECTRAL_REF = sp2gp_ref sp2gpl_ref gp2sp_ref gp2spl_ref
+VERTINT_REF = ml2pl_ref
+REMAP_REF = n16_bic_ref n16_bil_ref n16_con_ref n16_laf_ref n16_nn_ref  n32_bic_ref n32_bil_ref n32_con_ref n32_laf_ref n32_nn_ref
+EXTRA_DIST = $(INPUTDATA) $(TIMSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF)
 all: all-am
 
 .SUFFIXES:
@@ -248,9 +253,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/data/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu contrib/Makefile
+	  $(AUTOMAKE) --gnu test/data/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -314,8 +319,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
- at MAINTAINER_MODE_FALSE@all-local:
-all-am: Makefile all-local
+all-am: Makefile
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -339,7 +343,6 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -416,33 +419,17 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: all all-am all-local check check-am clean clean-generic \
-	clean-libtool distclean distclean-generic distclean-libtool \
-	distdir dvi dvi-am html html-am info info-am install \
-	install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	uninstall uninstall-am
-
-
-completions:
-	if (hash ruby &> /dev/null) ; then \
-	  ruby -KN $(srcdir)/makecompl.rb -o cdoCompletion; \
-	fi
-
-test:
-	if (hash ruby &> /dev/null) ; then \
-	    (cd ruby;ruby test/test_cdo.rb) \
-	fi
-	if (hash python &> /dev/null) ; then \
-	    (cd python; python test/test_cdo.py) \
-	fi
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
 
- at MAINTAINER_MODE_TRUE@all-local: completions
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/test/data/bathy4.grb b/test/data/bathy4.grb
new file mode 100644
index 0000000..0191254
Binary files /dev/null and b/test/data/bathy4.grb differ
diff --git a/test/data/gp2sp_ref b/test/data/gp2sp_ref
new file mode 100644
index 0000000..851af5d
Binary files /dev/null and b/test/data/gp2sp_ref differ
diff --git a/test/data/gp2spl_ref b/test/data/gp2spl_ref
new file mode 100644
index 0000000..33ea2ce
Binary files /dev/null and b/test/data/gp2spl_ref differ
diff --git a/test/data/hl_l19.grb b/test/data/hl_l19.grb
new file mode 100644
index 0000000..2f4b2d7
Binary files /dev/null and b/test/data/hl_l19.grb differ
diff --git a/test/data/ml2pl_ref b/test/data/ml2pl_ref
new file mode 100644
index 0000000..f4d572c
Binary files /dev/null and b/test/data/ml2pl_ref differ
diff --git a/test/data/n16_bic_ref b/test/data/n16_bic_ref
new file mode 100644
index 0000000..aeb2ae3
Binary files /dev/null and b/test/data/n16_bic_ref differ
diff --git a/test/data/n16_bil_ref b/test/data/n16_bil_ref
new file mode 100644
index 0000000..46b3803
Binary files /dev/null and b/test/data/n16_bil_ref differ
diff --git a/test/data/n16_con_ref b/test/data/n16_con_ref
new file mode 100644
index 0000000..98e1b6a
Binary files /dev/null and b/test/data/n16_con_ref differ
diff --git a/test/data/n16_laf_ref b/test/data/n16_laf_ref
new file mode 100644
index 0000000..a819e64
Binary files /dev/null and b/test/data/n16_laf_ref differ
diff --git a/test/data/n16_nn_ref b/test/data/n16_nn_ref
new file mode 100644
index 0000000..88a5575
Binary files /dev/null and b/test/data/n16_nn_ref differ
diff --git a/test/data/n32_bic_ref b/test/data/n32_bic_ref
new file mode 100644
index 0000000..4d3c2b5
Binary files /dev/null and b/test/data/n32_bic_ref differ
diff --git a/test/data/n32_bil_ref b/test/data/n32_bil_ref
new file mode 100644
index 0000000..1cd7d13
Binary files /dev/null and b/test/data/n32_bil_ref differ
diff --git a/test/data/n32_con_ref b/test/data/n32_con_ref
new file mode 100644
index 0000000..40ae198
Binary files /dev/null and b/test/data/n32_con_ref differ
diff --git a/test/data/n32_laf_ref b/test/data/n32_laf_ref
new file mode 100644
index 0000000..998a2f2
Binary files /dev/null and b/test/data/n32_laf_ref differ
diff --git a/test/data/n32_nn_ref b/test/data/n32_nn_ref
new file mode 100644
index 0000000..e63794f
Binary files /dev/null and b/test/data/n32_nn_ref differ
diff --git a/test/data/sp2gp_ref b/test/data/sp2gp_ref
new file mode 100644
index 0000000..42d0237
Binary files /dev/null and b/test/data/sp2gp_ref differ
diff --git a/test/data/sp2gpl_ref b/test/data/sp2gpl_ref
new file mode 100644
index 0000000..19baf00
Binary files /dev/null and b/test/data/sp2gpl_ref differ
diff --git a/test/data/t21_geosp_tsurf.grb b/test/data/t21_geosp_tsurf.grb
new file mode 100644
index 0000000..339cbd5
Binary files /dev/null and b/test/data/t21_geosp_tsurf.grb differ
diff --git a/test/data/timavg_ref b/test/data/timavg_ref
new file mode 100644
index 0000000..943bd5b
Binary files /dev/null and b/test/data/timavg_ref differ
diff --git a/test/data/timmax_ref b/test/data/timmax_ref
new file mode 100644
index 0000000..8f37f19
Binary files /dev/null and b/test/data/timmax_ref differ
diff --git a/test/data/timmean_ref b/test/data/timmean_ref
new file mode 100644
index 0000000..943bd5b
Binary files /dev/null and b/test/data/timmean_ref differ
diff --git a/test/data/timmin_ref b/test/data/timmin_ref
new file mode 100644
index 0000000..ac70eba
Binary files /dev/null and b/test/data/timmin_ref differ
diff --git a/test/data/timstd1_ref b/test/data/timstd1_ref
new file mode 100644
index 0000000..2731aa8
Binary files /dev/null and b/test/data/timstd1_ref differ
diff --git a/test/data/timstd_ref b/test/data/timstd_ref
new file mode 100644
index 0000000..90f4540
Binary files /dev/null and b/test/data/timstd_ref differ
diff --git a/test/data/timsum_ref b/test/data/timsum_ref
new file mode 100644
index 0000000..3e40bdb
Binary files /dev/null and b/test/data/timsum_ref differ
diff --git a/test/data/timvar1_ref b/test/data/timvar1_ref
new file mode 100644
index 0000000..9374806
Binary files /dev/null and b/test/data/timvar1_ref differ
diff --git a/test/data/timvar_ref b/test/data/timvar_ref
new file mode 100644
index 0000000..cefe9a5
Binary files /dev/null and b/test/data/timvar_ref differ
diff --git a/test/data/ts_mm_5years b/test/data/ts_mm_5years
new file mode 100644
index 0000000..ca4f161
Binary files /dev/null and b/test/data/ts_mm_5years differ
diff --git a/test/test_Gridarea.sh b/test/test_Gridarea.sh
new file mode 100755
index 0000000..8f06177
--- /dev/null
+++ b/test/test_Gridarea.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+CDODEBUG=0
+#
+if [ "$CDODEBUG" = 0 ]; then CDO="$CDO -s"; fi
+CDOOUT=cout
+CDOERR=cerr
+REFVAL="12.5663706"
+GRIDS="global_5 global_2 global_1 global_.5 n32 n80 n160"
+RSTAT=0;
+PLANET_RADIUS=1
+export PLANET_RADIUS
+#
+for GRID in $GRIDS; do
+  GLOBAREA=`$CDO outputf,%10.7f -fldsum -gridarea -random,$GRID`
+#  echo "$GRID: >$GLOBAREA< >$REFVAL<"
+  if [ "$GLOBAREA" != "$REFVAL" ]; then RSTAT=`expr $RSTAT + 1`; fi
+done
+#
+rm -f $CDOOUT $CDOERR
+unset PLANET_RADIUS
+#
+if [ "$CDODEBUG" = 1 ]; then
+  echo "rstat: $RSTAT"
+fi
+#
+exit $RSTAT
diff --git a/test/test_Remap.sh b/test/test_Remap.sh
new file mode 100755
index 0000000..499e779
--- /dev/null
+++ b/test/test_Remap.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+#CDO=cdo
+#DATAPATH=data
+#
+CDODEBUG=0
+#
+if [ "$CDODEBUG" = 0 ]; then CDO="$CDO -s"; fi
+CDOOUT=cout
+CDOERR=cerr
+FORMAT="-f srv -b 32"
+GRIDS="n16 n32"
+RSTAT=0;
+#
+IFILE=$DATAPATH/bathy4.grb
+#
+for GRIDTYPE in " " "-setgridtype,curvilinear" "-setgridtype,unstructured"; do
+  for GRID in $GRIDS; do
+# remaplaf: sort could give different results"
+    RMODS="bil bic nn con"
+    if [ "$GRIDTYPE" = "-setgridtype,unstructured" ]; then RMODS="nn con"; fi
+    for RMOD in $RMODS; do
+      OFILE=${GRID}_${RMOD}
+      RFILE=$DATAPATH/${OFILE}_ref
+      $CDO $FORMAT remap${RMOD},$GRID $GRIDTYPE $IFILE ${OFILE} > $CDOOUT 2> $CDOERR
+      if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+      if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+      $CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+      if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+      if [ -s $CDOOUT ] ; then RSTAT=`expr $RSTAT + 1`; fi
+      if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+      rm -f $OFILE
+    done
+  done
+done
+#
+rm -f $CDOOUT $CDOERR
+#
+if [ "$CDODEBUG" = 1 ]; then
+  echo "rstat: $RSTAT"
+fi
+#
+exit $RSTAT
diff --git a/test/test_Spectral.sh b/test/test_Spectral.sh
new file mode 100755
index 0000000..29d3fc3
--- /dev/null
+++ b/test/test_Spectral.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+CDODEBUG=0
+#
+if [ "$CDODEBUG" = 0 ]; then CDO="$CDO -s"; fi
+CDOOUT=cout
+CDOERR=cerr
+FORMAT=""
+RSTAT=0;
+#
+IFILE=$DATAPATH/t21_geosp_tsurf.grb
+RFILE=$DATAPATH/gp2sp_ref
+OFILE=gp2sp_res
+$CDO $FORMAT gp2sp $IFILE $OFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+$CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ -s $CDOOUT ] ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+rm -f $OFILE
+#
+IFILE=$DATAPATH/gp2sp_ref
+RFILE=$DATAPATH/sp2gp_ref
+OFILE=sp2gp_res
+$CDO $FORMAT sp2gp $IFILE $OFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+$CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ -s $CDOOUT ] ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+rm -f $OFILE
+#
+IFILE=$DATAPATH/t21_geosp_tsurf.grb
+RFILE=$DATAPATH/gp2spl_ref
+OFILE=gp2spl_res
+$CDO $FORMAT gp2spl $IFILE $OFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+$CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ -s $CDOOUT ] ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+rm -f $OFILE
+#
+IFILE=$DATAPATH/gp2spl_ref
+RFILE=$DATAPATH/sp2gpl_ref
+OFILE=sp2gpl_res
+$CDO $FORMAT sp2gpl $IFILE $OFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+$CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ -s $CDOOUT ] ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+rm -f $OFILE
+#
+rm -f $CDOOUT $CDOERR
+#
+if [ "$CDODEBUG" = 1 ]; then
+  echo "rstat: $RSTAT"
+fi
+#
+exit $RSTAT
diff --git a/test/test_Timstat.sh b/test/test_Timstat.sh
new file mode 100755
index 0000000..c85dbd5
--- /dev/null
+++ b/test/test_Timstat.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+CDODEBUG=0
+#
+if [ "$CDODEBUG" = 0 ]; then CDO="$CDO -s"; fi
+CDOOUT=cout
+CDOERR=cerr
+STATS="min max sum avg mean std std1 var var1"
+RSTAT=0;
+#
+IFILE=$DATAPATH/ts_mm_5years
+#
+for STAT in $STATS; do
+  RFILE=$DATAPATH/tim${STAT}_ref
+  OFILE=tim${STAT}_res
+  $CDO tim${STAT} $IFILE $OFILE > $CDOOUT 2> $CDOERR
+  if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+  if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+  $CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+  if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+  if [ -s $CDOOUT ] ; then RSTAT=`expr $RSTAT + 1`; fi
+  if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+  rm -f $OFILE
+done
+#
+rm -f $CDOOUT $CDOERR
+#
+if [ "$CDODEBUG" = 1 ]; then
+  echo "rstat: $RSTAT"
+fi
+#
+exit $RSTAT
diff --git a/test/test_Vertint.sh b/test/test_Vertint.sh
new file mode 100755
index 0000000..3c9e63e
--- /dev/null
+++ b/test/test_Vertint.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+CDODEBUG=0
+#
+if [ "$CDODEBUG" = 0 ]; then CDO="$CDO -s"; fi
+CDOOUT=cout
+CDOERR=cerr
+FORMAT="-f srv -b 32"
+RSTAT=0;
+#
+IFILE=$DATAPATH/hl_l19.grb
+#
+RFILE=$DATAPATH/ml2pl_ref
+OFILE=ml2pl_res
+$CDO $FORMAT ml2pl,92500,85000,50000,20000 $IFILE $OFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+$CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
+if [ $? != 0 ]    ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ -s $CDOOUT ] ; then RSTAT=`expr $RSTAT + 1`; fi
+if [ "$CDODEBUG" = 1 ]; then cat $CDOOUT $CDOERR; fi
+rm -f $OFILE
+#
+rm -f $CDOOUT $CDOERR
+#
+if [ "$CDODEBUG" = 1 ]; then
+  echo "rstat: $RSTAT"
+fi
+#
+exit $RSTAT
diff --git a/test/test_info.py b/test/test_info.py
deleted file mode 100755
index 15fc3d1..0000000
--- a/test/test_info.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-import unittest
-from cdo import *
-
-
-class TestInfo(unittest.TestCase):
-
-    # check operators: (s)infov,showlevel
-    def test_info(self):
-        cdo  = Cdo()
-
-        info = cdo.sinfo(input = "-stdatm,0")
-        self.assertEqual("File format: GRIB",info[0])
-
-        sinfov = cdo.sinfov(input = "-stdatm,0,10,20,50,100,500,1000",options = "-f nc")
-        self.assertEqual("P",sinfov[2].split(' ')[-1])
-        self.assertEqual("T",sinfov[3].split(' ')[-1])
-
-        infov  = cdo.infov( input = "-stdatm,0,10,20,50,100,500,1000",options = "-f nc")
-        self.assertEqual("1013.2", infov[1].split(' ')[-15])
-        self.assertEqual("T", infov[-1].split(' ')[-1])
-
-        units  = cdo.showunit( input = "-stdatm,0", options = "-f nc")
-        self.assertEqual(["hPa","K"],units[0].split(' '))
-
-        levels = cdo.showlevel(input = "-stdatm,0")
-        self.assertEqual([0,0],map(float,levels))
-        levels = cdo.showlevel(input = "-stdatm,10,20,30")[0].split(' ')
-        self.assertEqual([10,20,30],map(float,levels))
-
-        code = cdo.showcode(input="-topo,r1x1")
-        self.assertEqual("-1",code[0])
-        code = cdo.showcode(input="-setcode,111 -topo,r1x1")
-        self.assertEqual("111",code[0])
-
-if __name__ == '__main__':
-    unittest.main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cdo.git



More information about the debian-science-commits mailing list