Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_SolutionHistory_impl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_SolutionHistory_impl_hpp
10 #define Tempus_SolutionHistory_impl_hpp
11 
12 // Teuchos
13 #include "Teuchos_StandardParameterEntryValidators.hpp"
14 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
15 #include "Teuchos_TimeMonitor.hpp"
16 
17 // Tempus
19 
20 //#include "Thyra_VectorStdOps.hpp"
21 
22 
23 namespace {
24 
25  static std::string Invalid_name = "Invalid";
26  static std::string KeepNewest_name = "Keep Newest";
27  static std::string Undo_name = "Undo";
28  static std::string Static_name = "Static";
29  static std::string Unlimited_name = "Unlimited";
30  static std::string Storage_name = "Storage Type";
31  static std::string Storage_default = Undo_name;
32 
33  static std::string StorageLimit_name = "Storage Limit";
34  static int StorageLimit_default = 2;
35 
36  std::vector<std::string> HistoryPolicies =
37  {Invalid_name, KeepNewest_name, Undo_name, Static_name, Unlimited_name};
38 
39  const Teuchos::RCP<Teuchos::StringToIntegralParameterEntryValidator<Tempus::StorageType> >
40  StorageTypeValidator = Teuchos::rcp(
41  new Teuchos::StringToIntegralParameterEntryValidator<Tempus::StorageType>(
42  HistoryPolicies,
43  Teuchos::tuple<Tempus::StorageType>(
49  Storage_name));
50 
51 } // namespace
52 
53 
54 namespace Tempus {
55 
56 template<class Scalar>
58 {
59  using Teuchos::RCP;
60  // Create history, an array of solution states.
61  history_ = rcp(new std::vector<RCP<SolutionState<Scalar> > >);
62 
63  this->setParameterList(Teuchos::null);
64 
65  if (Teuchos::as<int>(this->getVerbLevel()) >=
66  Teuchos::as<int>(Teuchos::VERB_HIGH)) {
67  RCP<Teuchos::FancyOStream> out = this->getOStream();
68  Teuchos::OSTab ostab(out,1,"SolutionHistory::SolutionHistory");
69  *out << this->description() << std::endl;
70  }
71 }
72 
73 
74 template<class Scalar>
76  std::string name,
77  Teuchos::RCP<std::vector<Teuchos::RCP<SolutionState<Scalar> > > > history,
78  Teuchos::RCP<Interpolator<Scalar> > interpolator,
79  StorageType storageType,
80  int storageLimit)
81 {
82  this->setParameterList(Teuchos::null);
83 
84  this->setName(name);
85  history_ = history;
86  this->setStorageType(storageType);
87  this->setStorageLimit(storageLimit);
88 
89  if (Teuchos::as<int>(this->getVerbLevel()) >=
90  Teuchos::as<int>(Teuchos::VERB_HIGH)) {
91  Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
92  Teuchos::OSTab ostab(out,1,"SolutionHistory::SolutionHistory");
93  *out << this->description() << std::endl;
94  }
95 }
96 
97 
98 template<class Scalar>
100  Teuchos::RCP<Teuchos::ParameterList> pList)
101 {
102  using Teuchos::RCP;
103  // Create history, an array of solution states.
104  history_ = rcp(new std::vector<RCP<SolutionState<Scalar> > >);
105 
106  this->setParameterList(pList);
107 
108  if (Teuchos::as<int>(this->getVerbLevel()) >=
109  Teuchos::as<int>(Teuchos::VERB_HIGH)) {
110  RCP<Teuchos::FancyOStream> out = this->getOStream();
111  Teuchos::OSTab ostab(out,1,"SolutionHistory::SolutionHistory");
112  *out << this->description() << std::endl;
113  }
114 }
115 
116 
117 template<class Scalar>
119  const Teuchos::RCP<SolutionState<Scalar> >& state)
120 {
121  // Check that we're not going to exceed our storage limit:
122  if (Teuchos::as<int>(history_->size()+1) > storageLimit_) {
123  switch (storageType_) {
124  case STORAGE_TYPE_INVALID: {
125  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
126  "Error - Storage type is STORAGE_TYPE_INVALID.\n");
127  break;
128  }
129  case STORAGE_TYPE_STATIC:
131  case STORAGE_TYPE_UNDO: {
132  if (state->getTime() >= history_->front()->getTime()) {
133  // Case: State is older than the youngest state in history.
134  // Remove state from the beginning of history, then add new state.
135  history_->erase(history_->begin());
136  } else {
137  // Case: State is younger than the youngest state in history.
138  Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
139  Teuchos::OSTab ostab(out,1,"SolutionHistory::addState");
140  *out << "Warning, state is younger than youngest state in history. "
141  << "State not added!" << std::endl;
142  return;
143  }
144  break;
145  }
147  break;
148  default:
149  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
150  "Error - unknown storage type.\n");
151  }
152  }
153 
154  // Add new state in chronological order.
155  if (history_->size() == 0) {
156  history_->push_back(state);
157  } else {
158  typename std::vector<Teuchos::RCP<SolutionState<Scalar> > >::iterator
159  state_it = history_->begin();
160  for (; state_it < history_->end(); state_it++) {
161  if (state->getTime() < (*state_it)->getTime()) break;
162  }
163  history_->insert(state_it, state);
164  }
165 
166  TEUCHOS_TEST_FOR_EXCEPTION(getNumStates() <= 0, std::logic_error,
167  "Error - SolutionHistory::addState() Invalid history size!\n");
168 
169  return;
170 }
171 
172 template<class Scalar>
174  const Teuchos::RCP<SolutionState<Scalar> >& state, const bool updateTime)
175 {
176  using Teuchos::RCP;
177 
178  addState(state);
179  workingState_ = (*history_)[getNumStates()-1];
180  auto cs = getCurrentState();
181  auto ws = getWorkingState();
182  ws->setSolutionStatus(Status::WORKING);
183  ws->setIndex(cs->getIndex()+1);
184  if (updateTime) {
185  ws->setTime(cs->getTime() + cs->getTimeStep());
186  ws->setTimeStep(cs->getTimeStep());
187  }
188 }
189 
190 template<class Scalar>
192  const Teuchos::RCP<SolutionState<Scalar> >& state)
193 {
194  if (history_->size() != 0) {
195  auto state_it = history_->rbegin();
196  for ( ; state_it < history_->rend(); state_it++) {
197  if (state->getTime() == (*state_it)->getTime()) break;
198  }
199 
200  TEUCHOS_TEST_FOR_EXCEPTION(state_it == history_->rend(), std::logic_error,
201  "Error - removeState() Could not remove state = "
202  // << state_it->describe()
203  );
204 
205  // Need to be careful when erasing a reverse iterator.
206  history_->erase(std::next(state_it).base());
207  }
208  return;
209 }
210 
211 
212 template<class Scalar>
214 {
215  Teuchos::RCP<SolutionState<Scalar> > tmpState = findState(time);
216  removeState(tmpState);
217 }
218 
219 
220 template<class Scalar>
221 Teuchos::RCP<SolutionState<Scalar> >
222 SolutionHistory<Scalar>::findState(const Scalar time) const
223 {
224  TEUCHOS_TEST_FOR_EXCEPTION(
225  !(minTime() <= time and time <= maxTime()), std::logic_error,
226  "Error - SolutionHistory::findState() Requested time out of range!\n"
227  " [Min, Max] = [" << minTime() << ", " << maxTime() << "]\n"
228  " time = "<< time <<"\n");
229 
230  // Use last step in solution history as the scale for comparing times
231  const Scalar scale =
232  history_->size() > 0 ? (*history_)[history_->size()-1]->getTime() : Scalar(1.0);
233  // Linear search
234  auto state_it = history_->begin();
235  for ( ; state_it < history_->end(); ++state_it) {
236  if (floating_compare_equals((*state_it)->getTime(),time,scale))
237  break;
238  }
239 
240  TEUCHOS_TEST_FOR_EXCEPTION(state_it == history_->end(), std::logic_error,
241  "Error - SolutionHistory::findState()!\n"
242  " Did not find a SolutionState with time = " <<time<< std::endl);
243 
244  return *state_it;
245 }
246 
247 
248 template<class Scalar>
249 Teuchos::RCP<SolutionState<Scalar> >
251 {
252  Teuchos::RCP<SolutionState<Scalar> > state_out = getCurrentState()->clone();
253  interpolate<Scalar>(*interpolator_, history_, time, state_out.get());
254  return state_out;
255 }
256 
257 
258 template<class Scalar>
259 void
261  const Scalar time, SolutionState<Scalar>* state_out) const
262 {
263  interpolate<Scalar>(*interpolator_, history_, time, state_out);
264 }
265 
266 
267 /** Initialize the working state */
268 template<class Scalar>
270 {
271  TEMPUS_FUNC_TIME_MONITOR("Tempus::SolutionHistory::initWorkingState()");
272  {
273  TEUCHOS_TEST_FOR_EXCEPTION(getCurrentState() == Teuchos::null,
274  std::logic_error,
275  "Error - SolutionHistory::initWorkingState()\n"
276  "Can not initialize working state without a current state!\n");
277 
278  // If workingState_ has a valid pointer, we are still working on it,
279  // i.e., step failed and trying again, so do not initialize it.
280  if (getWorkingState(false) != Teuchos::null) return;
281 
282  Teuchos::RCP<SolutionState<Scalar> > newState;
283  if (getNumStates() < storageLimit_) {
284  // Create newState which is duplicate of currentState
285  newState = getCurrentState()->clone();
286  } else {
287  // Recycle old state and copy currentState
288  newState = (*history_)[0];
289  history_->erase(history_->begin());
290  if (getNumStates() > 0) newState->copy(getCurrentState());
291  // When using the Griewank algorithm, we will want to select which
292  // older state to recycle.
293  }
294 
295  addWorkingState(newState);
296 
297  }
298  return;
299 }
300 
301 
302 template<class Scalar>
304 {
305  auto ws = getWorkingState();
306 
307  if ( ws->getSolutionStatus() == Status::PASSED ) {
308  ws->setNFailures(std::max(0,ws->getNFailures()-1));
309  ws->setNConsecutiveFailures(0);
310  ws->setSolutionStatus(Status::PASSED);
311  //ws->setIsSynced(true);
312  ws->setIsInterpolated(false);
313  workingState_ = Teuchos::null;
314  } else {
315  Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
316  Teuchos::OSTab ostab(out,1,"SolutionHistory::promoteWorkingState()");
317  *out << "Warning - WorkingState is not passing, so not promoted!\n"
318  << std::endl;
319  }
320 }
321 
322 
323 template<class Scalar>
325 {
326  storageLimit_ = std::max(1,storage_limit);
327 
328  TEUCHOS_TEST_FOR_EXCEPTION(
329  (Teuchos::as<int>(history_->size()) > storageLimit_), std::logic_error,
330  "Error - requested storage limit = " << storageLimit_
331  << " is smaller than the current number of states stored = "
332  << history_->size() << "!\n");
333 }
334 
335 
336 template<class Scalar>
337 Teuchos::RCP<SolutionState<Scalar> >
339 {
340  const int m = history_->size();
341  TEUCHOS_TEST_FOR_EXCEPTION( (m < 1), std::out_of_range,
342  "Error - getStateTimeIndexN() No states in SolutionHistory!\n");
343  return (*history_)[m-1];
344 }
345 
346 
347 template<class Scalar>
348 Teuchos::RCP<SolutionState<Scalar> >
350 {
351  const int m = history_->size();
352  TEUCHOS_TEST_FOR_EXCEPTION( (m < 2), std::out_of_range,
353  "Error - getStateTimeIndexNM1() Not enough states in "
354  << "SolutionHistory!\n");
355  const int n = (*history_)[m-1]->getIndex();
356  const int nm1 = (*history_)[m-2]->getIndex();
357 
358  // No need to search SolutionHistory as states n and nm1 should be
359  // next to each other.
360  TEUCHOS_TEST_FOR_EXCEPTION( (nm1 != n-1), std::out_of_range,
361  "Error - getStateTimeIndexNM1() Timestep index n-1 is not in "
362  << "SolutionHistory!\n"
363  << " (n)th index = " << n << "\n"
364  << " (n-1)th index = " << nm1 << "\n");
365 
366  return (*history_)[m-2];
367 }
368 
369 
370 template<class Scalar>
371 Teuchos::RCP<SolutionState<Scalar> >
373 {
374  const int m = history_->size();
375  TEUCHOS_TEST_FOR_EXCEPTION( (m < 3), std::out_of_range,
376  "Error - getStateTimeIndexNM2() Not enough states in "
377  << "SolutionHistory!\n");
378  const int n = (*history_)[m-1]->getIndex();
379  const int nm2 = (*history_)[m-3]->getIndex();
380 
381  // Assume states n and nm2 are one away from each other.
382  // May need to do a search otherwise.
383  TEUCHOS_TEST_FOR_EXCEPTION( (nm2 != n-2), std::out_of_range,
384  "Error - getStateTimeIndexNM2() Timestep index n-2 is not in "
385  << "SolutionHistory!\n"
386  << " (n)th index = " << n << "\n"
387  << " (n-2)th index = " << nm2 << "\n");
388 
389  return (*history_)[m-3];
390 }
391 
392 
393 template<class Scalar>
394 Teuchos::RCP<SolutionState<Scalar> >
396 {
397  typename std::vector<Teuchos::RCP<SolutionState<Scalar> > >::iterator
398  state_it = history_->begin();
399  for (; state_it < history_->end(); state_it++) {
400  if ((*state_it)->getIndex() == index) break;
401  }
402  TEUCHOS_TEST_FOR_EXCEPTION( state_it==history_->end(), std::out_of_range,
403  "Error - getStateTimeIndex() Timestep index is not in "
404  << "SolutionHistory!\n"
405  << " index = " << index << "\n");
406  return (*state_it);
407 }
408 
409 
410 template<class Scalar>
412 {
413  return ("Tempus::SolutionHistory - name = '" + name_ + "'");
414 }
415 
416 
417 template<class Scalar>
419  Teuchos::FancyOStream &out,
420  const Teuchos::EVerbosityLevel verbLevel) const
421 {
422  if ((Teuchos::as<int>(verbLevel)==Teuchos::as<int>(Teuchos::VERB_DEFAULT)) ||
423  (Teuchos::as<int>(verbLevel)>=Teuchos::as<int>(Teuchos::VERB_LOW) ) ){
424  out << description() << "::describe" << std::endl;
425  //out << "interpolator = " << interpolator->description() << std::endl;
426  out << "storageLimit = " << storageLimit_ << std::endl;
427  out << "storageType = " << storageType_ << std::endl;
428  out << "number of states = " << history_->size() << std::endl;
429  out << "time range = (" << history_->front()->getTime() << ", "
430  << history_->back()->getTime() << ")"
431  << std::endl;
432  } else if (Teuchos::as<int>(verbLevel) >=
433  Teuchos::as<int>(Teuchos::VERB_HIGH)) {
434  out << "SolutionStates: " << std::endl;
435  for (int i=0; i<(int)history_->size() ; ++i) {
436  out << "SolutionState[" << i << "] = " << std::endl;
437  (*history_)[i]->describe(out,this->getVerbLevel());
438  }
439  }
440 }
441 
442 
443 template <class Scalar>
445  Teuchos::RCP<Teuchos::ParameterList> const& pList)
446 {
447  if (pList == Teuchos::null) {
448  // Create default parameters if null, otherwise keep current parameters.
449  if (shPL_ == Teuchos::null) {
450  shPL_ = Teuchos::parameterList("Solution History");
451  *shPL_ = *(this->getValidParameters());
452  }
453  } else {
454  shPL_ = pList;
455  }
456  shPL_->validateParametersAndSetDefaults(*this->getValidParameters());
457 
458  name_ = shPL_->name();
459 
460  storageType_ = StorageTypeValidator->getIntegralValue(
461  *shPL_, Storage_name, Storage_default);
462 
463  int storage_limit = shPL_->get(StorageLimit_name, StorageLimit_default);
464 
465  switch (storageType_) {
468  storageType_ = STORAGE_TYPE_KEEP_NEWEST;
469  if (storage_limit != 1) {
470  Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
471  Teuchos::OSTab ostab(out,1,"SolutionHistory::setParameterList");
472  *out << "Warning - 'Storage Limit' for 'Keep Newest' is 1.\n"
473  << " (Storage Limit = "<<storage_limit<<"). Resetting to 1."
474  << std::endl;
475  storage_limit = 1;
476  }
477  setStorageLimit(storage_limit);
478  break;
479  }
480  case STORAGE_TYPE_UNDO: {
481  if (storage_limit != 2) {
482  Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
483  Teuchos::OSTab ostab(out,1,"SolutionHistory::setParameterList");
484  *out << "Warning - 'Storage Limit' for 'Undo' is 2.\n"
485  << " (Storage Limit = "<<storage_limit<<"). Resetting to 2."
486  << std::endl;
487  storage_limit = 2;
488  }
489  setStorageLimit(storage_limit);
490  break;
491  }
492  case STORAGE_TYPE_STATIC: {
493  break;
494  }
495  case STORAGE_TYPE_UNLIMITED: {
496  storage_limit = 1000000000;
497  break;
498  }
499  }
500  setStorageLimit(storage_limit);
501 
503  Teuchos::sublist(shPL_, "Interpolator"));
504 }
505 
506 
507 template<class Scalar>
508 Teuchos::RCP<const Teuchos::ParameterList>
510 {
511  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
512 
513  pl->setName("Valid ParameterList");
514 
515  pl->set(Storage_name, Storage_default,
516  "'Storage Type' sets the memory storage. "
517  "'Keep Newest' - will retain the single newest solution state. "
518  "'Undo' - will retain two solution states in order to do a single undo. "
519  "'Static' - will retain 'Storage Limit' number of solution states. "
520  "'Unlimited' - will not remove any solution states!",
521  StorageTypeValidator);
522 
523  pl->set(StorageLimit_name, StorageLimit_default,
524  "Storage limit for the solution history.");
525 
526  // Interpolator
527  pl->sublist("Interpolator",false,"").disableRecursiveValidation();
528 
529  return pl;
530 }
531 
532 
533 template <class Scalar>
534 Teuchos::RCP<Teuchos::ParameterList>
536 {
537  return(shPL_);
538 }
539 
540 
541 template <class Scalar>
542 Teuchos::RCP<Teuchos::ParameterList>
544 {
545  Teuchos::RCP<Teuchos::ParameterList> temp_plist = shPL_;
546  shPL_ = Teuchos::null;
547  return(temp_plist);
548 }
549 
550 template<class Scalar>
552  const Teuchos::RCP<Interpolator<Scalar> >& interpolator)
553 {
554  if (interpolator == Teuchos::null) {
556  } else {
557  interpolator_ = interpolator;
558  }
559  if (Teuchos::as<int>(this->getVerbLevel()) >=
560  Teuchos::as<int>(Teuchos::VERB_HIGH)) {
561  Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
562  Teuchos::OSTab ostab(out,1,"SolutionHistory::setInterpolator");
563  *out << "interpolator = " << interpolator_->description() << std::endl;
564  }
565 }
566 
567 template<class Scalar>
568 Teuchos::RCP<Interpolator<Scalar> >
570 {
571  return interpolator_;
572 }
573 
574 template<class Scalar>
575 Teuchos::RCP<const Interpolator<Scalar> >
577 {
578  return interpolator_;
579 }
580 
581 template<class Scalar>
582 Teuchos::RCP<Interpolator<Scalar> >
584 {
585  Teuchos::RCP<Interpolator<Scalar> > old_interpolator = interpolator_;
586  interpolator_ = lagrangeInterpolator<Scalar>();
587  return old_interpolator;
588 }
589 
590 // Nonmember constructors.
591 // ------------------------------------------------------------------------
592 
593 template<class Scalar>
594 Teuchos::RCP<SolutionHistory<Scalar> > createSolutionHistoryPL(
595  Teuchos::RCP<Teuchos::ParameterList> pList)
596 {
597  auto sh = rcp(new SolutionHistory<Scalar>(pList));
598  return sh;
599 }
600 
601 
602 template<class Scalar>
603 Teuchos::RCP<SolutionHistory<Scalar> >
605 {
606  auto sh = rcp(new SolutionHistory<Scalar>());
607  sh->setName("From createSolutionHistoryState");
608  sh->addState(state);
609  return sh;
610 }
611 
612 
613 template<class Scalar>
614 Teuchos::RCP<SolutionHistory<Scalar> >
616  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model)
617 {
618  // Setup initial condition SolutionState --------------------
619  auto state = createSolutionStateME(model);
620  state->setTime (0.0);
621  state->setIndex (0);
622  state->setTimeStep(0.0);
623  state->setOrder (1);
624 
625  // Setup SolutionHistory ------------------------------------
626  auto sh = rcp(new SolutionHistory<Scalar>());
627  sh->setName("From createSolutionHistoryME");
628  sh->addState(state);
629 
630  return sh;
631 }
632 
633 
634 } // namespace Tempus
635 #endif // Tempus_SolutionHistory_impl_hpp
Teuchos::RCP< SolutionState< Scalar > > getStateTimeIndexNM2() const
Get the state with timestep index equal to n-2.
Teuchos::RCP< Interpolator< Scalar > > unSetInterpolator()
Unset the interpolator for this history.
Keep the 2 newest states for undo.
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
void initWorkingState()
Initialize the working state.
Teuchos::RCP< SolutionState< Scalar > > interpolateState(const Scalar time) const
Generate and interpolate a new solution state at requested time.
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Teuchos::RCP< Interpolator< Scalar > > getNonconstInterpolator()
void setStorageLimit(int storage_limit)
Set the maximum storage of this history.
Teuchos::RCP< SolutionHistory< Scalar > > createSolutionHistoryPL(Teuchos::RCP< Teuchos::ParameterList > pList)
Nonmember constructor from a ParameterList.
Teuchos::RCP< SolutionHistory< Scalar > > createSolutionHistoryME(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Nonmember contructor from a Thyra ModelEvaluator.
static Teuchos::RCP< Interpolator< Scalar > > createInterpolator(std::string interpolatorType="")
Create default interpolator from interpolator type (e.g., &quot;Linear&quot;).
Teuchos::RCP< SolutionState< Scalar > > getStateTimeIndexNM1() const
Get the state with timestep index equal to n-1.
void promoteWorkingState()
Promote the working state to current state.
void removeState(const Teuchos::RCP< SolutionState< Scalar > > &state)
Remove solution state.
Base strategy class for interpolation functionality.
virtual std::string description() const
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
void addState(const Teuchos::RCP< SolutionState< Scalar > > &state)
Add solution state to history.
Teuchos::RCP< SolutionState< Scalar > > createSolutionStateME(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const Teuchos::RCP< StepperState< Scalar > > &stepperState=Teuchos::null, const Teuchos::RCP< PhysicsState< Scalar > > &physicsState=Teuchos::null)
Nonmember constructor from Thyra ModelEvaluator.
void addWorkingState(const Teuchos::RCP< SolutionState< Scalar > > &state, const bool updateTime=true)
Add a working solution state to history.
Keep a fix number of states.
Teuchos::RCP< SolutionHistory< Scalar > > createSolutionHistoryState(const Teuchos::RCP< SolutionState< Scalar > > &state)
Nonmember contructor from a SolutionState.
Teuchos::RCP< SolutionState< Scalar > > getStateTimeIndex(int index) const
Get the state with timestep index equal to &quot;index&quot;.
Teuchos::RCP< SolutionState< Scalar > > getStateTimeIndexN() const
Get the state with timestep index equal to n.
Teuchos::RCP< const Interpolator< Scalar > > getInterpolator() const
bool floating_compare_equals(const Scalar &a, const Scalar &b, const Scalar &scale)
Helper function for comparing times.
void setInterpolator(const Teuchos::RCP< Interpolator< Scalar > > &interpolator)
Set the interpolator for this history.
Teuchos::RCP< SolutionState< Scalar > > findState(const Scalar time) const
Find solution state at requested time (no interpolation)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Solution state for integrators and steppers. SolutionState contains the metadata for solutions and th...