This file is indexed.

/usr/include/trilinos/Rythmos_InterpolationBuffer_def.hpp is in libtrilinos-rythmos-dev 12.12.1-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
//@HEADER
// ***********************************************************************
//
//                           Rythmos Package
//                 Copyright (2006) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
// USA
// Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
//
// ***********************************************************************
//@HEADER

#ifndef Rythmos_INTERPOLATION_BUFFER_DEF_H
#define Rythmos_INTERPOLATION_BUFFER_DEF_H

#include "Rythmos_InterpolationBuffer_decl.hpp"
#include "Rythmos_InterpolatorBaseHelpers.hpp"
#include "Rythmos_LinearInterpolator.hpp"
#include "Thyra_VectorStdOps.hpp"
#include "Teuchos_StandardParameterEntryValidators.hpp"
#include "Teuchos_VerboseObjectParameterListHelpers.hpp"

namespace {

  static std::string IBPolicyTypeInvalid_name = "Invalid Policy";
  static std::string IBPolicyTypeStatic_name = "Static Policy";
  static std::string IBPolicyTypeKeepNewest_name = "Keep Newest Policy";
  static std::string interpolationBufferPolicySelection_name = "InterpolationBufferPolicy";
  static std::string interpolationBufferPolicySelection_default = IBPolicyTypeKeepNewest_name;

  static std::string interpolationBufferStorageLimit_name = "StorageLimit";
  static int interpolationBufferStorageLimit_default = 0;

  Teuchos::Array<std::string>
    S_InterpolationBufferPolicyTypes = Teuchos::tuple<std::string>(
        IBPolicyTypeInvalid_name,
        IBPolicyTypeStatic_name,
        IBPolicyTypeKeepNewest_name
        );

  const Teuchos::RCP<Teuchos::StringToIntegralParameterEntryValidator<Rythmos::IBPolicy> >
    interpolationBufferPolicyValidator = Teuchos::rcp(
        new Teuchos::StringToIntegralParameterEntryValidator<Rythmos::IBPolicy>(
          S_InterpolationBufferPolicyTypes,
          Teuchos::tuple<Rythmos::IBPolicy>(
            Rythmos::BUFFER_POLICY_INVALID,
            Rythmos::BUFFER_POLICY_STATIC,
            Rythmos::BUFFER_POLICY_KEEP_NEWEST
            ),
          interpolationBufferPolicySelection_name
          )
        );

} // namespace


namespace Rythmos {

// ////////////////////////////
// Defintions


template<class Scalar>
InterpolationBuffer<Scalar>::InterpolationBuffer()
{
  this->defaultInitializeAll_();
  initialize(Teuchos::null,0);
}

template<class Scalar>
void InterpolationBuffer<Scalar>::defaultInitializeAll_()
{
  interpolator_ = Teuchos::null;
  storage_limit_ = -1;
  data_vec_ = Teuchos::null;
  paramList_ = Teuchos::null;
  policy_ = BUFFER_POLICY_INVALID;
}

template<class Scalar>
RCP<const Thyra::VectorSpaceBase<Scalar> >
InterpolationBuffer<Scalar>::get_x_space() const
{
  if (data_vec_->size() == 0) {
    RCP<const Thyra::VectorSpaceBase<Scalar> > space;
    return(space);
  } else {
    return((*data_vec_)[0].x->space());
  }
}


template<class Scalar>
void InterpolationBuffer<Scalar>::initialize(
  const RCP<InterpolatorBase<Scalar> >& interpolator
  ,int storage
  )
{
  RCP<Teuchos::FancyOStream> out = this->getOStream();
  Teuchos::OSTab ostab(out,1,"IB::initialize");
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << "Initializing InterpolationBuffer" << std::endl;
    *out << "Calling setInterpolator..." << std::endl;
  }
  data_vec_ = rcp(new typename DataStore<Scalar>::DataStoreVector_t);
  setInterpolator(interpolator);
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << "Calling setStorage..." << std::endl;
  }
  setStorage(storage);
  policy_ = BUFFER_POLICY_KEEP_NEWEST;
}

