// file: $isip_ifc/class/algo/Lyapunov/lyap_00.cc
// version: $Id: lyap_00.cc 10485 2006-03-15 17:22:34Z srinivas $
//

// isip include files
//
#include "Lyapunov.h"

//------------------------------------------------------------------------
//
// required public methods
//
//-----------------------------------------------------------------------

// method: clear
//
// arguments:
//  Integral::CMODE ctype: (input) clear mode
//
// return: a boolean value indicating status
//
// this method resets the data members to the default values
//
boolean Lyapunov::clear(Integral::CMODE ctype_a) {

  // reset all protected data
  //
  if (ctype_a != Integral::RETAIN) {
    algorithm_d = DEF_ALGORITHM;
    implementation_d = DEF_IMPLEMENTATION;
    num_neighbors_d = DEF_NUM_NEIGHBORS;
    evolve_step_d = DEF_EVOLVE_STEP;
    local_dim_d = DEF_LOCAL_DIM;
    num_steps_d = DEF_NUM_STEPS;
    inner_radius_d = DEF_INNER_RADIUS;
    outer_radius_d = DEF_OUTER_RADIUS;
    num_neighbor_subgroups_d = DEF_NUM_NEIGHBOR_SUBGROUPS;
    reinit_step_d = DEF_REINIT_STEP;
    start_pos_d = DEF_START_POS;
  }
  
  // call the base clear method
  //
  return AlgorithmBase::clear(ctype_a);
}

//---------------------------------------------------------------------------
//
// class-specific public methods:
//  public methods required by the AlgorithmBase interface contract
//
//---------------------------------------------------------------------------

// method: assign
//
// arguments:
//  const AlgorithmBase& arg: (input) object to be assigned
//
// return: a boolean value indicating status
//
// this method assigns the input algorithm object to the current
// Lyapunov object, if the input algorithm object is not an Lyapunov
// object, it returns an error
//
boolean Lyapunov::assign(const AlgorithmBase& arg_a) {

  // case: input is a Lyapunov object
  //
  if (typeid(arg_a) == typeid(Lyapunov)) {
    return assign((Lyapunov&)arg_a);
  }

  // case: other
  //  if the input algorithm object is not a Lyapunov object, return
  //  an error.
  //    
  else {
    return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__);
  }
}

// method: eq
//
// arguments:
//  const AlgorithmBase& arg: (input) object to be compared
//
// return: a boolean value indicating status
//
// this method checks whether the current Lyapunov object is identical
// to the input algorithm object, if the input algorithm object is not
// an Lyapunov object, it returns an error
//
boolean Lyapunov::eq(const AlgorithmBase& arg_a) const {
  
  // case: input is a Lyapunov object
  //
  if (typeid(arg_a) == typeid(Lyapunov)) {
    return eq((Lyapunov&)arg_a);
  }

  // case: other
  //  if the input algorithm object is not a Lyapunov object, return
  //  an error.
  //    
  else {
    return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__);
  }
}

//-----------------------------------------------------------------------------
//
// we define non-integral constants in the default constructor
//      
//-----------------------------------------------------------------------------

// constants: class name
//
const String Lyapunov::CLASS_NAME(L"Lyapunov");

// constants: i/o related constants
//
const String Lyapunov::DEF_PARAM(L"");
const String Lyapunov::PARAM_ALGORITHM(L"algorithm");
const String Lyapunov::PARAM_IMPLEMENTATION(L"implementation");
const String Lyapunov::PARAM_NUM_NEIGHBORS(L"num_neighbors");
const String Lyapunov::PARAM_EVOLVE_STEP(L"evolve_step");
const String Lyapunov::PARAM_LOCAL_DIM(L"local_dim");
const String Lyapunov::PARAM_NUM_STEPS(L"num_steps");
const String Lyapunov::PARAM_INNER_RADIUS(L"inner_radius");
const String Lyapunov::PARAM_OUTER_RADIUS(L"outer_radius");
const String Lyapunov::PARAM_NUM_NEIGHBOR_SUBGROUPS(L"num_neighbor_subgroups");
const String Lyapunov::PARAM_REINIT_STEP(L"reinit_step");
const String Lyapunov::PARAM_START_POS(L"start_pos");

// constants: NameMap(s) for the enumerated values
//
const NameMap Lyapunov::ALGO_MAP(L"LINEAR_TANGENT_MAP");
const NameMap Lyapunov::IMPL_MAP(L"TREPPEN_ITERATION");

// static instantiations: memory manager
//
MemoryManager Lyapunov::mgr_d(sizeof(Lyapunov), Lyapunov::name());


