source: XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.hpp @ 265

Last change on this file since 265 was 265, checked in by hozdoba, 13 years ago

Corrections après tests sur titane

File size: 4.8 KB
RevLine 
[152]1#ifndef __XMLIO_CGrid__
2#define __XMLIO_CGrid__
3
4/// xmlioserver headers ///
5#include "xmlioserver_spl.hpp"
6#include "group_factory.hpp"
7
8#include "declare_group.hpp"
9#include "domain.hpp"
10#include "axis.hpp"
11
[168]12namespace xmlioserver {
13namespace tree {
14   
15   /// ////////////////////// Déclarations ////////////////////// ///
[152]16
[168]17   class CGridGroup;
18   class CGridAttributes;
19   class CGrid;
[152]20
[168]21   ///--------------------------------------------------------------
[152]22
[168]23   // Declare/Define CGridAttribute
24   BEGIN_DECLARE_ATTRIBUTE_MAP(CGrid)
[173]25#  include "grid_attribute.conf"
[168]26   END_DECLARE_ATTRIBUTE_MAP(CGrid)
[152]27
[168]28   ///--------------------------------------------------------------
[152]29
[168]30   class CGrid
31      : public CObjectTemplate<CGrid>
32      , public CGridAttributes
33   {
34         /// typedef ///
35         typedef CObjectTemplate<CGrid>   SuperClass;
36         typedef CGridAttributes SuperClassAttribute;
[152]37
[168]38      public :
[152]39
[168]40         typedef CGridAttributes RelAttributes;
41         typedef CGridGroup      RelGroup;
[152]42
[168]43         /// Constructeurs ///
44         CGrid(void);
45         explicit CGrid(const StdString & id);
46         CGrid(const CGrid & grid);       // Not implemented yet.
47         CGrid(const CGrid * const grid); // Not implemented yet.
[152]48
[168]49         /// Traitements ///
50         void solveReference(void);
[152]51
[180]52         virtual void toBinary  (StdOStream & os) const;
53         virtual void fromBinary(StdIStream & is);
54
[168]55         /// Tests ///
56         bool hasAxis(void) const;
[152]57
[168]58      public :
[152]59
[168]60         /// Accesseurs ///
[181]61         const std::deque<ARRAY(int, 1)> & getStoreIndex(void) const;
62         const std::deque<ARRAY(int, 1)> & getOutIIndex(void)  const;
63         const std::deque<ARRAY(int, 1)> & getOutJIndex(void)  const;
64         const std::deque<ARRAY(int, 1)> & getOutLIndex(void)  const;
[152]65
[168]66         const boost::shared_ptr<CAxis>   getRelAxis  (void) const;
67         const boost::shared_ptr<CDomain> getRelDomain(void) const;
[152]68
[205]69         StdSize getDimension(void) const;
[265]70         
71         StdSize getLocalSize(void) const;
72         StdSize getGlobalSize(void) const;
73         std::vector<StdSize> getLocalShape(void) const;
74         std::vector<StdSize> getGlobalShape(void) const;
[205]75
[168]76         /// Entrées-sorties de champs ///
77         template <StdSize n>
[183]78            void inputField(const ARRAY(double, n) field, ARRAY(double, 1) stored) const;
[182]79           
80         void inputFieldServer(const std::deque<ARRAY(double, 1)> storedClient,
81                                                ARRAY(double, 1)  storedServer) const;
[152]82
[168]83         template <StdSize n>
84            void outputField(const ARRAY(double, 1) stored,  ARRAY(double, n) field) const;
[152]85
[168]86         /// Destructeur ///
87         virtual ~CGrid(void);
[152]88
[168]89      public :
[152]90
[168]91         /// Accesseurs statiques ///
92         static StdString GetName(void);
93         static StdString GetDefName(void);
94         
95         static ENodeType GetType(void);
[152]96
[168]97         /// Instanciateurs Statiques ///
98         static boost::shared_ptr<CGrid>
99            CreateGrid(boost::shared_ptr<CDomain> domain);
100         static boost::shared_ptr<CGrid>
101            CreateGrid(boost::shared_ptr<CDomain> domain, boost::shared_ptr<CAxis> axis);
[152]102
[168]103      protected :
[152]104
[168]105         /// Entrées-sorties de champs (interne) ///
106         void storeField_arr(const double * const data, ARRAY(double, 1) stored) const;
[152]107
[168]108         /// Traitements protégés ///
[182]109         void computeIndexServer(void);
[168]110         void computeIndex(void);
111         void solveDomainRef(void);
112         void solveAxisRef(void);
[152]113
[169]114      public:
[152]115
[168]116         /// Propriétés privées ///
117         bool withAxis ;
118         bool isChecked;
[152]119
[168]120         boost::shared_ptr<CAxis>   axis ;
121         boost::shared_ptr<CDomain> domain ;
[152]122
[181]123         std::deque<ARRAY(int, 1)> storeIndex ;
124         std::deque<ARRAY(int, 1)> out_i_index ;
125         std::deque<ARRAY(int, 1)> out_j_index ;
126         std::deque<ARRAY(int, 1)> out_l_index ;
[152]127
[168]128   }; // class CGrid
[152]129
[168]130   ///--------------------------------------------------------------
[152]131
[168]132   template <StdSize n>
133      void CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored) const
[205]134   {
[265]135      if (this->getGlobalSize() != field->num_elements())
[205]136         ERROR("CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored)",
[265]137                << "[ Taille des données attendue = " << this->getGlobalSize()       << ", "
[205]138                << "Taille des données reçue = "      << field->num_elements() << " ] "
139                << "Le tableau de données n'a pas la bonne taille !") ;
[265]140      this->storeField_arr(field->data(), stored) ;
[205]141   }
[152]142
[168]143   ///--------------------------------------------------------------
[152]144
[168]145   // Declare/Define CGridGroup and CGridDefinition
146   DECLARE_GROUP(CGrid);
147
148   ///--------------------------------------------------------------
149
150} // namespace tree
[152]151} // namespace xmlioserver
152
153#endif // __XMLIO_CGrid__
Note: See TracBrowser for help on using the repository browser.