Corsen.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*!
  2. * \file Corsen.h
  3. * \brief Charge les différents fichiers en mémoire et lance la génération du graphe.
  4. * \author The VLE Development Team
  5. * See the AUTHORS or Authors.txt file
  6. * \version 2.0
  7. */
  8. /*
  9. * Copyright (C) 2012-2013 ULCO http://www.univ-littoral.fr
  10. * Copyright (C) 2012-2013 INRA http://www.inra.fr
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. #ifndef CORSEN_H_
  26. #define CORSEN_H_
  27. #define BOOST_TEST_DYN_LINK
  28. #include <fstream>
  29. #include <sstream>
  30. #include <cstdio>
  31. #include <stack>
  32. #include <boost/foreach.hpp>
  33. #include "ElevationFileStream.h"
  34. #include "ParametersFileStream.h"
  35. #include "LayersFileStream.h"
  36. #include "OutletFileStream.h"
  37. #include "SlopeFileStream.h"
  38. #include "SoilFileStream.h"
  39. #include "DrainFileStream.h"
  40. #include "LayersTextFileStream.h"
  41. #include "ContextFileReader.h"
  42. #include "ContextData.h"
  43. #include "Constantes.h"
  44. #include "Functions.h"
  45. #include "Graph.hpp"
  46. /*! \class Corsen
  47. * \brief est la classe centrale de la bibliothèque.
  48. *
  49. * La classe gère la lecture, l'ecriture des différents fichiers de données
  50. * pour un bassin versant. Elle génère le boost graph correspondant aux
  51. * données.
  52. */
  53. class Corsen
  54. {
  55. public:
  56. /*!
  57. * \brief Constructeur
  58. *
  59. * Constructeur de la classe Corsen.
  60. */
  61. Corsen();
  62. /*!
  63. * \brief Lecture
  64. *
  65. * Lecture des fichiers de données du bassin versant.
  66. *
  67. * \param files : liste des fichiers à lire.
  68. * \param absolutePath : emplacement des fichiers à lire.
  69. */
  70. void read(std::vector<std::string* >& files,
  71. std::string& absolutePath) throw (FileNotFound, ReadError,
  72. InvalidFileFormat,
  73. std::invalid_argument);
  74. /*!
  75. * \brief Construire graphe
  76. *
  77. * génère le boostGraph
  78. */
  79. void buildGraph();
  80. /*!
  81. * \brief Affichage
  82. *
  83. * Affiche le contenu des attributs.
  84. */
  85. void display();
  86. const std::vector<float> * getElevationMatrix() const
  87. {
  88. return _elevationMatrix;
  89. }
  90. const Graph& getGraph() const {
  91. return _graph;
  92. }
  93. const std::vector<Layer> * getLayers() const {
  94. return _layers;
  95. }
  96. const std::list<Outlet*> * getOutlets() const {
  97. return _outlets;
  98. }
  99. const Parameters * getParam() const {
  100. return _param;
  101. }
  102. const Node * getExutoire() const {
  103. return _outlet;
  104. }
  105. const std::vector<float> * getGradientMatrix() const {
  106. return _gradientMatrix;
  107. }
  108. const std::vector<float> * getSoilMatrix() const {
  109. return _soilMatrix;
  110. }
  111. const std::vector<float> * getElevationMatrixBv() const {
  112. return _elevationMatrixBv;
  113. }
  114. /*!
  115. * \brief Destructeur
  116. *
  117. * Destructeur de la classe Corsen
  118. */
  119. virtual ~Corsen();
  120. private:
  121. Graph _graph;
  122. ParametersFileStream * _pfs; /*!< Flux fichier paramètres */
  123. ElevationFileStream * _efs; /*!< Flux fichier des données d'altitudes */
  124. OutletFileStream * _ofs; /*!< Flux fichier des arbres de drainage */
  125. SlopeFileStream * _gfs; /*!< Flux fichier des pentes */
  126. SoilFileStream * _sfs;
  127. LayersFileStream * _lfs; /*!< Flux fichier des couches*/
  128. DrainFileStream<corsenContainers::vecS, float> * _dfs;
  129. std::vector<float> * _gradientMatrix ;/*!< données pentes */
  130. std::vector<float> * _soilMatrix;
  131. std::vector<float> * _elevationMatrix;/*!< données altitudes */
  132. std::list<Outlet *> * _outlets;/*!< liste des exutoires */
  133. std::vector<Layer> * _layers; /*!< liste des couches */
  134. Parameters * _param; /*!< paramètres du programme */
  135. Node * _outlet; /*!< noeud exutoire */
  136. std::vector<float> * _elevationMatrixBv;
  137. };
  138. #endif /* CORSEN_H_ */