source: XIOS/trunk/src/io/nc4_data_input.hpp @ 775

Last change on this file since 775 was 775, checked in by mhnguyen, 8 years ago

Implementing the reading of attributes of an axis from a file

+) 3d grid can be read directly from a file
+) Clean some redundant codes
+) Add new attribute declaration that allows to output only desired attributes

Test
+) On Curie
+) test_remap passes and result is correct

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.4 KB
Line 
1#ifndef __XIOS_NC4_DATA_INPUT__
2#define __XIOS_NC4_DATA_INPUT__
3
4/// XIOS headers ///
5#include "xios_spl.hpp"
6#include "data_input.hpp"
7#include "inetcdf4.hpp"
8
9namespace xios
10{
11  class CDomain;
12  class CAxis;
13
14  class CNc4DataInput
15    : protected CINetCDF4
16    , public virtual CDataInput
17  {
18  public:
19    /// Type definitions ///
20    typedef CINetCDF4  SuperClassWriter;
21    typedef CDataInput SuperClass;
22
23    /// Constructors ///
24    CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective = true);
25    CNc4DataInput(const CNc4DataInput& dataInput);       // Not implemented.
26    CNc4DataInput(const CNc4DataInput* const dataInput); // Not implemented.
27
28    /// Destructor ///
29    virtual ~CNc4DataInput(void);
30
31    /// Getters ///
32    const StdString& getFileName(void) const;
33
34  protected:
35    // Read methods
36    virtual StdSize getFieldNbRecords_(CField* field);
37    virtual void readFieldData_(CField* field);
38    virtual void readFieldAttributes_(CField* field, bool readAttributeValues);
39    virtual void closeFile_(void);
40
41  private:
42    void readDomainAttributesFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap,
43                                      int elementPosition, const StdString& fieldId);
44    void readDomainAttributeValueFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap,
45                                          int elementPosition, const StdString& fieldId);
46
47    void readAxisAttributesFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap,
48                                    int elementPosition, const StdString& fieldId);
49    void readAxisAttributeValueFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap,
50                                        int elementPosition, const StdString& fieldId);
51
52    void readFieldVariableValue(CArray<double,1>& var, const StdString& varId,
53                                const std::vector<StdSize>& nBegin,
54                                const std::vector<StdSize>& nSize,
55                                bool forceIndependent = false);
56
57  private:
58    std::set<StdString> readMetaDataDomains_, readValueDomains_;
59    std::set<StdString> readMetaDataAxis_, readValueAxis_;
60
61  private:
62    /// Private attributes ///
63    MPI_Comm comm_file;
64    const StdString filename;
65    bool isCollective;
66  }; // class CNc4DataInput
67} // namespace xios
68
69#endif //__XIOS_NC4_DATA_INPUT__
Note: See TracBrowser for help on using the repository browser.