source: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp @ 1847

Last change on this file since 1847 was 1847, checked in by ymipsl, 4 years ago

XIOS_COUPLING branch : more comments and cleaning

YM

  • 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: 7.6 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"
[219]31   END_DECLARE_ATTRIBUTE_MAP(CAxis)
32
33   ///--------------------------------------------------------------
34
35   class CAxis
36      : public CObjectTemplate<CAxis>
37      , public CAxisAttributes
38   {
[987]39               /// typedef ///
40         typedef CObjectTemplate<CAxis>   SuperClass;
41         typedef CAxisAttributes SuperClassAttribute;
42         
[1235]43      public:
[567]44         enum EEventId
45         {
[1144]46           EVENT_ID_DISTRIBUTION_ATTRIBUTE,           
[633]47           EVENT_ID_DISTRIBUTED_VALUE,
[1025]48           EVENT_ID_NON_DISTRIBUTED_VALUE,
49           EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES,
50           EVENT_ID_DISTRIBUTED_ATTRIBUTES
[567]51         } ;
52
[1235]53      public:
[219]54         typedef CAxisAttributes RelAttributes;
55         typedef CAxisGroup      RelGroup;
[621]56         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
[219]57
[621]58      public:
[219]59         /// Constructeurs ///
60         CAxis(void);
61         explicit CAxis(const StdString & id);
62         CAxis(const CAxis & axis);       // Not implemented yet.
63         CAxis(const CAxis * const axis); // Not implemented yet.
64
[622]65         static CAxis* createAxis();
[1158]66
67         /// Accesseurs ///
68         const std::set<StdString> & getRelFiles(void) const;
69
[1639]70         int getNumberWrittenIndexes(MPI_Comm writtenCom);
71         int getTotalNumberWrittenIndexes(MPI_Comm writtenCom);
72         int getOffsetWrittenIndexes(MPI_Comm writtenCom);
73         CArray<int, 1>& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom);
[676]74
[1371]75         std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid,
76                                                        CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION);
[731]77
[219]78         /// Test ///
79         bool IsWritten(const StdString & filename) const;
[676]80         bool isWrittenCompressed(const StdString& filename) const;
[594]81         bool isDistributed(void) const;
[676]82         bool isCompressible(void) const;
[219]83
84         /// Mutateur ///
85         void addRelFile(const StdString & filename);
[676]86         void addRelFileCompressed(const StdString& filename);
[219]87
88         /// Vérifications ///
89         void checkAttributes(void);
90
91         /// Destructeur ///
92         virtual ~CAxis(void);
93
[619]94         virtual void parse(xml::CXMLNode & node);
95
[1345]96         void setContextClient(CContextClient* contextClient);
97
[219]98         /// Accesseurs statiques ///
99         static StdString GetName(void);
100         static StdString GetDefName(void);
101         static ENodeType GetType(void);
102
[1235]103         static bool dispatchEvent(CEventServer& event);         
104         
[742]105         void checkAttributesOnClient();
[927]106         void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid,
107                                                         CServerDistributionDescription::ServerDistributionType distType = CServerDistributionDescription::BAND_DISTRIBUTION);
[567]108         void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
109                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION);
[619]110
[676]111         void checkEligibilityForCompressedOutput();
[1215]112         size_t getGlobalWrittenSize(void) ;
[676]113
[1129]114         void computeWrittenIndex();
[1639]115         void computeWrittenCompressedIndex(MPI_Comm);
[619]116         bool hasTransformation();
117         void solveInheritanceTransformation();
[1144]118         TransMapTypes getAllTransformations();         
[836]119         void duplicateTransformation(CAxis*);
120         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
[1158]121         bool isEqual(CAxis* axis);
[619]122
[1235]123      public: 
124        bool hasValue;       
[1558]125        bool hasBounds;
126        bool hasLabel;
127
[1637]128        CArray<int,1> localIndexToWriteOnServer;
[676]129
130      private:
[551]131         void checkData();
132         void checkMask();
[1158]133         void checkBounds();
134         void checkLabel();
[1099]135         void sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
136                             CServerDistributionDescription::ServerDistributionType distType);
137         void sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid,
138                                        CServerDistributionDescription::ServerDistributionType distType);
[1235]139         void computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid,
[815]140                                     CServerDistributionDescription::ServerDistributionType distType);
[595]141
[1025]142         void sendNonDistributedAttributes(void);
143         void sendDistributedAttributes(void);
[619]144
[1025]145         static void recvNonDistributedAttributes(CEventServer& event);
146         static void recvDistributedAttributes(CEventServer& event);
[1235]147         static void recvDistributionAttribute(CEventServer& event);
[1025]148         void recvNonDistributedAttributes(int rank, CBufferIn& buffer);
149         void recvDistributedAttributes(vector<int>& rank, vector<CBufferIn*> buffers);
[1235]150         void recvDistributionAttribute(CBufferIn& buffer);
[1025]151
[621]152         void setTransformations(const TransMapTypes&);
[676]153
[567]154      private:
[1345]155
156/** Clients that have to send a domain. There can be multiple clients in case of secondary server, otherwise only one client. */
[1353]157         std::list<CContextClient*> clients;
158         std::set<CContextClient*> clientsSet;
[1345]159
[219]160         bool isChecked;
[567]161         bool areClientAttributesChecked_;
[927]162         bool isClientAfterTransformationChecked;
[676]163         std::set<StdString> relFiles, relFilesCompressed;
[1143]164         TransMapTypes transformationMap_;         
[676]165         //! True if and only if the data defined on the axis can be outputted in a compressed way
166         bool isCompressible_;
[1337]167         std::map<int, map<int,int> > nbSenders; // Mapping of number of communicating client to a server
[1542]168         std::map<int, std::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server
[1236]169         // std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
[1542]170         std::unordered_map<size_t,size_t> globalLocalIndexMap_;
[1249]171         std::map<int,int> numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
172         std::map<int, CArray<int, 1> > compressedIndexToWriteOnServer;
[1337]173         std::map<int, std::vector<int> > connectedServerRank_;
[1235]174         bool computedWrittenIndex_;                 
[1099]175
[836]176       private:
177         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
178         static std::map<StdString, ETranformationType> transformationMapList_;
179         static bool dummyTransformationMapList_;
180
[540]181         DECLARE_REF_FUNC(Axis,axis)
[219]182   }; // class CAxis
183
184   ///--------------------------------------------------------------
185
186   // Declare/Define CAxisGroup and CAxisDefinition
187   DECLARE_GROUP(CAxis);
[335]188} // namespace xios
[219]189
[591]190#endif // __XIOS_CAxis__
Note: See TracBrowser for help on using the repository browser.