Ignore:
Timestamp:
01/16/13 16:00:28 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-4770

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Rewrite implementations for locator and interpolator.
Documentation (doxygen format) is added to header files.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/BisectionLocator.cpp

    r2727 r2730  
    1515
    1616namespace asap {
     17BisectionLocator::BisectionLocator()
     18  : Locator()
     19{
     20}
    1721
    18 BisectionLocator::BisectionLocator(double *v, unsigned int n)
    19   : Locator(v, n)
     22
     23BisectionLocator::BisectionLocator(double *v, unsigned int n, bool copystorage)
     24  : Locator(v, n, copystorage)
    2025{}
    2126
     
    2732  if (n_ == 1)
    2833    return 0;
    29   bool ascending = (x_[n_-1] >= x_[0]);
    30   if (ascending) {
    31     if (x <= x_[0])
    32       return 0;
    33     else if (x > x_[n_-1])
    34       return n_;
    3534
    36     unsigned int jl = 0;
    37     unsigned int ju = n_;
    38     unsigned int jm;
    39     while (ju - jl > 1) {
    40       jm = (ju + jl) >> 1;
    41       if (x > x_[jm])
    42         jl = jm;
    43       else
    44         ju = jm;
    45     }
    46     return ju;
    47   }
    48   else {
    49     if (x >= x_[0])
    50       return 0;
    51     else if (x < x_[n_-1])
    52       return n_;
    53 
    54     unsigned int jl = 0;
    55     unsigned int ju = n_;
    56     unsigned int jm;
    57     while (ju - jl > 1) {
    58       jm = (ju + jl) >> 1;
    59       if (x < x_[jm])
    60         jl = jm;
    61       else
    62         ju = jm;
    63     }
    64     return ju;
    65   }
     35  return bisection(x, 0, n_);
    6636}
    6737
Note: See TracChangeset for help on using the changeset viewer.