Salome HOME
Module MULTIPR
[modules/multipr.git] / src / MULTIPR / MULTIPR_Profil.hxx
1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
3
4 /**
5  * \file    MULTIPR_Profil.hxx
6  *
7  * \brief   Class Profil used to managed MED profil.
8  *          Profil is just a list of indices related to elements (NODES, CELLS).
9  *          !!! currently not used !!!
10  *
11  * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
12  * 
13  * \date    01/2007
14  */
15
16 #ifndef MULTIPR_PROFIL_HXX
17 #define MULTIPR_PROFIL_HXX
18
19 //*****************************************************************************
20 // Includes section
21 //*****************************************************************************
22
23 extern "C"
24 {
25         #include "med.h"
26 }
27
28 #include <vector>
29
30
31 namespace multipr
32 {
33
34
35 //*****************************************************************************
36 // Class Profil
37 //*****************************************************************************
38
39 class Profil
40 {
41 public:
42
43         /** 
44          * Builds an empty profil (default constructor).
45          */
46         Profil();
47         
48         /**
49          * Destructor. Removes everything.
50          */
51         ~Profil();
52         
53         /**
54          * Resets this object in its state by default (empty). Cleans memory.
55          */
56         void reset();
57         
58         /**
59          * Creates a profil from its name (reset before).
60          * \param  pName name of the profil to be created.
61          * \throw  NullArgumentException if pName is NULL.
62          */
63         void create(const char* pName);
64         
65         //---------------------------------------------------------------------
66         // Basic accessors/mutators
67         //---------------------------------------------------------------------
68         
69         /**
70          * Returns the name of this profil.
71          * \return the name of this profil.
72          */
73         const char* getName() const;
74         
75         /**
76          * Returns the nth elements of this profil.
77          * \param  pIndex index of the element to get; must be in [0..NUMBER_OF_ELEMENTS-1].
78          * \return the nth elements of this profil.
79          * \throw  IndexOutOfBoundsException if index is invalid.
80          */
81         med_int get(med_int pIndex) const;
82         
83         /**
84          * Adds a new element to this profil.
85          * \param  pElt element to be added; must be >= 1.
86          */
87         void add(med_int pElt);
88         
89         //---------------------------------------------------------------------
90         // I/O
91         //---------------------------------------------------------------------
92         
93         /**
94          * Reads a Profil from a MED file.
95          * \param  pMEDfile     any valid MED file opened for reading.
96          * \param  pIndexProfil index of the profil to be read; must be >= 1.
97          * \throw  IOException  if any i/o error occurs.
98          */
99         void readMED(med_idt pMEDfile, med_int pIndexProfil);
100         
101         /**
102          * Writes this profil to a MED file.
103          * \param  pMEDfile    any valid MED file opened for writing.
104          * \throw  IOException if any i/o error occurs.
105          */
106         void writeMED(med_idt pMEDfile);
107         
108         /**
109          * Dumps any Profil to the given output stream.
110          * \param  pOs any output stream.
111          * \param  pP  any Profil.
112          * \return the output stream pOs.
113          */
114         friend std::ostream& operator<<(std::ostream& pOs, Profil& pP);
115         
116 private:
117         
118         char                  mName[MED_TAILLE_NOM + 1];  /**< Name of the profil. */
119         std::vector<med_int>  mTable;                     /**< Table of elements. */
120         
121 private:
122
123         // do not allow copy constructor
124         Profil(const Profil&);
125         
126         // do not allow copy
127         Profil& operator=(const Profil&);
128         
129         // do not allow operator ==
130         bool operator==(const Profil&); 
131         
132 }; // class Profil
133
134
135 } // namespace MULTIPR
136
137
138 #endif // MULTIPR_PROFIL_HXX
139
140 // EOF