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 // Should be derivated to implement new filter.
44 //*****************************************************************************
46 class DecimationFilter
50 * Decimation filter factory. Must be used to build any new filter from its name.
51 * \param pFilterName name of the filter to be instanciated.
52 * \return a new instance of the given filter.
54 static DecimationFilter* create(const char* pFilterName);
59 * Builds an empty DecimationFilter (default constructor).
61 DecimationFilter() { /* do nothing */ }
64 * Destructor. Removes everything.
66 virtual ~DecimationFilter() { /* do nothing */ }
69 * Interface. Creates a new Mesh by decimating the given Mesh with this DecimationFilter.
70 * \param pMesh any mesh to be decimated; must not be NULL.
71 * \param pArgv all the arguments of the filter as a string; must not be NULL.
72 * \param pNameNewMesh name of the decimated mesh; must not be NULL.
73 * \return the decimated mesh.
75 virtual Mesh* apply(Mesh* pMesh, const char* pArgv, const char* pNameNewMesh) = 0;
79 // do not allow copy constructor
80 DecimationFilter(const DecimationFilter&);
83 DecimationFilter& operator=(const DecimationFilter&);
85 // do not allow operator ==
86 bool operator==(const DecimationFilter&);
88 }; // class DecimationFilter
91 //*****************************************************************************
92 // Filter : Average Gradient
93 //*****************************************************************************
95 class DecimationFilterGradAvg : public DecimationFilter
100 * Builds an empty DecimationFilterGradAvg (default constructor).
102 DecimationFilterGradAvg();
105 * Destructor. Removes everything.
107 virtual ~DecimationFilterGradAvg();
110 * Creates a new Mesh by decimating the given Mesh with this DecimationFilter.
113 * Keep this element if all its points (related to a field) have a |gradient| > threshold.
115 * For each point, gradient is computed by considering all the neighbours in a sphere of radius r.
117 * \param pMesh any mesh to be decimated; must not be NULL.
118 * \param pArgv all the arguments of the filter as a string; must not be NULL.
119 * for GradAvg, expected "fieldName fieldIt threshold radius boxing" (5 parameters).
120 * \param pNameNewMesh name of the decimated mesh; must not be NULL.
121 * \return the decimated mesh.
123 virtual Mesh* apply(Mesh* pMesh, const char* pArgv, const char* pNameNewMesh);
126 * Returns information about gradient.
128 void getGradientInfo(
130 const char* pFieldName,
136 double* pOutGradMax);
141 * Returns the norm of the gradient of the field at the given point.
142 * Sub-method used by apply().
143 * \param pPt any point in the field.
144 * \param pNeigbours neighbourhood of pPt.
145 * \return the norm of the gradient of the field in pPt.
147 med_float computeNormGrad(const PointOfField& pPt, const std::vector<PointOfField>& pNeighbours) const;
151 // do not allow copy constructor
152 DecimationFilterGradAvg(const DecimationFilterGradAvg&);
155 DecimationFilterGradAvg& operator=(const DecimationFilterGradAvg&);
157 // do not allow operator ==
158 bool operator==(const DecimationFilterGradAvg&);
160 }; // class DecimationFilterGradAvg
163 } // namespace MULTIPR
166 #endif // MULTIPR_DECIMATION_FILTER_HXX