~chaffra/+junk/trilinos

« back to all changes in this revision

Viewing changes to packages/moocho/src/MoochoPack/src/std/MoochoPack_CheckConvergenceStd_AddedStepSetOptions.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Johannes Ring
  • Date: 2009-12-13 12:53:22 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091213125322-in0nrdjc55deqsw9
Tags: 10.0.3.dfsg-1
[Christophe Prud'homme]
* New upstream release

[Johannes Ring]
* debian/patches/libname.patch: Add prefix 'libtrilinos_' to all
  libraries. 
* debian/patches/soname.patch: Add soversion to libraries.
* debian/watch: Update download URL.
* debian/control:
  - Remove python-numeric from Build-Depends (virtual package).
  - Remove automake and autotools from Build-Depends and add cmake to
    reflect switch to CMake.
  - Add python-support to Build-Depends.
* debian/rules: 
  - Cleanup and updates for switch to CMake.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if 0
 
2
 
 
3
// @HEADER
 
4
// ***********************************************************************
 
5
// 
 
6
// Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
 
7
//                  Copyright (2003) Sandia Corporation
 
8
// 
 
9
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
 
10
// license for use of this work by or on behalf of the U.S. Government.
 
11
// 
 
12
// This library is free software; you can redistribute it and/or modify
 
13
// it under the terms of the GNU Lesser General Public License as
 
14
// published by the Free Software Foundation; either version 2.1 of the
 
15
// License, or (at your option) any later version.
 
16
//  
 
17
// This library is distributed in the hope that it will be useful, but
 
18
// WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
20
// Lesser General Public License for more details.
 
21
//  
 
22
// You should have received a copy of the GNU Lesser General Public
 
23
// License along with this library; if not, write to the Free Software
 
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
25
// USA
 
26
// Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
 
27
// 
 
28
// ***********************************************************************
 
29
// @HEADER
 
30
 
 
31
#include <assert.h>
 
32
 
 
33
#include "MoochoPack_CheckConvergenceStd_AddedStepSetOptions.hpp"
 
34
#include "OptionsFromStreamPack_StringToBool.hpp"
 
35
 
 
36
// Define the options
 
37
namespace {
 
38
 
 
39
  const int local_num_options = 2;
 
40
 
 
41
  enum local_EOptions {
 
42
    SCALE_KKT_ERROR_BY,
 
43
    SCALE_OPT_ERROR_BY_GF
 
44
  };
 
45
 
 
46
  const char* local_SOptions[local_num_options] = {
 
47
    "scale_kkt_error_by",
 
48
    "scale_opt_error_by_Gf",
 
49
  };
 
50
 
 
51
}
 
52
 
 
53
namespace MoochoPack {
 
54
 
 
55
CheckConvergenceStd_AddedStepSetOptions::CheckConvergenceStd_AddedStepSetOptions(
 
56
        CheckConvergenceStd_AddedStep* target
 
57
      , const char opt_grp_name[] )
 
58
  :     OptionsFromStreamPack::SetOptionsFromStreamNode(
 
59
        opt_grp_name, local_num_options, local_SOptions )
 
60
    , OptionsFromStreamPack::SetOptionsToTargetBase<
 
61
      CheckConvergenceStd_AddedStep >( target )
 
62
{}
 
63
 
 
64
void CheckConvergenceStd_AddedStepSetOptions::setOption(
 
65
  int option_num, const std::string& option_value )
 
66
{
 
67
  using OptionsFromStreamPack::StringToBool;
 
68
 
 
69
  typedef CheckConvergenceStd_AddedStep target_t;
 
70
  switch( (local_EOptions)option_num ) {
 
71
      case SCALE_KKT_ERROR_BY:
 
72
    {
 
73
      const std::string &option = option_value.c_str();
 
74
      if( option == "SCALE_BY_ONE" )
 
75
        target().scale_kkt_error_by( target_t::SCALE_BY_ONE );
 
76
      else if( option == "SCALE_BY_NORM_2_X" )
 
77
        target().scale_kkt_error_by( target_t::SCALE_BY_NORM_2_X );
 
78
      else if( option == "SCALE_BY_NORM_INF_X" )
 
79
        target().scale_kkt_error_by( target_t::SCALE_BY_NORM_INF_X );
 
80
      else
 
81
        throw std::invalid_argument( "Error, incorrect value for "
 
82
          "\"scale_kkt_error_by\".  Only the options "
 
83
          "SCALE_BY_ONE, SCALE_BY_NORM_2_X, and SCALE_BY_NORM_INF_X "
 
84
          "are available" );
 
85
      break;
 
86
    }
 
87
    case SCALE_OPT_ERROR_BY_GF: {
 
88
      target().scale_opt_error_by_Gf(
 
89
        StringToBool( "scale_opt_error_by_Gf", option_value.c_str() ) );
 
90
      break;
 
91
    }
 
92
    default:
 
93
      TEST_FOR_EXCEPT(true);    // Local error only?
 
94
  }
 
95
}
 
96
 
 
97
}       // end namespace MoochoPack 
 
98
 
 
99
#endif // 0