Salome HOME
6a5ef3b4e9e16eb6c6264e92c2f38bf398f1f3c3
[modules/hydro.git] / src / HYDROData / HYDROData_IProfilesInterpolator.cxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "HYDROData_IProfilesInterpolator.h"
24
25
26 const int DEFAULT_RESULT_PROFILES_NB = 1; ///< default number of results profiles
27
28 HYDROData_IProfilesInterpolator::HYDROData_IProfilesInterpolator()
29   : myResultProfilesNumber( DEFAULT_RESULT_PROFILES_NB ),
30     myErrorCode( OK )
31 {
32 }
33
34 HYDROData_IProfilesInterpolator::~HYDROData_IProfilesInterpolator()
35 {
36 }
37
38 void HYDROData_IProfilesInterpolator::SetProfiles( const std::vector<double> theProfile1, const std::vector<double> theProfile2 )
39 {
40   myProfile1 = theProfile1;
41   myProfile2 = theProfile2;
42 }
43
44 void HYDROData_IProfilesInterpolator::SetParameter( const std::string& theName, const std::string& theValue )
45 {
46   myParameters[theName] = theValue;
47 }
48
49 InterpolationError HYDROData_IProfilesInterpolator::GetErrorCode() const
50 {
51   return myErrorCode;
52 }
53
54 void HYDROData_IProfilesInterpolator::SetErrorCode( const InterpolationError& theError )
55 {
56   myErrorCode = theError;
57 }
58
59 std::string HYDROData_IProfilesInterpolator::GetErrorMessage() const
60 {
61   return myErrorMessage;
62 }
63
64 void HYDROData_IProfilesInterpolator::SetErrorMessage( const std::string& theMessage )
65 {
66   myErrorMessage = theMessage;
67 }
68
69 void HYDROData_IProfilesInterpolator::SetResultProfilesNumber( const int theNumber )
70 {
71   myResultProfilesNumber = theNumber;
72 }
73
74 std::vector<double> HYDROData_IProfilesInterpolator::GetResultProfile( const int theProfileIndex ) const
75 {
76   std::vector<double> aResultProfile;
77
78   if ( theProfileIndex > 0 && theProfileIndex < (int) myResultProfiles.size() ) {
79     aResultProfile = myResultProfiles.at( theProfileIndex );
80   }
81
82   return aResultProfile;
83 }
84
85 void HYDROData_IProfilesInterpolator::Reset()
86 {
87   myProfile1.clear();  
88   myProfile2.clear();  
89   myParameters.clear();
90
91   SetResultProfilesNumber( DEFAULT_RESULT_PROFILES_NB );
92   
93   myResultProfiles.clear();
94
95   SetErrorCode( OK );
96   SetErrorMessage( "" );
97 }