source: XIOS/dev/dev_olga/src/node/axis.hpp @ 987

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

First working version.
There are more things to do with it

  • 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
  • Property svn:executable set to *
File size: 6.7 KB
RevLine 
[591]1#ifndef __XIOS_CAxis__
2#define __XIOS_CAxis__
[219]3
[591]4/// XIOS headers ///
5#include "xios_spl.hpp"
[219]6#include "group_factory.hpp"
[619]7#include "virtual_node.hpp"
[219]8
9#include "declare_group.hpp"
[540]10#include "declare_ref_func.hpp"
[619]11#include "declare_virtual_node.hpp"
[369]12#include "attribute_array.hpp"
[399]13#include "attribute_enum.hpp"
14#include "attribute_enum_impl.hpp"
[567]15#include "server_distribution_description.hpp"
[619]16#include "transformation.hpp"
17#include "transformation_enum.hpp"
[219]18
[335]19namespace xios {
[219]20   /// ////////////////////// Déclarations ////////////////////// ///
21
22   class CAxisGroup;
23   class CAxisAttributes;
24   class CAxis;
25
26   ///--------------------------------------------------------------
27
28   // Declare/Define CAxisAttribute
29   BEGIN_DECLARE_ATTRIBUTE_MAP(CAxis)
[231]30#  include "axis_attribute.conf"
[821]31#  include "axis_attribute_private.conf"
[219]32   END_DECLARE_ATTRIBUTE_MAP(CAxis)
33
34   ///--------------------------------------------------------------
35
36   class CAxis
37      : public CObjectTemplate<CAxis>
38      , public CAxisAttributes
39   {
[987]40               /// typedef ///
41         typedef CObjectTemplate<CAxis>   SuperClass;
42         typedef CAxisAttributes SuperClassAttribute;
43         
44      public :
[567]45         enum EEventId
46         {
[633]47           EVENT_ID_SERVER_ATTRIBUT,
48           EVENT_ID_INDEX,
49           EVENT_ID_DISTRIBUTED_VALUE,
50           EVENT_ID_NON_DISTRIBUTED_VALUE
[567]51         } ;
52
[219]53
[987]54
[219]55      public :
56
57         typedef CAxisAttributes RelAttributes;
58         typedef CAxisGroup      RelGroup;
[621]59         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
[219]60
[621]61      public:
[219]62         /// Constructeurs ///
63         CAxis(void);
64         explicit CAxis(const StdString & id);
65         CAxis(const CAxis & axis);       // Not implemented yet.
66         CAxis(const CAxis * const axis); // Not implemented yet.
67
[622]68         static CAxis* createAxis();
69
[219]70         /// Accesseurs ///
71         const std::set<StdString> & getRelFiles(void) const;
72
[676]73         const std::vector<int>& getIndexesToWrite(void) const;
74         int getNumberWrittenIndexes() const;
75         int getTotalNumberWrittenIndexes() const;
76         int getOffsetWrittenIndexes() const;
77
[731]78         std::map<int, StdSize> getAttributesBufferSize();
79
[219]80         /// Test ///
81         bool IsWritten(const StdString & filename) const;
[676]82         bool isWrittenCompressed(const StdString& filename) const;
[594]83         bool isDistributed(void) const;
[676]84         bool isCompressible(void) const;
[219]85
86         /// Mutateur ///
87         void addRelFile(const StdString & filename);
[676]88         void addRelFileCompressed(const StdString& filename);
[219]89
90         /// Vérifications ///
91         void checkAttributes(void);
92
93         /// Destructeur ///
94         virtual ~CAxis(void);
95
[619]96         virtual void parse(xml::CXMLNode & node);
97
[219]98         /// Accesseurs statiques ///
99         static StdString GetName(void);
100         static StdString GetDefName(void);
101         static ENodeType GetType(void);
102
[595]103         void sendServerAttribut(const std::vector<int>& globalDim, int orderPositionInGrid,
104                                 CServerDistributionDescription::ServerDistributionType distType);
[567]105         static bool dispatchEvent(CEventServer& event);
106         static void recvServerAttribut(CEventServer& event);
107         void recvServerAttribut(CBufferIn& buffer) ;
[742]108         void checkAttributesOnClient();
[927]109         void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid,
110                                                         CServerDistributionDescription::ServerDistributionType distType = CServerDistributionDescription::BAND_DISTRIBUTION);
[567]111         void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
112                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION);
[619]113
[676]114         void checkEligibilityForCompressedOutput();
115
[619]116         bool hasTransformation();
117         void solveInheritanceTransformation();
[621]118         TransMapTypes getAllTransformations();
[775]119         void fillInValues(const CArray<double,1>& values);
[836]120         void duplicateTransformation(CAxis*);
121         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
[619]122
[567]123      public:
124        int zoom_begin_srv, zoom_end_srv, zoom_size_srv;
125        int ni_srv, begin_srv, end_srv;
[633]126        CArray<double,1> value_srv;
127        CArray<double,2> bound_srv;
[816]128        bool hasValue;
[987]129        CArray<int,1> globalDimGrid;
130        int orderPosInGrid;
[676]131
132      private:
[551]133         void checkData();
134         void checkMask();
[631]135         void checkZoom();
[633]136         void checkBounds();
[621]137         void checkTransformations();
[927]138         void sendValue();
[815]139         void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid,
140                                     CServerDistributionDescription::ServerDistributionType distType);
[633]141         void sendDistributedValue();
142         void sendNonDistributedValue();
[595]143
[633]144         static void recvIndex(CEventServer& event);
145         static void recvDistributedValue(CEventServer& event);
146         static void recvNonDistributedValue(CEventServer& event);
147         void recvIndex(int rank, CBufferIn& buffer);
148         void recvDistributedValue(int rank, CBufferIn& buffer);
149         void recvNonDistributedValue(int rank, CBufferIn& buffer);
[619]150
[621]151         void setTransformations(const TransMapTypes&);
[676]152
[567]153      private:
[219]154         bool isChecked;
[567]155         bool areClientAttributesChecked_;
[927]156         bool isClientAfterTransformationChecked;
[676]157         std::set<StdString> relFiles, relFilesCompressed;
[621]158         TransMapTypes transformationMap_;
[594]159         bool isDistributed_;
[676]160         //! True if and only if the data defined on the axis can be outputted in a compressed way
161         bool isCompressible_;
[633]162         std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server
163         std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server
[676]164         std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
165         std::vector<int> indexesToWrite;
166         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
[633]167         std::vector<int> connectedServerRank_;
168         std::map<int, CArray<int,1> > indiSrv_;
169         bool hasBounds_;
[836]170
171       private:
172         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
173         static std::map<StdString, ETranformationType> transformationMapList_;
174         static bool dummyTransformationMapList_;
175
[540]176         DECLARE_REF_FUNC(Axis,axis)
[219]177   }; // class CAxis
178
179   ///--------------------------------------------------------------
180
181   // Declare/Define CAxisGroup and CAxisDefinition
182   DECLARE_GROUP(CAxis);
[335]183} // namespace xios
[219]184
[591]185#endif // __XIOS_CAxis__
Note: See TracBrowser for help on using the repository browser.