Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include "MOR_RythmosStepperFullStateWrapper.hpp"
00007
00008 #include "MOR_ReducedSpace.hpp"
00009 #include "MOR_RythmosUtils.hpp"
00010 #include "MOR_EpetraUtils.hpp"
00011
00012 #include "Epetra_Map.h"
00013 #include "Thyra_EpetraThyraWrappers.hpp"
00014
00015 #include "Teuchos_TestForException.hpp"
00016
00017 namespace MOR {
00018
00019 using ::Teuchos::RCP;
00020 using ::Teuchos::rcp;
00021 using ::Teuchos::null;
00022 using ::Teuchos::Array;
00023
00024 RythmosStepperFullStateWrapper::RythmosStepperFullStateWrapper(
00025 const RCP<const Rythmos::StepperBase<double> > &wrappedStepper,
00026 const RCP<const ReducedSpace> &reducedSpace) :
00027 wrappedStepper_(wrappedStepper),
00028 reducedSpace_(reducedSpace),
00029 fullMap_(mapDowncast(reducedSpace->basisMap()))
00030 {
00031
00032 }
00033
00034 void RythmosStepperFullStateWrapper::setParameterList(
00035 const Teuchos::RCP<Teuchos::ParameterList> &) {
00036 this->failNonconstFunction();
00037 }
00038
00039 RCP<Teuchos::ParameterList> RythmosStepperFullStateWrapper::getNonconstParameterList() {
00040 this->failNonconstFunction();
00041 return null;
00042 }
00043
00044 RCP<Teuchos::ParameterList> RythmosStepperFullStateWrapper::unsetParameterList() {
00045 this->failNonconstFunction();
00046 return null;
00047 }
00048
00049 RCP<const Thyra::VectorSpaceBase<double> > RythmosStepperFullStateWrapper::get_x_space() const {
00050 TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Not implemented");
00051 return wrappedStepper_->get_x_space();
00052 }
00053
00054 void RythmosStepperFullStateWrapper::addPoints(
00055 const Array<double> &,
00056 const Array<RCP<const Thyra::VectorBase<double> > > &,
00057 const Array<RCP<const Thyra::VectorBase<double> > > &) {
00058 this->failNonconstFunction();
00059 }
00060
00061 void RythmosStepperFullStateWrapper::getPoints(
00062 const Array<double> &time_vec,
00063 Array<RCP<const Thyra::VectorBase<double> > > *x_vec,
00064 Array<RCP<const Thyra::VectorBase<double> > > *xdot_vec,
00065 Array<ScalarMag> *accuracy_vec) const {
00066 TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Not implemented");
00067 wrappedStepper_->getPoints(time_vec, x_vec, xdot_vec, accuracy_vec);
00068 }
00069
00070 void RythmosStepperFullStateWrapper::getNodes(Array<double> *time_vec) const {
00071 TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Not implemented");
00072 wrappedStepper_->getNodes(time_vec);
00073 }
00074
00075 void RythmosStepperFullStateWrapper::removeNodes(Array<double> &) {
00076 this->failNonconstFunction();
00077 }
00078
00079 int RythmosStepperFullStateWrapper::getOrder() const {
00080 return wrappedStepper_->getOrder();
00081 }
00082
00083 Rythmos::TimeRange<double> RythmosStepperFullStateWrapper::getTimeRange() const {
00084 return wrappedStepper_->getTimeRange();
00085 }
00086
00087 bool RythmosStepperFullStateWrapper::supportsCloning() const {
00088 return true;
00089 }
00090
00091 RCP<Rythmos::StepperBase<double> > RythmosStepperFullStateWrapper::cloneStepperAlgorithm() const {
00092 return rcp(new RythmosStepperFullStateWrapper(*this));
00093 }
00094
00095 bool RythmosStepperFullStateWrapper::isImplicit() const {
00096 return wrappedStepper_->isImplicit();
00097 }
00098
00099 bool RythmosStepperFullStateWrapper::acceptsModel() const {
00100 return false;
00101 }
00102
00103 void RythmosStepperFullStateWrapper::setModel(const RCP<const Thyra::ModelEvaluator<double> > &) {
00104 this->failNonconstFunction();
00105 }
00106
00107 void RythmosStepperFullStateWrapper::setNonconstModel(const RCP<Thyra::ModelEvaluator<double> > &) {
00108 this->failNonconstFunction();
00109 }
00110
00111 bool RythmosStepperFullStateWrapper::modelIsConst() const {
00112 return true;
00113 }
00114
00115 RCP<const Thyra::ModelEvaluator<double> > RythmosStepperFullStateWrapper::getModel() const {
00116 TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Not implemented");
00117 return wrappedStepper_->getModel();
00118 }
00119
00120 RCP<Thyra::ModelEvaluator<double> > RythmosStepperFullStateWrapper::getNonconstModel() {
00121 this->failNonconstFunction();
00122 return null;
00123 }
00124
00125 void RythmosStepperFullStateWrapper::setInitialCondition(const Thyra::ModelEvaluatorBase::InArgs<double>& ) {
00126 this->failNonconstFunction();
00127 }
00128
00129 Thyra::ModelEvaluatorBase::InArgs<double> RythmosStepperFullStateWrapper::getInitialCondition() const {
00130 TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Not implemented");
00131 return wrappedStepper_->getInitialCondition();
00132 }
00133
00134 double RythmosStepperFullStateWrapper::takeStep(double , Rythmos::StepSizeType ) {
00135 this->failNonconstFunction();
00136 return 0.0;
00137 }
00138
00139 const Rythmos::StepStatus<double> RythmosStepperFullStateWrapper::getStepStatus() const {
00140 Rythmos::StepStatus<double> result = wrappedStepper_->getStepStatus();
00141
00142 const RCP<const Thyra::VectorBase<double> > reducedSolution = getRythmosState(result.solution);
00143 const RCP<const Thyra::VectorBase<double> > reducedSolutionDot = getRythmosState(result.solutionDot);
00144
00145 const Epetra_Map &reducedMap = reducedSpace_->componentMap();
00146 const RCP<const Epetra_Vector> epetraReducedSolution = Thyra::get_Epetra_Vector(reducedMap, reducedSolution);
00147 const RCP<const Epetra_Vector> epetraReducedSolutionDot = Thyra::get_Epetra_Vector(reducedMap, reducedSolutionDot);
00148
00149 const RCP<const Epetra_Vector> epetraFullSolution = reducedSpace_->expansion(*epetraReducedSolution);
00150 const RCP<const Epetra_Vector> epetraFullSolutionDot = reducedSpace_->expansion(*epetraReducedSolutionDot);
00151
00152 const RCP<const Thyra::VectorSpaceBase<double> > fullVectorSpace = Thyra::create_VectorSpace(fullMap_);
00153 const RCP<const Thyra::VectorBase<double> > fullSolution = Thyra::create_Vector(epetraFullSolution, fullVectorSpace);
00154 const RCP<const Thyra::VectorBase<double> > fullSolutionDot = Thyra::create_Vector(epetraFullSolutionDot, fullVectorSpace);
00155
00156 result.solution = Thyra::create_Vector(epetraFullSolution, fullVectorSpace);
00157 result.solutionDot = Thyra::create_Vector(epetraFullSolutionDot, fullVectorSpace);
00158 result.residual = null;
00159 return result;
00160 }
00161
00162 void RythmosStepperFullStateWrapper::setStepControlData(const Rythmos::StepperBase<double> &) {
00163 this->failNonconstFunction();
00164 }
00165
00166 void RythmosStepperFullStateWrapper::failNonconstFunction() {
00167 TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Wrapped object is const");
00168 }
00169
00170 }