1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROData_IProfilesInterpolator_HeaderFile
24 #define HYDROData_IProfilesInterpolator_HeaderFile
26 #include "HYDROData.h"
34 * Errors that could appear on interpolation calculations.
35 * If there is no error, it is "OK".
37 enum InterpolationError {
39 InvalidParametersError, ///< input parameters are invalid
40 UnknownError ///< problem has unknown nature
43 /**\class HYDROData_IProfilesInterpolator
44 * \brief The base class to provide interface for profiles interpolation.
46 class HYDROData_IProfilesInterpolator
53 HYDRODATA_EXPORT HYDROData_IProfilesInterpolator();
56 * Public virtual destructor.
58 virtual HYDRODATA_EXPORT ~HYDROData_IProfilesInterpolator();
63 * Get description of the interpolation algorithm.
64 * \return the description string
66 HYDRODATA_EXPORT virtual std::string GetDescription() const = 0;
69 * Set profiles as vectors of point coordinates [x1, y1, z1, x2, y2, z2, ...].
70 * \param theProfile1 the first profile points
71 * \param theProfile1 the second profile points
73 HYDRODATA_EXPORT virtual void SetProfiles( const std::vector<double> theProfile1, const std::vector<double> theProfile2 );
76 * Set number of profiles to compute.
77 * \param theNumber the number of profiles to be computed
79 HYDRODATA_EXPORT virtual void SetResultProfilesNumber( const int theNumber );
82 * Set the additional parameter.
83 * \param the parameter name
84 * \param the parameter value
86 HYDRODATA_EXPORT virtual void SetParameter( const std::string& theName, const std::string& theValue );
89 * Get the last error code.
90 * \return the error code from InterpolationError enumeration
92 HYDRODATA_EXPORT virtual InterpolationError GetErrorCode() const;
95 * Get string description of the last error.
96 * \return the string description
98 HYDRODATA_EXPORT virtual std::string GetErrorMessage() const;
101 * Reset interpolator state: both input and output data are reset.
103 HYDRODATA_EXPORT virtual void Reset();
107 * Perform interpolation calculations.
109 HYDRODATA_EXPORT virtual InterpolationError Calculate() = 0;
111 HYDRODATA_EXPORT virtual int GetCalculatedProfilesNumber() const;
114 * Get result profile by index.
115 * \param theProfileIndex the profile index [0, <number of profiles to compute>]
116 * \return the profile with the given index or empty vector if the index is out of range
118 HYDRODATA_EXPORT std::vector<double> GetResultProfile( const int theProfileIndex ) const;
122 * Set the error code.
123 * \param theError the error code from InterpolationError enumeration
125 HYDRODATA_EXPORT virtual void SetErrorCode( const InterpolationError& theError );
128 * Set the error string description.
129 * \param the string description
131 HYDRODATA_EXPORT virtual void SetErrorMessage( const std::string& theMessage );
134 std::vector<double> myProfile1, myProfile2; ///< the two input profiles
135 int myResultProfilesNumber; ///< the number of profiles to compute
136 std::map<std::string, std::string> myParameters; ///< the map of additional parameters
138 InterpolationError myErrorCode; ///< the last error code
139 std::string myErrorMessage; ///< the last error message
141 std::vector<std::vector<double>> myResultProfiles; ///< the list of result profiles