Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / src / MULTIPR / MULTIPR_PointOfField.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_PointOfField.hxx
6  *
7  * \brief   Class PointOfField used for decimation. PointOfField = a point in a field = coordinates + value.
8  *
9  * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
10  * 
11  * \date    01/2007
12  */
13
14 #ifndef MULTIPR_POINTOFFIELD_HXX
15 #define MULTIPR_POINTOFFIELD_HXX
16
17 //*****************************************************************************
18 // Includes section
19 //*****************************************************************************
20
21 extern "C"
22 {
23     #include "med.h"
24 }
25
26
27 namespace multipr
28 {
29
30
31 //*****************************************************************************
32 // Class PointOfField
33 //*****************************************************************************
34
35 class PointOfField
36 {
37 public:
38
39     /** 
40      * Builds an empty set of elements (default constructor).
41      */
42     PointOfField() { reset(); }
43     
44     /**
45      * Constructor.
46      * \param  pX   x-coordinate of the point.
47      * \param  pY   y-coordinate of the point.
48      * \param  pZ   z-coordinate of the point.
49      * \param  pVal value of the field at the given point.
50      */
51     PointOfField(med_float pX, med_float pY, med_float pZ, med_float pVal)
52     {
53         mXYZ[0] = pX;
54         mXYZ[1] = pY;
55         mXYZ[2] = pZ;
56         mVal    = pVal;
57     }
58     
59     /**
60      * Destructor. Removes everything.
61      */
62     ~PointOfField() { reset(); }
63     
64     /**
65      * Resets this object in its state by default (empty).
66      */
67     void reset()
68     {
69         mXYZ[0] = std::numeric_limits<med_float>::quiet_NaN();
70         mXYZ[1] = std::numeric_limits<med_float>::quiet_NaN();
71         mXYZ[2] = std::numeric_limits<med_float>::quiet_NaN();
72         mVal    = std::numeric_limits<med_float>::quiet_NaN();
73     }
74
75     /**
76      * Dumps any PointOfField to the given output stream.
77      * \param  pOs any output stream.
78      * \param  pP  any PointOfField.
79      * \return the output stream pOs.
80      */
81     friend std::ostream& operator<<(std::ostream& pOs, PointOfField& pP)
82     {
83         pOs << "[ " << pP.mXYZ[0] << " ; " << pP.mXYZ[1] << " ; " << pP.mXYZ[2] << "]: " << pP.mVal;
84         return pOs;
85     }
86
87 public:
88
89     med_float  mXYZ[3];    /**< 3D-position. */
90     med_float  mVal;       /**< Value of the field at this point. */
91     
92 }; // class PointOfField
93
94
95 } // namespace multipr
96
97
98 #endif // MULTIPR_FIELDPOINT_HXX 
99
100 // EOF