source: XIOS/dev/dev_trunk_omp/src/node/axis.hpp @ 1646

Last change on this file since 1646 was 1646, checked in by yushan, 5 years ago

branch merged with trunk @1645. arch file (ep&mpi) added for ADA

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