template<class Scalar>
void InterpolationBuffer<Scalar>::setStorage( int storage )
{
  int storage_limit = std::max(2,storage); // Minimum of two points so interpolation is possible
  TEUCHOS_TEST_FOR_EXCEPTION(
    Teuchos::as<int>(data_vec_->size()) > storage_limit,
    std::logic_error,
    "Error, specified storage = " << storage_limit
    << " is below current number of vectors stored = " << data_vec_->size() << "!\n"
    );
  storage_limit_ = storage_limit;
  RCP<Teuchos::FancyOStream> out = this->getOStream();
  Teuchos::OSTab ostab(out,1,"IB::setStorage");
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << "storage_limit = " << storage_limit_ << std::endl;
  }
}


template<class Scalar>
int InterpolationBuffer<Scalar>::getStorage() const
{
  return(storage_limit_);
}


template<class Scalar>
void InterpolationBuffer<Scalar>::setInterpolator(
  const RCP<InterpolatorBase<Scalar> >& interpolator
  )
{
  if (interpolator == Teuchos::null) {
    interpolator_ = linearInterpolator<Scalar>();
  } else {
    interpolator_ = interpolator;
  }
  RCP<Teuchos::FancyOStream> out = this->getOStream();
  Teuchos::OSTab ostab(out,1,"IB::setInterpolator");
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << "interpolator = " << interpolator_->description() << std::endl;
  }
}

template<class Scalar>
RCP<InterpolatorBase<Scalar> >
  InterpolationBuffer<Scalar>::getNonconstInterpolator()
{
  return interpolator_;
}

template<class Scalar>
RCP<const InterpolatorBase<Scalar> >
  InterpolationBuffer<Scalar>::getInterpolator() const
{
  return interpolator_;
}

template<class Scalar>
RCP<InterpolatorBase<Scalar> > InterpolationBuffer<Scalar>::unSetInterpolator()
{
  RCP<InterpolatorBase<Scalar> > old_interpolator = interpolator_;
  interpolator_ = linearInterpolator<Scalar>();
  return old_interpolator;
}


