source: XMLIO_V2/dev/dev_rv/src4/xmlio/main_server.cpp @ 229

Last change on this file since 229 was 229, checked in by hozdoba, 13 years ago
File size: 3.6 KB
Line 
1/* ************************************************************************** *
2 *      Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011         *
3 * ************************************************************************** */
4/**
5 * \file    main_server.cpp
6 * \brief   Programme principal du projet.
7 * \author  Hervé Ozdoba
8 * \version 0.4
9 * \date    1er Juin 2011
10 *
11 * Ce fichier contient le point d'entrée du programme permettant
12 * de lancer le serveur d'Entrée/Sortie parallÚle.
13 */
14
15// XMLIOServer headers
16#include "xmlioserver_spl.hpp"
17
18#include "inetcdf4.hpp"
19#include "inetcdf4_impl.hpp"
20#include "inetcdf4_adv.hpp"
21#include "inetcdf4_adv_impl.hpp"
22#include "lscereader.hpp"
23
24namespace xios = xmlioserver;
25//~ using namespace xios::data;
26using namespace xios::io;
27//~ using namespace xios::tree;
28//~ using namespace xios::xml;
29//~ using namespace xios::comm;
30//~ using namespace xios::func;
31using namespace xios::vtk;
32
33// Point d'entrée du programme serveur principal.
34int main (int XIOS_UNUSED (argc), char ** XIOS_UNUSED (argv), char ** XIOS_UNUSED (env))
35{
36   try
37   {
38       std::cout << "Test input"  << std::endl;
39       CINetCDF4Adv file_coslatgrid("test/vtk/file_coslatgrid.nc4");
40       CINetCDF4Adv file_xboundsybounds("test/vtk/file_xboundsybounds.nc4");
41       CINetCDF4Adv sampleCurveGrid4("test/vtk/sampleCurveGrid4.nc4");
42       CINetCDF4Adv sampleGenGrid3("test/vtk/sampleGenGrid3.nc4");
43       CINetCDF4Adv ucov("test/vtk/ucov.nc4");
44       
45       std::vector<CINetCDF4Adv*> listinput;
46       listinput.push_back(&file_coslatgrid);
47       listinput.push_back(&file_xboundsybounds);
48       listinput.push_back(&sampleCurveGrid4);
49       listinput.push_back(&sampleGenGrid3);
50       listinput.push_back(&ucov);
51       std::vector<CINetCDF4Adv*>::iterator it = listinput.begin(), end = listinput.end();
52       
53       for (; it != end; it++)
54       {
55           std::cout << "-------------" << std::endl;
56           std::map<std::string, std::size_t> dims = (*it)->getDimensions();
57           std::map<std::string, std::size_t>::iterator it0 = dims.begin(), end0 = dims.end();
58           
59           for (; it0 != end0; it0++)
60           {
61               std::cout << "dimensions " << it0->first << " : " << it0->second << std::endl;
62           }
63           
64           std::vector<std::string> vars = (*it)->getVariables();
65           std::vector<std::string>::iterator it1 = vars.begin(), end1 = vars.end();
66           for (; it1 != end1; it1++)
67           {
68               std::map<std::string, std::size_t> dims = (*it)->getDimensions(&(*it1));
69               std::map<std::string, std::size_t>::iterator it3 = dims.begin(), end3 = dims.end();
70
71               std::cout << "Variable " << *it1 << " [";
72               for (; it3 != end3; it3++)
73               {
74                   std::cout << it3->first << ":" << it3->second << " ";
75               }
76               std::cout << "] :" << std::endl;
77           }
78       }
79       
80       boost::multi_array<float, 1> data;
81       file_coslatgrid.readData(data, "NTEMP", 1);
82       std::cout << data.size() << std::endl;
83
84       
85       //vtkLSCEReader::ShowVariable("test/vtk/file_coslatgrid.nc4", "NTEMP");
86       //vtkLSCEReader::ShowVariable("test/vtk/ucov.nc4", "ucov");
87       vtkLSCEReader::ShowVariable("test/vtk/sampleCurveGrid4.nc4", "sample");
88       //vtkLSCEReader::ShowVariable("test/vtk/sampleGenGrid3.nc4", "sample");
89       //vtkLSCEReader::ShowVariable("test/vtk/file_xboundsybounds.nc4", "A");
90       
91
92   }
93   catch (xios::CException & _exception)
94   {
95      std::cerr << _exception.getMessage() << std::endl;
96      return (-1);
97   }
98   return (0);
99}
100
101
Note: See TracBrowser for help on using the repository browser.