Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / src / MULTIPR / MULTIPR_GaussLoc.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_GaussLoc.hxx
6  *
7  * \brief   Class GaussLoc. Allow to locate all the Gauss points in an element of reference (e.g. a TETRA10).
8  *
9  * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
10  * 
11  * \date    01/2007
12  */
13
14 #ifndef MULTIPR_GAUSSLOC_HXX
15 #define MULTIPR_GAUSSLOC_HXX
16
17 //*****************************************************************************
18 // Includes section
19 //*****************************************************************************
20
21 extern "C"
22 {
23     #include "med.h"
24 }
25
26 #include <iostream>
27
28
29 namespace multipr
30 {
31
32
33 //*****************************************************************************
34 // Class GaussLoc
35 //*****************************************************************************
36
37 class GaussLoc
38 {
39 public:
40
41     /** 
42      * Builds an empty Gauss reference (default constructor).
43      */
44     GaussLoc();
45     
46     /**
47      * Copy constructor (deep copy).
48      * \param  pGaussLoc the GaussLoc to copy.
49      */
50     GaussLoc(const GaussLoc& pGaussLoc);
51     
52     /**
53      * Destructor. Removes everything.
54      */
55     ~GaussLoc();
56     
57     /**
58      * Resets this object in its state by default (empty). Cleans memory.
59      */
60     void reset();
61     
62     //---------------------------------------------------------------------
63     // Basic accessors/mutators
64     //--------------------------------------------------------------------
65     
66     /**
67      * Returns the name of this GaussLoc.
68      * \return the name of this GaussLoc.
69      */
70     std::string getName() const { return mName; }
71     
72     /**
73      * Returns dimension of Gauss points which is also the dimension of reference nodes.
74      * \return dimension of Gauss points.
75      */
76     int getDim() const { return mDim; }
77      
78     /**
79      * Returns number of Gauss points.
80      * \return number of Gauss points.
81      */
82     int getNumGaussPoints() const { return mNumGauss; }
83       
84     //---------------------------------------------------------------------
85     // Algorithms
86     //--------------------------------------------------------------------
87     
88     /**
89      * Returns the coordinates of all the Gauss points for a given element.
90      * \param  pCooElt (in)  coordinates of nodes of an element.
91      * \param  pCoo    (out) coordinates of all the Gauss points (interlaced); memory must have been allocated.
92      */
93     void getCoordGaussPoints(const med_float* pCooElt, med_float* pCooGaussPoints, int nb_gauss) const;
94     
95     //---------------------------------------------------------------------
96     // I/O
97     //---------------------------------------------------------------------
98     
99     /**
100      * Reads a GaussLoc object from a MED file.
101      * \param  pMEDfile any valid MED file opened for reading.
102      * \param  pIndex   index of the gauss localization to be read; must be >= 1.
103      * \throw  IOException if any i/o error occurs.
104      */
105     void readMED(med_idt pMEDfile, med_int pIndex);
106     
107     /**
108      * Writes this GaussLoc object to the given MED file.
109      * \param  pMEDfile any valid MED file opened for writing.
110      * \throw  IOException if any i/o error occurs.
111      */
112     void writeMED(med_idt pMEDfile);
113
114     /**
115      * Dumps any GaussLoc to the given output stream.
116      * \param  pOs any output stream.
117      * \param  pF  any Field.
118      * \return the output stream pOs.
119      */
120     friend std::ostream& operator<<(std::ostream& pOs, GaussLoc& pG);
121
122 private:
123     
124     char                  mName[MED_TAILLE_NOM + 1];  /**< Name of the Gauss info. */
125     med_geometrie_element mGeom;                      /**< Type of elements, e.g. TETRA10 (code is 310). */
126     int                   mDim;                       /**< Dimension of nodes, e.g. 3 for a TETRA10. */
127     int                   mNumNodes;                  /**< Number of nodes in the reference element, e.g. 10 for a TETRA10. */
128     med_int               mNumGauss;                  /**< Number of Gauss points. */
129     med_float*            mRefCoo;                    /**< Table of coordinates of nodes.
130                                                            Example: for a TETRA10: 10 nodes, 3 components => 30 med_float. */
131     med_float*            mGaussCoo;                  /**< Table of coordinates of Gauss points. */
132     med_float*            mWeight;                    /**< Table of weights of Gauss points. */
133     
134 private:
135     
136     // do not allow copy
137     GaussLoc& operator=(const GaussLoc&);
138     
139     // do not allow operator ==
140     bool operator==(const GaussLoc&); 
141     
142 }; // class GaussLoc
143
144
145 } // namespace MULTIPR
146
147
148 #endif // MULTIPR_GAUSSLOC_HXX
149
150 // EOF