template<class Scalar>
void InterpolationBuffer<Scalar>::addPoints(
  const Array<Scalar>& time_vec
  ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& x_vec
  ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec
  )
{
#ifdef HAVE_RYTHMOS_DEBUG
  // Check preconditions
  assertTimePointsAreSorted(time_vec);
  int tsize = Teuchos::as<int>(time_vec.size());
  TEUCHOS_TEST_FOR_EXCEPTION(
    tsize == 0, std::logic_error,
    "Error, time_vec is empty!"
    );
  TEUCHOS_TEST_FOR_EXCEPTION(
    Teuchos::as<int>(x_vec.size()) != tsize, std::logic_error,
    "Error, size of x_vec = " << x_vec.size() << " != " << tsize << " = size of time_vec!\n"
    );
  TEUCHOS_TEST_FOR_EXCEPTION(
    Teuchos::as<int>(xdot_vec.size()) != tsize, std::logic_error,
    "Error, size of xdot_vec = " << x_vec.size() << " != " << tsize << " = size of time_vec!\n"
    );
  for (int i=0; i<tsize ; ++i) {
    TEUCHOS_TEST_FOR_EXCEPTION(
      x_vec[i] == Teuchos::null, std::logic_error,
      "Error, x_vec[" << i << "] == null!\n"
      );
//    TEUCHOS_TEST_FOR_EXCEPTION(
//      xdot_vec[i] == Teuchos::null, std::logic_error,
//      "Error, xdot_vec[" << i << "] == null!\n"
//      );
  }
  assertNoTimePointsInsideCurrentTimeRange(*this,time_vec);
#endif // HAVE_RYTHMOS_DEBUG
  RCP<Teuchos::FancyOStream> out = this->getOStream();
  Teuchos::OSTab ostab(out,1,"IB::addPoints");
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << "time_vec = " << std::endl;
    for (Teuchos::Ordinal i=0 ; i<time_vec.size() ; ++i) {
      *out << "time_vec[" << i << "] = " << time_vec[i] << std::endl;
    }
    *out << "x_vec = " << std::endl;
    for (Teuchos::Ordinal i=0 ; i<x_vec.size() ; ++i) {
      *out << "x_vec[" << i << "] = " << std::endl;
      x_vec[i]->describe(*out,Teuchos::VERB_EXTREME);
    }
    *out << "xdot_vec = " << std::endl;
    for (Teuchos::Ordinal i=0 ; i<xdot_vec.size() ; ++i) {
      if (!is_null(xdot_vec[i])) {
        *out << "xdot_vec[" << i << "] = " << std::endl;
        xdot_vec[i]->describe(*out,Teuchos::VERB_EXTREME);
      }
    }
  }
  typename DataStore<Scalar>::DataStoreList_t input_data_list;
  vectorToDataStoreList<Scalar>(time_vec,x_vec,xdot_vec,&input_data_list);
  // Check that we're not going to exceed our storage limit:
  if (Teuchos::as<int>(data_vec_->size()+input_data_list.size()) > storage_limit_) {
    if (policy_ == BUFFER_POLICY_STATIC) {
      TEUCHOS_TEST_FOR_EXCEPTION(
        true, std::logic_error,
        "Error, buffer would be over-full and buffer policy is BUFFER_POLICY_STATIC, these points can not be added\n"
        );
    } else if (policy_ == BUFFER_POLICY_KEEP_NEWEST) {
      if (input_data_list.front() > data_vec_->back()) {
        // Case:  all of new points are past end of existing points
        // Remove points from the beginning of data_vec, then add new points
        int num_extra_points = input_data_list.size()-(storage_limit_-data_vec_->size());
#ifdef HAVE_RYTHMOS_DEBUG
        TEUCHOS_TEST_FOR_EXCEPTION( num_extra_points <= 0, std::logic_error,
            "Error!  Buffer policy is keep newest and input data size = " << input_data_list.size() << ", storage limit  = " << storage_limit_ << ", and data_vec size = " << data_vec_->size() << ".  Somehow number of points to delete = " << num_extra_points << " <= 0!"
            );
#endif // HAVE_RYTHMOS_DEBUG
        typename DataStore<Scalar>::DataStoreVector_t::iterator
          data_it = data_vec_->begin();
        for (int i=0 ; i < num_extra_points ; ++i) {
          data_it++;
        }
        if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
          *out << "Removing " << num_extra_points
               << " from beginning of data_vec to make room for new points." << std::endl;
        }
        data_vec_->erase(data_vec_->begin(),data_it);
      } else if (input_data_list.back() < data_vec_->front()) {
        // Case:  all of new points are before beginning of existing points
        // Remove points from end of data_vec, then add new points
        int num_extra_points = input_data_list.size()-(storage_limit_-data_vec_->size());
#ifdef HAVE_RYTHMOS_DEBUG
        TEUCHOS_TEST_FOR_EXCEPTION( num_extra_points <= 0, std::logic_error,
            "Error!  Buffer policy is keep newest and input data size = " << input_data_list.size() << ", storage limit  = " << storage_limit_ << ", and data_vec size = " << data_vec_->size() << ".  Somehow number of points to delete = " << num_extra_points << " <= 0!"
            );
#endif // HAVE_RYTHMOS_DEBUG
        typename DataStore<Scalar>::DataStoreVector_t::iterator
          data_it = data_vec_->end();
        for (int i=0 ; i < num_extra_points ; ++i) {
          data_it--;
        }
        if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
          *out << "Removing " << num_extra_points
               << " from end of data_vec to make room for new points." << std::endl;
        }
        data_vec_->erase(data_it,data_vec_->end());
      } else {
        // Case:  Some points are before beginning of data_vec and some points are after end of data_vec
        TEUCHOS_TEST_FOR_EXCEPTION(
          true, std::logic_error,
          "Error, incoming points are on both sides of TimeRange, I don't know which points are newest in this case.\n"
          );
      }
    } else {
      // Unknown Buffer policy:
      TEUCHOS_TEST_FOR_EXCEPTION(
        true, std::logic_error,
        "Error, unknown buffer policy.\n"
        );
    }
  }
  // Clone the vectors in input_data_list
  std::list<DataStore<Scalar> > internal_input_data_list;
  typename DataStore<Scalar>::DataStoreList_t::iterator it_list;
  for (it_list = input_data_list.begin() ; it_list != input_data_list.end() ; it_list++) {
    RCP<DataStore<Scalar> > ds_clone = it_list->clone();
    internal_input_data_list.push_back(*ds_clone);
  }
  // Now add all the remaining points to data_vec
  data_vec_->insert(data_vec_->end(),internal_input_data_list.begin(),internal_input_data_list.end());
  // And sort data_vec:
  std::sort(data_vec_->begin(),data_vec_->end());
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << "data_vec at end of addPoints:" << std::endl;
    for (Teuchos::Ordinal i=0 ; i<data_vec_->size() ; ++i) {
      *out << "data_vec[" << i << "] = " << std::endl;
      (*data_vec_)[i].describe(*out,Teuchos::VERB_EXTREME);
    }
  }
}


