Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Rythmos_StackedStepper.hpp
1 //@HEADER
2 // ***********************************************************************
3 //
4 // Rythmos Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25 //
26 // ***********************************************************************
27 //@HEADER
28 
29 #ifndef RYTHMOS_STACKED_STEPPER_HPP
30 #define RYTHMOS_STACKED_STEPPER_HPP
31 
32 
33 #include "Rythmos_StepperBase.hpp"
34 #include "Thyra_ModelEvaluatorHelpers.hpp"
35 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
36 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
37 #include "Teuchos_Assert.hpp"
38 #include "Teuchos_as.hpp"
39 
40 // Includes for ForwardSensitivityStackedStepper
41 #include "Rythmos_ForwardSensitivityModelEvaluatorBase.hpp"
42 
43 namespace Rythmos {
44 
45 template<class Scalar>
46 class StackedStepperStepStrategyBase
47 {
48  public:
49  virtual ~StackedStepperStepStrategyBase() {}
50  virtual void setupNextStepper(
51  int i,
52  Array<RCP<StepperBase<Scalar> > > &stepperArray
53  ) = 0;
54  virtual Scalar evaluateStep(
55  Scalar local_dt_taken,
56  int i,
57  Array<RCP<StepperBase<Scalar> > > &stepperArray
58  ) = 0;
59 };
60 
61 template<class Scalar>
62 class DefaultStackedStepperStepStrategy
63  : virtual public StackedStepperStepStrategyBase<Scalar>
64 {
65  public:
66  DefaultStackedStepperStepStrategy();
67  virtual ~DefaultStackedStepperStepStrategy();
68  void setupNextStepper(
69  int i,
70  Array<RCP<StepperBase<Scalar> > > &stepperArray
71  );
72  Scalar evaluateStep(
73  Scalar local_dt_taken,
74  int i,
75  Array<RCP<StepperBase<Scalar> > > &stepperArray
76  );
77  private:
78  Scalar dt_taken_;
79 };
80 
81 // Nonmember constructor declaration
82 template<class Scalar>
83 RCP<DefaultStackedStepperStepStrategy<Scalar> >
84 defaultStackedStepperStepStrategy();
85 
86 // Nonmember constructor definition
87 template<class Scalar>
88 RCP<DefaultStackedStepperStepStrategy<Scalar> >
89 defaultStackedStepperStepStrategy()
90 {
91  return Teuchos::rcp(new DefaultStackedStepperStepStrategy<Scalar>());
92 }
93 
94 template<class Scalar>
95 DefaultStackedStepperStepStrategy<Scalar>::DefaultStackedStepperStepStrategy()
96 {
97  typedef Teuchos::ScalarTraits<Scalar> ST;
98  dt_taken_ = ST::nan();
99 }
100 
101 
102 template<class Scalar>
103 DefaultStackedStepperStepStrategy<Scalar>::~DefaultStackedStepperStepStrategy()
104 {
105 }
106 
107 
108 template<class Scalar>
109 void DefaultStackedStepperStepStrategy<Scalar>::setupNextStepper(
110  int i,
111  Array<RCP<StepperBase<Scalar> > > &stepperArray
112  )
113 {
114  if (i > 0) {
115  RCP<StepperBase<Scalar> > baseStepper = stepperArray[0];
116  stepperArray[i]->setStepControlData(*baseStepper);
117  }
118 }
119 
120 
121 template<class Scalar>
122 Scalar DefaultStackedStepperStepStrategy<Scalar>::evaluateStep(
123  Scalar local_dt_taken,
124  int i,
125  Array<RCP<StepperBase<Scalar> > > &stepperArray
126  )
127 {
128  if (i == 0) {
129  dt_taken_ = local_dt_taken;
130  }
131  else {
132  TEUCHOS_TEST_FOR_EXCEPTION( local_dt_taken != dt_taken_, std::logic_error,
133  "Error! sub-stepper["<<i<<"] did not take the same "
134  "size step as the base stepper!"
135  );
136  }
137  return dt_taken_;
138 }
139 
140 
141 
142 template<class Scalar>
143 class ForwardSensitivityStackedStepperStepStrategy
144  : virtual public StackedStepperStepStrategyBase<Scalar>
145 {
146  public:
147  ForwardSensitivityStackedStepperStepStrategy();
148  virtual ~ForwardSensitivityStackedStepperStepStrategy();
149  void setupNextStepper(
150  int i,
151  Array<RCP<StepperBase<Scalar> > > &stepperArray
152  );
153  Scalar evaluateStep(
154  Scalar local_dt_taken,
155  int i,
156  Array<RCP<StepperBase<Scalar> > > &stepperArray
157  );
158  void setStateBasePoint(
159  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &stateBasePoint
160  );
161  private:
162  Scalar dt_taken_;
163  Thyra::ModelEvaluatorBase::InArgs<Scalar> stateBasePoint_;
164 };
165 
166 // Nonmember constructor declaration
167 template<class Scalar>
168 RCP<ForwardSensitivityStackedStepperStepStrategy<Scalar> >
169 forwardSensitivityStackedStepperStepStrategy();
170 
171 // Nonmember constructor definition
172 template<class Scalar>
173 RCP<ForwardSensitivityStackedStepperStepStrategy<Scalar> >
174 forwardSensitivityStackedStepperStepStrategy()
175 {
176  return Teuchos::rcp(new ForwardSensitivityStackedStepperStepStrategy<Scalar>());
177 }
178 
179 template<class Scalar>
180 ForwardSensitivityStackedStepperStepStrategy<Scalar>::ForwardSensitivityStackedStepperStepStrategy()
181 {
182  typedef Teuchos::ScalarTraits<Scalar> ST;
183  dt_taken_ = ST::nan();
184 }
185 
186 
187 template<class Scalar>
188 ForwardSensitivityStackedStepperStepStrategy<Scalar>::~ForwardSensitivityStackedStepperStepStrategy()
189 {
190 }
191 
192 
193 template<class Scalar>
194 void ForwardSensitivityStackedStepperStepStrategy<Scalar>::setupNextStepper(
195  int i,
196  Array<RCP<StepperBase<Scalar> > > &stepperArray
197  )
198 {
199  typedef Thyra::ModelEvaluatorBase MEB;
200  if (i > 0) {
201  RCP<StepperBase<Scalar> > baseStepper = stepperArray[0];
202  RCP<Thyra::ModelEvaluator<Scalar> > modelI =
203  // TODO: 09/09/09 tscoffe: This should be replaced by
204  // getNonconstModel() when it is implemented correctly.
205  Teuchos::rcp_const_cast<Thyra::ModelEvaluator<Scalar> >(
206  stepperArray[i]->getModel()
207  );
208  RCP<ForwardSensitivityModelEvaluatorBase<Scalar> > fwdSensME =
209  Teuchos::rcp_dynamic_cast<ForwardSensitivityModelEvaluatorBase<Scalar> > (
210  modelI,false
211  );
212  if (Teuchos::nonnull(fwdSensME)) {
213  bool forceUpToDateW = true;
214  fwdSensME->initializePointState( Teuchos::inOutArg(*baseStepper), forceUpToDateW);
215  }
216  stepperArray[i]->setStepControlData(*baseStepper);
217  }
218 }
219 
220 
221 template<class Scalar>
222 Scalar ForwardSensitivityStackedStepperStepStrategy<Scalar>::evaluateStep(
223  Scalar local_dt_taken,
224  int i,
225  Array<RCP<StepperBase<Scalar> > > &stepperArray
226  )
227 {
228  if (i == 0) {
229  dt_taken_ = local_dt_taken;
230  }
231  else {
232  TEUCHOS_TEST_FOR_EXCEPTION( local_dt_taken != dt_taken_, std::logic_error,
233  "Error! sub-stepper["<<i<<"] did not take the same "
234  "size step as the base stepper!"
235  );
236  }
237  return dt_taken_;
238 }
239 
240 
241 template<class Scalar>
242 void ForwardSensitivityStackedStepperStepStrategy<Scalar>::setStateBasePoint(
243  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &stateBasePoint
244  )
245 {
246  stateBasePoint_ = stateBasePoint;
247 }
248 
249 
250 template<class Scalar>
251 class StackedStepper
252  : virtual public StepperBase<Scalar>,
253  virtual public Teuchos::ParameterListAcceptorDefaultBase
254 {
255 public:
256 
258  typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
259 
262 
264  StackedStepper();
265 
268  void addStepper(const RCP<StepperBase<Scalar> >& stepper);
269 
272  ArrayView<const RCP<StepperBase<Scalar> > > getNonconstSteppers() const;
273 
276  void setStackedStepperStepControlStrategy(
277  const RCP<StackedStepperStepStrategyBase<Scalar> >& stepControl
278  );
279 
282  RCP<const StackedStepperStepStrategyBase<Scalar> >
283  getStackedStepperStepCongrolStrategy() const;
284 
286 
289 
291  void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
293  RCP<const Teuchos::ParameterList> getValidParameters() const;
294 
296 
299 
301  bool acceptsModel() const;
302 
304  void setModel(
305  const RCP<const Thyra::ModelEvaluator<Scalar> >& model
306  );
307 
309  void setNonconstModel(
310  const RCP<Thyra::ModelEvaluator<Scalar> >& model
311  );
312 
319  RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const;
320 
322  RCP<Thyra::ModelEvaluator<Scalar> > getNonconstModel();
323 
336  void setInitialCondition(
337  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &stacked_ic
338  );
339 
340  /* \brief Get the initial condigion
341  */
342  Thyra::ModelEvaluatorBase::InArgs<Scalar> getInitialCondition() const;
343 
345  Scalar takeStep( Scalar dt, StepSizeType stepType );
346 
348  const StepStatus<Scalar> getStepStatus() const;
349 
351 
354 
361  RCP<const Thyra::VectorSpaceBase<Scalar> >
362  get_x_space() const;
363 
365  void addPoints(
366  const Array<Scalar>& time_vec,
367  const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& x_vec,
368  const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec
369  );
370 
372  TimeRange<Scalar> getTimeRange() const;
373 
375  void getPoints(
376  const Array<Scalar>& time_vec,
377  Array<RCP<const Thyra::VectorBase<Scalar> > >* x_vec,
378  Array<RCP<const Thyra::VectorBase<Scalar> > >* xdot_vec,
379  Array<ScalarMag>* accuracy_vec
380  ) const;
381 
383  void getNodes(Array<Scalar>* time_vec) const;
384 
386  void removeNodes(Array<Scalar>& time_vec);
387 
389  int getOrder() const;
390 
392 
393 private:
394 
395  mutable bool isInitialized_;
396 
397  Array<RCP<StepperBase<Scalar> > > stepperArray_;
398 
399  mutable Array<RCP<const Thyra::VectorSpaceBase<Scalar> > > xSpaceArray_;
400  //Array<RCP<const Thyra::VectorSpaceBase<Scalar> > > fSpaceArray_;
401 
402  mutable Teuchos::RCP<const Thyra::ProductVectorSpaceBase<Scalar> >
403  x_bar_space_;
404  //Teuchos::RCP<const Thyra::ProductVectorSpaceBase<Scalar> >
405  // f_bar_space_;
406 
407  RCP<StackedStepperStepStrategyBase<Scalar> > stackedStepperStepStrategy_;
408 
409  // Private functions:
410  void setupSpaces_() const;
411 
412 };
413 
414 
419 template<class Scalar>
420 inline
421 RCP<StackedStepper<Scalar> >
422 stackedStepper()
423 {
424  return Teuchos::rcp(new StackedStepper<Scalar>());
425 }
426 
427 
428 // Constructors, Intializers, Misc.
429 
430 
431 template<class Scalar>
432 StackedStepper<Scalar>::StackedStepper()
433  : isInitialized_(false)
434 {}
435 
436 template<class Scalar>
437 void StackedStepper<Scalar>::setupSpaces_() const
438 {
439  using Teuchos::as;
440  if (!isInitialized_) {
441  for (int i=0 ; i < as<int>(stepperArray_.size()) ; ++i) {
442  xSpaceArray_.push_back(stepperArray_[i]->get_x_space());
443  //fSpaceArray_.push_back(stepperArray_[i]->get_f_space());
444  }
445 
446  x_bar_space_ = Thyra::productVectorSpace<Scalar>(xSpaceArray_);
447  //f_bar_space_ = Thyra::productVectorSpace<Scalar>(fSpaceArray_);
448 
449  isInitialized_ = true;
450  }
451 }
452 
453 template<class Scalar>
454 void StackedStepper<Scalar>::addStepper(
455  const RCP<StepperBase<Scalar> >& stepper
456  )
457 {
458  TEUCHOS_ASSERT(!is_null(stepper));
459  stepperArray_.push_back(stepper);
460  isInitialized_ = false;
461 }
462 
463 
464 
465 template<class Scalar>
466 ArrayView<const RCP<StepperBase<Scalar> > >
467 StackedStepper<Scalar>::getNonconstSteppers() const
468 {
469  return stepperArray_();
470 }
471 
472 
473 template<class Scalar>
474 void StackedStepper<Scalar>::setStackedStepperStepControlStrategy(
475  const RCP<StackedStepperStepStrategyBase<Scalar> >& stepControl
476  )
477 {
478  TEUCHOS_ASSERT( Teuchos::nonnull(stepControl) );
479  stackedStepperStepStrategy_ = stepControl;
480 }
481 
482 
483 template<class Scalar>
484 RCP<const StackedStepperStepStrategyBase<Scalar> >
485 StackedStepper<Scalar>::getStackedStepperStepCongrolStrategy() const
486 {
487  return stackedStepperStepStrategy_;
488 }
489 
490 
491 template<class Scalar>
492 void StackedStepper<Scalar>::setParameterList(
493  RCP<Teuchos::ParameterList> const& paramList
494  )
495 {
496  TEUCHOS_TEST_FOR_EXCEPT(is_null(paramList));
497  paramList->validateParameters(*getValidParameters());
498  this->setMyParamList(paramList);
499  Teuchos::readVerboseObjectSublist(&*paramList,this);
500 }
501 
502 
503 template<class Scalar>
504 RCP<const Teuchos::ParameterList>
505 StackedStepper<Scalar>::getValidParameters() const
506 {
507  static RCP<const ParameterList> validPL;
508  if (is_null(validPL) ) {
509  RCP<ParameterList> pl = Teuchos::parameterList();
510  Teuchos::setupVerboseObjectSublist(&*pl);
511  validPL = pl;
512  }
513  return validPL;
514 }
515 
516 
517 // Overridden from StepperBase
518 
519 template<class Scalar>
520 bool StackedStepper<Scalar>::acceptsModel() const
521 {
522  return false;
523 }
524 
525 template<class Scalar>
526 void StackedStepper<Scalar>::setModel(
527  const RCP<const Thyra::ModelEvaluator<Scalar> >& model
528  )
529 {
530  TEUCHOS_TEST_FOR_EXCEPT_MSG( true,
531  "Error, this stepper subclass does not accept a model"
532  " as defined by the StepperBase interface!");
533 }
534 
535 
536 template<class Scalar>
537 void StackedStepper<Scalar>::setNonconstModel(
538  const RCP<Thyra::ModelEvaluator<Scalar> >& model
539  )
540 {
541  TEUCHOS_TEST_FOR_EXCEPT_MSG( true,
542  "Error, this stepper subclass does not accept a model"
543  " as defined by the StepperBase interface!");
544 }
545 
546 
547 template<class Scalar>
548 RCP<const Thyra::ModelEvaluator<Scalar> >
549 StackedStepper<Scalar>::getModel() const
550 {
551  TEUCHOS_TEST_FOR_EXCEPT(true);
552  return Teuchos::null;
553 }
554 
555 
556 template<class Scalar>
557 RCP<Thyra::ModelEvaluator<Scalar> >
558 StackedStepper<Scalar>::getNonconstModel()
559 {
560  TEUCHOS_TEST_FOR_EXCEPT(true);
561  return Teuchos::null;
562 }
563 
564 
565 template<class Scalar>
566 void StackedStepper<Scalar>::setInitialCondition(
567  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &stacked_ic
568  )
569 {
570  TEUCHOS_TEST_FOR_EXCEPT(true);
571 }
572 
573 
574 template<class Scalar>
575 Thyra::ModelEvaluatorBase::InArgs<Scalar>
576 StackedStepper<Scalar>::getInitialCondition() const
577 {
578  TEUCHOS_TEST_FOR_EXCEPT(true);
579  Thyra::ModelEvaluatorBase::InArgs<Scalar> inArgs;
580  return inArgs;
581 }
582 
583 
584 template<class Scalar>
585 Scalar
586 StackedStepper<Scalar>::takeStep(
587  Scalar dt, StepSizeType stepType
588  )
589 {
590  typedef Teuchos::ScalarTraits<Scalar> ST;
591 
592  TEUCHOS_TEST_FOR_EXCEPTION( stepperArray_.size() == 0, std::logic_error,
593  "Error! Rythmos::StackedStepper::takeStep: "
594  "addStepper must be called at least once before takeStep!"
595  );
596  this->setupSpaces_();
597 
598  RYTHMOS_FUNC_TIME_MONITOR("Rythmos:StackedStepper::takeStep");
599 
600  if (Teuchos::is_null(stackedStepperStepStrategy_)) {
601  stackedStepperStepStrategy_ = defaultStackedStepperStepStrategy<Scalar>();
602  }
603 
604  Scalar dt_taken = Scalar(-ST::one());
605  for (int i=0 ; i<Teuchos::as<int>(stepperArray_.size()) ; ++i) {
606  stackedStepperStepStrategy_->setupNextStepper(i,stepperArray_);
607  Scalar local_dt_taken = stepperArray_[i]->takeStep(dt,stepType);
608  dt_taken = stackedStepperStepStrategy_->evaluateStep(
609  local_dt_taken,
610  i,
611  stepperArray_
612  );
613  }
615  //RCP<StepperBase<Scalar> > baseStepper = stepperArray_[0];
616  //Scalar dt_taken = baseStepper->takeStep(dt,stepType);
617  //for (int i=1 ; i<Teuchos::as<int>(stepperArray_.size()) ; ++i) {
618  // // 07/27/09 tscoffe: This line should be handled by a strategy object
619  // stepperArray_[i]->setStepControlData(*baseStepper);
620  // Scalar local_dt_taken = stepperArray_[i]->takeStep(dt,stepType);
621  // TEUCHOS_TEST_FOR_EXCEPTION( local_dt_taken != dt_taken, std::logic_error,
622  // "Error! sub-stepper["<<i<<"] did not take the same "
623  // "size step as the base stepper!"
624  // );
625  //}
626  return dt_taken;
627 }
628 
629 
630 template<class Scalar>
631 const StepStatus<Scalar>
632 StackedStepper<Scalar>::getStepStatus() const
633 {
634  TEUCHOS_TEST_FOR_EXCEPT(true);
635  const StepStatus<Scalar> stepStatus;
636  return stepStatus;
637 
638 }
639 
640 
641 // Overridden from InterpolationBufferBase
642 
643 
644 template<class Scalar>
645 RCP<const Thyra::VectorSpaceBase<Scalar> >
646 StackedStepper<Scalar>::get_x_space() const
647 {
648  this->setupSpaces_();
649  TEUCHOS_TEST_FOR_EXCEPTION( is_null(x_bar_space_), std::logic_error,
650  "Rythmos::StackedStepper::get_x_space(): "
651  "addStepper must be called at least once before get_x_space()!"
652  );
653  return(x_bar_space_);
654 }
655 
656 
657 template<class Scalar>
658 void StackedStepper<Scalar>::addPoints(
659  const Array<Scalar>& time_vec,
660  const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& x_vec,
661  const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec
662  )
663 {
664  TEUCHOS_TEST_FOR_EXCEPT(
665  "Not implemented addPoints(...) yet but we could if we wanted!"
666  );
667 }
668 
669 
670 template<class Scalar>
671 TimeRange<Scalar>
672 StackedStepper<Scalar>::getTimeRange() const
673 {
674  TEUCHOS_TEST_FOR_EXCEPT(true);
675  TimeRange<Scalar> tr;
676  return tr;
677 }
678 
679 
680 template<class Scalar>
681 void StackedStepper<Scalar>::getPoints(
682  const Array<Scalar>& time_vec,
683  Array<RCP<const Thyra::VectorBase<Scalar> > >* x_bar_vec,
684  Array<RCP<const Thyra::VectorBase<Scalar> > >* x_bar_dot_vec,
685  Array<ScalarMag>* accuracy_vec
686  ) const
687 {
688  using Teuchos::as;
689  this->setupSpaces_();
690  TEUCHOS_TEST_FOR_EXCEPTION( stepperArray_.size() == 0, std::logic_error,
691  "Rythmos::StackedStepper:getPoints: Error! "
692  "addStepper must be called at least once before getPoints!"
693  );
694  int numSteppers = as<int>(stepperArray_.size());
695  int numTimePoints = as<int>(time_vec.size());
696 
697  // Set up local x_bar_vec for filling:
698  Array<RCP<Thyra::VectorBase<Scalar> > > x_bar_vec_local;
699  if (x_bar_vec != NULL) {
700  x_bar_vec_local.clear();
701  x_bar_vec->clear();
702  for (int n = 0 ; n < numTimePoints ; ++n) {
703  x_bar_vec_local.push_back(Thyra::createMember(this->get_x_space()));
704  x_bar_vec->push_back(x_bar_vec_local[n]);
705  }
706  }
707 
708  // Set up local x_bar_dot_vec for filling:
709  Array<RCP<Thyra::VectorBase<Scalar> > > x_bar_dot_vec_local;
710  if (x_bar_dot_vec != NULL) {
711  x_bar_dot_vec_local.clear();
712  x_bar_dot_vec->clear();
713  for (int n = 0 ; n < numTimePoints ; ++n) {
714  x_bar_dot_vec_local.push_back(Thyra::createMember(this->get_x_space()));
715  x_bar_dot_vec->push_back(x_bar_dot_vec_local[n]);
716  }
717  }
718 
719  // Set up accuracy_vec
720  if (accuracy_vec) {
721  accuracy_vec->clear();
722  accuracy_vec->resize(numTimePoints);
723  }
724 
725  for (int i=0 ; i < numSteppers; ++i) {
726  Array<RCP<const Thyra::VectorBase<Scalar> > > sub_x_bar_vec;
727  Array<RCP<const Thyra::VectorBase<Scalar> > > sub_x_bar_dot_vec;
728  Array<ScalarMag> sub_accuracy_vec;
729  stepperArray_[i]->getPoints(
730  time_vec,
731  x_bar_vec ? &sub_x_bar_vec : 0,
732  x_bar_dot_vec ? &sub_x_bar_dot_vec : 0,
733  accuracy_vec ? &sub_accuracy_vec: 0
734  );
735  // Copy vectors into the sub-blocks of the
736  // x_bar_vec, x_bar_dot_vec, and accuracy_vec vectors.
737  for (int n=0; n < numTimePoints ; ++n ) {
738  if (x_bar_vec) {
739  RCP<Thyra::ProductVectorBase<Scalar> > x_bar_pv =
740  Teuchos::rcp_dynamic_cast<Thyra::ProductVectorBase<Scalar> >(
741  x_bar_vec_local[n],
742  true
743  );
744  RCP<Thyra::VectorBase<Scalar> > xi =
745  x_bar_pv->getNonconstVectorBlock(i);
746  V_V(Teuchos::outArg(*xi),*sub_x_bar_vec[n]);
747  }
748  if (x_bar_dot_vec) {
749  RCP<Thyra::ProductVectorBase<Scalar> > x_bar_dot_pv =
750  Teuchos::rcp_dynamic_cast<Thyra::ProductVectorBase<Scalar> >(
751  x_bar_dot_vec_local[n],
752  true
753  );
754  RCP<Thyra::VectorBase<Scalar> > xdoti =
755  x_bar_dot_pv->getNonconstVectorBlock(i);
756  V_V(Teuchos::outArg(*xdoti),*sub_x_bar_dot_vec[n]);
757  }
758  // Just copy the accuracy from the first stepper:
759  if ( (i == 0) && accuracy_vec) {
760  (*accuracy_vec)[n] = sub_accuracy_vec[n];
761  }
762  }
763  }
764 }
765 
766 
767 template<class Scalar>
768 void StackedStepper<Scalar>::getNodes(
769  Array<Scalar>* time_vec
770  ) const
771 {
772  TEUCHOS_TEST_FOR_EXCEPT(true);
773 }
774 
775 
776 template<class Scalar>
777 void StackedStepper<Scalar>::removeNodes(
778  Array<Scalar>& time_vec
779  )
780 {
781  TEUCHOS_TEST_FOR_EXCEPT("Not implemented yet but we can!");
782 }
783 
784 
785 template<class Scalar>
786 int StackedStepper<Scalar>::getOrder() const
787 {
788  TEUCHOS_TEST_FOR_EXCEPT(true);
789  return -1;
790 }
791 
792 
793 // private
794 
795 
796 } // namespace Rythmos
797 
798 
799 #endif //RYTHMOS_STACKED_STEPPER_HPP
virtual void addPoints(const Array< Scalar > &time_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &x_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &xdot_vec)=0
Add points to the buffer.