XIOS  1.0
Xml I/O Server
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros
axis.hpp
Aller à la documentation de ce fichier.
1 #ifndef __XIOS_CAxis__
2 #define __XIOS_CAxis__
3 
5 #include "xios_spl.hpp"
6 #include "group_factory.hpp"
7 #include "virtual_node.hpp"
8 
9 #include "declare_group.hpp"
10 #include "declare_ref_func.hpp"
11 #include "declare_virtual_node.hpp"
12 #include "attribute_array.hpp"
13 #include "attribute_enum.hpp"
14 #include "attribute_enum_impl.hpp"
16 #include "transformation.hpp"
17 #include "transformation_enum.hpp"
18 
19 namespace xios {
21 
22  class CAxisGroup;
23  class CAxisAttributes;
24  class CAxis;
25 
27 
28  // Declare/Define CAxisAttribute
30 # include "axis_attribute.conf"
32 
33 
34 
35  class CAxis
36  : public CObjectTemplate<CAxis>
37  , public CAxisAttributes
38  {
41  typedef CAxisAttributes SuperClassAttribute;
42 
43  public:
44  enum EEventId
45  {
50  EVENT_ID_DISTRIBUTED_ATTRIBUTES
51  } ;
52 
53  public:
54  typedef CAxisAttributes RelAttributes;
55  typedef CAxisGroup RelGroup;
57 
58  public:
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 
65  static CAxis* createAxis();
66 
68  const std::set<StdString> & getRelFiles(void) const;
69 
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);
74 
75  std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid,
77 
79  bool IsWritten(const StdString & filename) const;
80  bool isWrittenCompressed(const StdString& filename) const;
81  bool isDistributed(void) const;
82  bool isCompressible(void) const;
83 
85  void addRelFile(const StdString & filename);
86  void addRelFileCompressed(const StdString& filename);
87 
89  void checkAttributes(void);
90 
92  virtual ~CAxis(void);
93 
94  virtual void parse(xml::CXMLNode & node);
95 
96  void setContextClient(CContextClient* contextClient);
97 
99  static StdString GetName(void);
100  static StdString GetDefName(void);
101  static ENodeType GetType(void);
102 
103  static bool dispatchEvent(CEventServer& event);
104 
105  void checkAttributesOnClient();
106  void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid,
108  void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
110 
111  void checkEligibilityForCompressedOutput();
112  size_t getGlobalWrittenSize(void) ;
113 
114  void computeWrittenIndex();
115  void computeWrittenCompressedIndex(MPI_Comm);
116  bool hasTransformation();
117  void solveInheritanceTransformation();
118  TransMapTypes getAllTransformations();
119  void duplicateTransformation(CAxis*);
120  CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
121  bool isEqual(CAxis* axis);
122 
123  public:
124  bool hasValue;
125  bool hasBounds;
126  bool hasLabel;
127 
129 
130  private:
131  void checkData();
132  void checkMask();
133  void checkBounds();
134  void checkLabel();
135  void sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
137  void sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid,
139  void computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid,
141 
142  void sendNonDistributedAttributes(void);
143  void sendDistributedAttributes(void);
144 
145  static void recvNonDistributedAttributes(CEventServer& event);
146  static void recvDistributedAttributes(CEventServer& event);
147  static void recvDistributionAttribute(CEventServer& event);
148  void recvNonDistributedAttributes(int rank, CBufferIn& buffer);
149  void recvDistributedAttributes(vector<int>& rank, vector<CBufferIn*> buffers);
150  void recvDistributionAttribute(CBufferIn& buffer);
151 
152  void setTransformations(const TransMapTypes&);
153 
154  private:
155 
157  std::list<CContextClient*> clients;
158  std::set<CContextClient*> clientsSet;
159 
160  bool isChecked;
163  std::set<StdString> relFiles, relFilesCompressed;
164  TransMapTypes transformationMap_;
167  std::map<int, map<int,int> > nbSenders; // Mapping of number of communicating client to a server
168  std::map<int, std::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server
169  // std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
170  std::unordered_map<size_t,size_t> globalLocalIndexMap_;
171  std::vector<int> indexesToWrite;
172  std::map<int,int> numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
173  std::map<int, CArray<int, 1> > compressedIndexToWriteOnServer;
174  std::map<int, std::vector<int> > connectedServerRank_;
176 
177  private:
178  static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
179  static std::map<StdString, ETranformationType> transformationMapList_;
181 
182  DECLARE_REF_FUNC(Axis,axis)
183  }; // class CAxis
184 
186 
187  // Declare/Define CAxisGroup and CAxisDefinition
189 } // namespace xios
190 
191 #endif // __XIOS_CAxis__
std::map< int, CArray< int, 1 > > compressedIndexToWriteOnServer
Definition: axis.hpp:173
std::map< int, std::unordered_map< int, vector< size_t > > > indSrv_
Definition: axis.hpp:168
bool hasLabel
Definition: axis.hpp:126
enum xios::transformation_type ETranformationType
////////////////////// Définitions ////////////////////// ///
#define END_DECLARE_ATTRIBUTE_MAP(type)
bool isCompressible_
True if and only if the data defined on the axis can be outputted in a compressed way...
Definition: axis.hpp:166
bool isChecked
Definition: axis.hpp:160
std::vector< int > indexesToWrite
Definition: axis.hpp:171
bool hasValue
Definition: axis.hpp:124
CTransformation< CAxis >::TransformationMapTypes TransMapTypes
Definition: axis.hpp:56
std::list< CContextClient * > clients
Definition: axis.hpp:157
std::string StdString
Definition: xios_spl.hpp:48
#define xios(arg)
std::set< StdString > relFilesCompressed
Definition: axis.hpp:163
std::map< int, int > totalNumberWrittenIndexes_
Definition: axis.hpp:172
Description of index distribution on server(s).
#define DECLARE_REF_FUNC(type, name_)
static bool dummyTransformationMapList_
Definition: axis.hpp:180
#define BEGIN_DECLARE_ATTRIBUTE_MAP(type)
CArray< int, 1 > localIndexToWriteOnServer
Definition: axis.hpp:128
A context can be both on client and on server side.
////////////////////// Déclarations ////////////////////// ///
std::map< int, map< int, int > > nbSenders
Definition: axis.hpp:167
std::map< int, std::vector< int > > connectedServerRank_
Definition: axis.hpp:174
DECLARE_GROUP(CAxis)
CAxisGroup RelGroup
Definition: axis.hpp:55
static std::map< StdString, ETranformationType > transformationMapList_
Definition: axis.hpp:179
Macros to add functions used to solve references in class CDomain, CAxis and CField.
enum xios::_node_type ENodeType
////////////////////// Définitions ////////////////////// ///
std::unordered_map< size_t, size_t > globalLocalIndexMap_
Definition: axis.hpp:170
TransMapTypes transformationMap_
Definition: axis.hpp:164
bool areClientAttributesChecked_
Definition: axis.hpp:161
CAxisAttributes RelAttributes
Definition: axis.hpp:54
CObjectTemplate< CAxis > SuperClass
typedef ///
Definition: axis.hpp:40
bool hasBounds
Definition: axis.hpp:125
bool isClientAfterTransformationChecked
Definition: axis.hpp:162
std::set< CContextClient * > clientsSet
Definition: axis.hpp:158
bool computedWrittenIndex_
Definition: axis.hpp:175
CAxisAttributes SuperClassAttribute
Definition: axis.hpp:41