template<class Scalar>
void InterpolationBuffer<Scalar>::getPoints(
  const Array<Scalar>& time_vec
  ,Array<RCP<const Thyra::VectorBase<Scalar> > >* x_vec
  ,Array<RCP<const Thyra::VectorBase<Scalar> > >* xdot_vec
  ,Array<ScalarMag>* accuracy_vec
  ) const
{
  RCP<Teuchos::FancyOStream> out = this->getOStream();
  Teuchos::OSTab ostab(out,1,"IB::getPoints");
  typename DataStore<Scalar>::DataStoreVector_t data_out;
  interpolate<Scalar>(*interpolator_, data_vec_, time_vec, &data_out);
  Array<Scalar> time_out_vec;
  dataStoreVectorToVector<Scalar>(data_out, &time_out_vec, x_vec, xdot_vec, accuracy_vec);
  TEUCHOS_TEST_FOR_EXCEPTION(
    (time_vec.size() != time_out_vec.size()), std::logic_error,
    "Error, number of time points returned from interpolator = " <<
    time_out_vec.size() << " != " << time_vec.size() <<
    " = number of time points requested\n"
    );
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << "Conversion of DataStoreVector to Vector successful" << std::endl;
  }
}


template<class Scalar>
TimeRange<Scalar> InterpolationBuffer<Scalar>::getTimeRange() const
{
  TimeRange<Scalar> timerange;
  if (data_vec_->size() > 0) {
    timerange = TimeRange<Scalar>(data_vec_->front().time,data_vec_->back().time);
  }
  return(timerange);
}


template<class Scalar>
void InterpolationBuffer<Scalar>::getNodes( Array<Scalar>* time_vec ) const
{
  int N = data_vec_->size();
  time_vec->clear();
  time_vec->reserve(N);
  for (int i=0 ; i<N ; ++i) {
    time_vec->push_back((*data_vec_)[i].time);
  }
  RCP<Teuchos::FancyOStream> out = this->getOStream();
  Teuchos::OSTab ostab(out,1,"IB::getNodes");
  if ( Teuchos::as<int>(this->getVerbLevel()) >= Teuchos::as<int>(Teuchos::VERB_HIGH) ) {
    *out << this->description() << std::endl;
    for (Teuchos::Ordinal i=0 ; i<time_vec->size() ; ++i) {
      *out << "time_vec[" << i << "] = " << (*time_vec)[i] << std::endl;
    }
  }
}


template<class Scalar>
void InterpolationBuffer<Scalar>::removeNodes( Array<Scalar>& time_vec )
{
  typedef Teuchos::ScalarTraits<Scalar> ST;
  int N = time_vec.size();
#ifdef HAVE_RYTHMOS_DEBUG
  // Check preconditions:
  TimeRange<Scalar> range = this->getTimeRange();
  for (int i=0; i<N ; ++i) {
    TEUCHOS_TEST_FOR_EXCEPTION(
      ~(range.lower() <= time_vec[i]) && (time_vec[i] <= range.upper()),
      std::logic_error,
      "Error, time_vec[" << i << "] = " << time_vec[i] <<
      "is not in range of this interpolation buffer = [" <<
      range.lower() << "," << range.upper() << "]!\n"
      );
  }
#endif // HAVE_RYTHMOS_DEBUG
  RCP<Thyra::VectorBase<Scalar> > vec_temp;
  ScalarMag z = ST::zero();
  for (int i=0; i<N ; ++i) {
    DataStore<Scalar> ds_temp(time_vec[i],vec_temp,vec_temp,z);
    typename DataStore<Scalar>::DataStoreVector_t::iterator
      data_it = std::find(data_vec_->begin(),data_vec_->end(),ds_temp);
    TEUCHOS_TEST_FOR_EXCEPTION(
      data_it == data_vec_->end(), std::logic_error,
      "Error, time_vec[" << i << "] = " << time_vec[i] << "is not a node in the interpolation buffer!\n"
      );
    data_vec_->erase(data_it);
  }
}


template<class Scalar>
int InterpolationBuffer<Scalar>::getOrder() const
{
  return(interpolator_->order());
}


template<class Scalar>
std::string InterpolationBuffer<Scalar>::description() const
{
  std::string name = "Rythmos::InterpolationBuffer";
  return(name);
}


