1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
5 * \file MULTIPR_DecimationFilter.hxx
7 * \brief Interface DecimationFilter: filter used for decimation.
9 * \author Olivier LE ROUX - CS, Virtual Reality Dpt
14 #ifndef MULTIPR_DECIMATION_FILTER_HXX
15 #define MULTIPR_DECIMATION_FILTER_HXX
17 //*****************************************************************************
19 //*****************************************************************************
33 //*****************************************************************************
35 //*****************************************************************************
41 //*****************************************************************************
42 // Interface DecimationFilter and factory to build filters.
43 //*****************************************************************************
45 class DecimationFilter
49 * Decimation filter factory.
50 * \param pFilterName name of the filter to be instanciated.
51 * \return a new instance of the given filter.
53 static DecimationFilter* create(const char* pFilterName);
58 * Builds an empty DecimationFilter (default constructor).
60 DecimationFilter() { }
63 * Destructor. Removes everything.
65 virtual ~DecimationFilter() { }
68 * Interface. Creates a new Mesh by decimating the given Mesh with this DecimationFilter.
69 * \param pMesh any mesh to be decimated; must not be NULL.
70 * \param pArgv all the arguments of the filter as a string; must not be NULL.
71 * \param pNameNewMesh name of the decimated mesh; must not be NULL.
72 * \return the decimated mesh.
74 virtual Mesh* apply(Mesh* pMesh, const char* pArgv, const char* pNameNewMesh) = 0;
78 // do not allow copy constructor
79 DecimationFilter(const DecimationFilter&);
82 DecimationFilter& operator=(const DecimationFilter&);
84 // do not allow operator ==
85 bool operator==(const DecimationFilter&);
87 }; // class DecimationFilter
90 //*****************************************************************************
91 // Filter : Average Gradient
92 //*****************************************************************************
94 class DecimationFilterGradAvg : public DecimationFilter
99 * Builds an empty DecimationFilterGradAvg (default constructor).
101 DecimationFilterGradAvg();
104 * Destructor. Removes everything.
106 virtual ~DecimationFilterGradAvg();
109 * Creates a new Mesh by decimating the given Mesh with this DecimationFilter.
112 * Keep this element if all its points (related to a field) have a |gradient| > threshold.
114 * For each point, gradient is computed by considering all the neighbours in a sphere of radius r.
116 * \param pMesh any mesh to be decimated; must not be NULL.
117 * \param pArgv all the arguments of the filter as a string; must not be NULL.
118 * for GradAvg, expected "fieldName fieldIt threshold radius boxing" (5 parameters).
119 * \param pNameNewMesh name of the decimated mesh; must not be NULL.
120 * \return the decimated mesh.
122 virtual Mesh* apply(Mesh* pMesh, const char* pArgv, const char* pNameNewMesh);
125 * Returns information about gradient.
127 void getGradientInfo(
129 const char* pFieldName,
135 double* pOutGradMax);
140 * Returns the norm of the gradient of the field at the given point.
141 * Sub-method used by apply().
142 * \param pPt any point in the field.
143 * \param pNeigbours neighbourhood of pPt.
144 * \return the norm of the gradient of the field in pPt.
146 med_float computeNormGrad(const PointOfField& pPt, const std::vector<PointOfField>& pNeighbours) const;
150 // do not allow copy constructor
151 DecimationFilterGradAvg(const DecimationFilterGradAvg&);
154 DecimationFilterGradAvg& operator=(const DecimationFilterGradAvg&);
156 // do not allow operator ==
157 bool operator==(const DecimationFilterGradAvg&);
159 }; // class DecimationFilterGradAvg
162 } // namespace MULTIPR
165 #endif // MULTIPR_DECIMATION_FILTER_HXX