template<class Scalar>
void InterpolationBuffer<Scalar>::describe(
  Teuchos::FancyOStream                &out
  ,const Teuchos::EVerbosityLevel      verbLevel
  ) const
{
  if ( (Teuchos::as<int>(verbLevel) == Teuchos::as<int>(Teuchos::VERB_DEFAULT) ) ||
    (Teuchos::as<int>(verbLevel) >= Teuchos::as<int>(Teuchos::VERB_LOW)     )
    ) {
    out << description() << "::describe" << std::endl;
    out << "interpolator = " << interpolator_->description() << std::endl;
    out << "storage_limit = " << storage_limit_ << std::endl;
  } else if (Teuchos::as<int>(verbLevel) >= Teuchos::as<int>(Teuchos::VERB_LOW)) {
  } else if (Teuchos::as<int>(verbLevel) >= Teuchos::as<int>(Teuchos::VERB_MEDIUM)) {
  } else if (Teuchos::as<int>(verbLevel) >= Teuchos::as<int>(Teuchos::VERB_HIGH)) {
    out << "data_vec = " << std::endl;
    for (Teuchos::Ordinal i=0; i<data_vec_->size() ; ++i) {
      out << "data_vec[" << i << "] = " << std::endl;
      (*data_vec_)[i].describe(out,this->getVerbLevel());
    }
  }
}


template <class Scalar>
void InterpolationBuffer<Scalar>::setParameterList(RCP<Teuchos::ParameterList> const& paramList)
{
  TEUCHOS_TEST_FOR_EXCEPT( is_null(paramList) );
  paramList->validateParameters(*this->getValidParameters());
  paramList_ = paramList;

  Teuchos::readVerboseObjectSublist(&*paramList_,this);

  //int outputLevel = paramList_->get( "outputLevel", int(-1) );
  //outputLevel = std::min(std::max(outputLevel,-1),4);
  //this->setVerbLevel(static_cast<Teuchos::EVerbosityLevel>(outputLevel));
  IBPolicy policyLevel = interpolationBufferPolicyValidator->getIntegralValue(
      *paramList_, interpolationBufferPolicySelection_name, interpolationBufferPolicySelection_default
      );
  if (policyLevel != BUFFER_POLICY_INVALID) {
    policy_ = policyLevel;
  }
  int storage_limit = paramList_->get( interpolationBufferStorageLimit_name, interpolationBufferStorageLimit_default);
  setStorage(storage_limit);
}

template<class Scalar>
RCP<const Teuchos::ParameterList> InterpolationBuffer<Scalar>::getValidParameters() const
{
  static RCP<Teuchos::ParameterList> validPL;

  if (is_null(validPL)) {

    RCP<Teuchos::ParameterList>
      pl = Teuchos::parameterList();

    Teuchos::setupVerboseObjectSublist(&*pl);

    pl->set(
        interpolationBufferPolicySelection_name,
        interpolationBufferPolicySelection_default,
        "Interpolation Buffer Policy for when the maximum storage size is exceeded.  Static will throw an exception when the storage limit is exceeded.  Keep Newest will over-write the oldest data in the buffer when the storage limit is exceeded.",
        interpolationBufferPolicyValidator
        );

    pl->set(
        interpolationBufferStorageLimit_name,
        interpolationBufferStorageLimit_default,
        "Storage limit for the interpolation buffer."
        );

    validPL = pl;

  }
  return validPL;
}


template <class Scalar>
RCP<Teuchos::ParameterList>
InterpolationBuffer<Scalar>::getNonconstParameterList()
{
  return(paramList_);
}


template <class Scalar>
RCP<Teuchos::ParameterList> InterpolationBuffer<Scalar>::unsetParameterList()
{
  RCP<Teuchos::ParameterList> temp_param_list = paramList_;
  paramList_ = Teuchos::null;
  return(temp_param_list);
}

template <class Scalar>
IBPolicy InterpolationBuffer<Scalar>::getIBPolicy()
{
  return policy_;
}

//
// Explicit Instantiation macro
//
// Must be expanded from within the Rythmos namespace!
//

#define RYTHMOS_INTERPOLATION_BUFFER_INSTANT(SCALAR) \
  \
  template class InterpolationBuffer< SCALAR >; \
  \
  template RCP<InterpolationBuffer< SCALAR > > interpolationBuffer(  \
    const RCP<InterpolatorBase< SCALAR > >& interpolator, \
    int storage  \
    );

} // namespace Rythmos


#endif // Rythmos_INTERPOLATION_BUFFER_DEF_H