00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "Teuchos_ParameterList.hpp"
00043 #include "NOX_Utils.H"
00044 #include "LOCA_GlobalData.H"
00045 #include "LOCA_ErrorCheck.H"
00046 #include "LOCA_Parameter_Vector.H"
00047 #include "LOCA_TurningPoint_MinimallyAugmented_AbstractGroup.H"
00048 #include "LOCA_TurningPoint_MinimallyAugmented_ExtendedGroup.H"
00049 #include "LOCA_TurningPoint_MinimallyAugmented_Constraint.H"
00050 #include "LOCA_TurningPoint_MinimallyAugmented_ModifiedConstraint.H"
00051 #include "LOCA_MultiContinuation_ConstrainedGroup.H"
00052 #include "LOCA_Parameter_SublistParser.H"
00053 #include "LOCA_Abstract_TransposeSolveGroup.H"
00054
00055 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00056 ExtendedGroup(
00057 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00058 const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
00059 const Teuchos::RCP<Teuchos::ParameterList>& tpParams,
00060 const Teuchos::RCP<LOCA::TurningPoint::MinimallyAugmented::AbstractGroup>& grp)
00061 : LOCA::Extended::MultiAbstractGroup(),
00062 LOCA::MultiContinuation::AbstractGroup(),
00063 globalData(global_data),
00064 parsedParams(topParams),
00065 turningPointParams(tpParams),
00066 grpPtr(grp),
00067 constraint(),
00068 conGroup(),
00069 bifParamID(0)
00070 {
00071 const char *func = "LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup()";
00072
00073
00074 if (!turningPointParams->isParameter("Bifurcation Parameter")) {
00075 globalData->locaErrorCheck->throwError(func,
00076 "\"Bifurcation Parameter\" name is not set!");
00077 }
00078 string bifParamName = turningPointParams->get(
00079 "Bifurcation Parameter",
00080 "None");
00081 const ParameterVector& p = grpPtr->getParams();
00082 bifParamID = p.getIndex(bifParamName);
00083
00084
00085 bool isSymmetric =
00086 turningPointParams->get("Symmetric Jacobian", false);
00087
00088
00089 Teuchos::RCP<NOX::Abstract::Vector> aVecPtr;
00090 Teuchos::RCP<NOX::Abstract::Vector> bVecPtr;
00091 getInitialVectors(aVecPtr, bVecPtr, isSymmetric);
00092
00093
00094 string constraintMethod = turningPointParams->get(
00095 "Constraint Method",
00096 "Default");
00097 if (constraintMethod == "Default")
00098 constraint =
00099 Teuchos::rcp(new LOCA::TurningPoint::MinimallyAugmented::Constraint(
00100 globalData,
00101 parsedParams,
00102 tpParams,
00103 grpPtr,
00104 isSymmetric,
00105 *aVecPtr,
00106 bVecPtr.get(),
00107 bifParamID));
00108 else if (constraintMethod == "Modified")
00109 constraint =
00110 Teuchos::rcp(new LOCA::TurningPoint::MinimallyAugmented::ModifiedConstraint(
00111 globalData,
00112 parsedParams,
00113 tpParams,
00114 grpPtr,
00115 isSymmetric,
00116 *aVecPtr,
00117 bVecPtr.get(),
00118 bifParamID));
00119 else
00120 globalData->locaErrorCheck->throwError(
00121 func,
00122 string("Unknown constraint method: ") + constraintMethod);
00123
00124
00125 std::vector<int> bifParamIDs(1);
00126 bifParamIDs[0] = bifParamID;
00127 conGroup =
00128 Teuchos::rcp(new LOCA::MultiContinuation::ConstrainedGroup(
00129 globalData,
00130 parsedParams,
00131 turningPointParams,
00132 grpPtr,
00133 constraint,
00134 bifParamIDs));
00135 }
00136
00137 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00138 ExtendedGroup(
00139 const LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup& source,
00140 NOX::CopyType type)
00141 : globalData(source.globalData),
00142 parsedParams(source.parsedParams),
00143 turningPointParams(source.turningPointParams),
00144 grpPtr(),
00145 constraint(),
00146 conGroup(),
00147 bifParamID(source.bifParamID)
00148 {
00149 conGroup = Teuchos::rcp_dynamic_cast<LOCA::MultiContinuation::ConstrainedGroup>(source.conGroup->clone(type));
00150 grpPtr = Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MinimallyAugmented::AbstractGroup>(conGroup->getGroup());
00151 constraint = Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MinimallyAugmented::Constraint>(conGroup->getConstraints());
00152 constraint->setGroup(grpPtr);
00153 }
00154
00155
00156 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00157 ~ExtendedGroup()
00158 {
00159 }
00160
00161 NOX::Abstract::Group&
00162 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00163 operator=(const NOX::Abstract::Group& source)
00164 {
00165 copy(source);
00166 return *this;
00167 }
00168
00169 Teuchos::RCP<NOX::Abstract::Group>
00170 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00171 clone(NOX::CopyType type) const
00172 {
00173 return Teuchos::rcp(new ExtendedGroup(*this, type));
00174 }
00175
00176 void
00177 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00178 setX(const NOX::Abstract::Vector& y)
00179 {
00180 conGroup->setX(y);
00181 }
00182
00183 void
00184 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00185 computeX(const NOX::Abstract::Group& g,
00186 const NOX::Abstract::Vector& d,
00187 double step)
00188 {
00189 const LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup& mg =
00190 dynamic_cast<const LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup&>(g);
00191
00192
00193 Teuchos::RCP<LOCA::TurningPoint::MinimallyAugmented::ModifiedConstraint> mod_constraint =
00194 Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MinimallyAugmented::ModifiedConstraint>(constraint);
00195 if (mod_constraint != Teuchos::null) {
00196 const LOCA::MultiContinuation::ExtendedVector& emv_d =
00197 dynamic_cast<const LOCA::MultiContinuation::ExtendedVector&>(d);
00198 mod_constraint->setNewtonUpdates(*(emv_d.getXVec()), emv_d.getScalar(0),
00199 step);
00200 }
00201
00202 conGroup->computeX(*(mg.conGroup), d, step);
00203 }
00204
00205 NOX::Abstract::Group::ReturnType
00206 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00207 computeF()
00208 {
00209 return conGroup->computeF();
00210 }
00211
00212 NOX::Abstract::Group::ReturnType
00213 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00214 computeJacobian()
00215 {
00216 return conGroup->computeJacobian();
00217 }
00218
00219 NOX::Abstract::Group::ReturnType
00220 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00221 computeGradient()
00222 {
00223 return conGroup->computeGradient();
00224 }
00225
00226 NOX::Abstract::Group::ReturnType
00227 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00228 computeNewton(Teuchos::ParameterList& params)
00229 {
00230 return conGroup->computeNewton(params);
00231 }
00232
00233 NOX::Abstract::Group::ReturnType
00234 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00235 applyJacobian(const NOX::Abstract::Vector& input,
00236 NOX::Abstract::Vector& result) const
00237 {
00238 return conGroup->applyJacobian(input, result);
00239 }
00240
00241 NOX::Abstract::Group::ReturnType
00242 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00243 applyJacobianTranspose(const NOX::Abstract::Vector& input,
00244 NOX::Abstract::Vector& result) const
00245 {
00246 return conGroup->applyJacobianTranspose(input, result);
00247 }
00248
00249 NOX::Abstract::Group::ReturnType
00250 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00251 applyJacobianInverse(Teuchos::ParameterList& params,
00252 const NOX::Abstract::Vector& input,
00253 NOX::Abstract::Vector& result) const
00254 {
00255 return conGroup->applyJacobianInverse(params, input, result);
00256 }
00257
00258 NOX::Abstract::Group::ReturnType
00259 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00260 applyJacobianMultiVector(const NOX::Abstract::MultiVector& input,
00261 NOX::Abstract::MultiVector& result) const
00262 {
00263 return conGroup->applyJacobianMultiVector(input, result);
00264 }
00265
00266 NOX::Abstract::Group::ReturnType
00267 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00268 applyJacobianTransposeMultiVector(const NOX::Abstract::MultiVector& input,
00269 NOX::Abstract::MultiVector& result) const
00270 {
00271 return conGroup->applyJacobianTransposeMultiVector(input, result);
00272 }
00273
00274 NOX::Abstract::Group::ReturnType
00275 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00276 applyJacobianInverseMultiVector(Teuchos::ParameterList& params,
00277 const NOX::Abstract::MultiVector& input,
00278 NOX::Abstract::MultiVector& result) const
00279 {
00280 return conGroup->applyJacobianInverseMultiVector(params, input, result);
00281 }
00282
00283 bool
00284 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00285 isF() const
00286 {
00287 return conGroup->isF();
00288 }
00289
00290 bool
00291 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00292 isJacobian() const
00293 {
00294 return conGroup->isJacobian();
00295 }
00296
00297 bool
00298 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00299 isGradient() const
00300 {
00301 return conGroup->isGradient();
00302 }
00303
00304 bool
00305 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00306 isNewton() const
00307 {
00308 return conGroup->isNewton();
00309 }
00310
00311 const NOX::Abstract::Vector&
00312 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00313 getX() const
00314 {
00315 return conGroup->getX();
00316 }
00317
00318 const NOX::Abstract::Vector&
00319 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00320 getF() const
00321 {
00322 return conGroup->getF();
00323 }
00324
00325 double
00326 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00327 getNormF() const
00328 {
00329 return conGroup->getNormF();
00330 }
00331
00332 const NOX::Abstract::Vector&
00333 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00334 getGradient() const
00335 {
00336 return conGroup->getGradient();
00337 }
00338
00339 const NOX::Abstract::Vector&
00340 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00341 getNewton() const
00342 {
00343 return conGroup->getNewton();
00344 }
00345
00346 double
00347 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00348 getNormNewtonSolveResidual() const
00349 {
00350 return conGroup->getNormNewtonSolveResidual();
00351 }
00352
00353 Teuchos::RCP<const LOCA::MultiContinuation::AbstractGroup>
00354 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00355 getUnderlyingGroup() const
00356 {
00357 return conGroup->getUnderlyingGroup();
00358 }
00359
00360 Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup>
00361 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00362 getUnderlyingGroup()
00363 {
00364 return conGroup->getUnderlyingGroup();
00365 }
00366
00367 void
00368 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00369 copy(const NOX::Abstract::Group& src)
00370 {
00371
00372 const LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup& source =
00373 dynamic_cast<const LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup&>(src);
00374
00375
00376 if (this != &source) {
00377 globalData = source.globalData;
00378 parsedParams = source.parsedParams;
00379 turningPointParams = source.turningPointParams;
00380 conGroup->copy(*source.conGroup);
00381 grpPtr = Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MinimallyAugmented::AbstractGroup>(conGroup->getGroup());
00382 constraint = Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MinimallyAugmented::Constraint>(conGroup->getConstraints());
00383 constraint->setGroup(grpPtr);
00384 bifParamID = source.bifParamID;
00385 }
00386 }
00387
00388 void
00389 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00390 setParamsMulti(const vector<int>& paramIDs,
00391 const NOX::Abstract::MultiVector::DenseMatrix& vals)
00392 {
00393 conGroup->setParamsMulti(paramIDs, vals);
00394 }
00395
00396 void
00397 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00398 setParams(const LOCA::ParameterVector& p)
00399 {
00400 conGroup->setParams(p);
00401 }
00402
00403 void
00404 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00405 setParam(int paramID, double val)
00406 {
00407 conGroup->setParam(paramID, val);
00408 }
00409
00410 void
00411 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00412 setParam(string paramID, double val)
00413 {
00414 conGroup->setParam(paramID, val);
00415 }
00416
00417 const LOCA::ParameterVector&
00418 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00419 getParams() const
00420 {
00421 return conGroup->getParams();
00422 }
00423
00424 double
00425 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00426 getParam(int paramID) const
00427 {
00428 return conGroup->getParam(paramID);
00429 }
00430
00431 double
00432 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00433 getParam(string paramID) const
00434 {
00435 return conGroup->getParam(paramID);
00436 }
00437
00438 NOX::Abstract::Group::ReturnType
00439 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00440 computeDfDpMulti(const vector<int>& paramIDs,
00441 NOX::Abstract::MultiVector& dfdp,
00442 bool isValidF)
00443 {
00444 return conGroup->computeDfDpMulti(paramIDs, dfdp, isValidF);
00445 }
00446
00447 void
00448 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00449 preProcessContinuationStep(LOCA::Abstract::Iterator::StepStatus stepStatus)
00450 {
00451 conGroup->preProcessContinuationStep(stepStatus);
00452 }
00453
00454 void
00455 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00456 postProcessContinuationStep(LOCA::Abstract::Iterator::StepStatus stepStatus)
00457 {
00458 conGroup->postProcessContinuationStep(stepStatus);
00459 }
00460
00461 void
00462 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00463 projectToDraw(const NOX::Abstract::Vector& x,
00464 double *px) const
00465 {
00466 conGroup->projectToDraw(x, px);
00467 }
00468
00469 int
00470 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00471 projectToDrawDimension() const
00472 {
00473 return conGroup->projectToDrawDimension();
00474 }
00475
00476 void
00477 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00478 printSolution(const double conParam) const
00479 {
00480 if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
00481 globalData->locaUtils->out() <<
00482 "LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::printSolution\n";
00483
00484 globalData->locaUtils->out() << "Turning Point located at: " <<
00485 globalData->locaUtils->sciformat(conParam) << " " <<
00486 globalData->locaUtils->sciformat(getBifParam()) << std::endl;
00487
00488 globalData->locaUtils->out() <<
00489 "\tPrinting Solution Vector for conParam = " <<
00490 globalData->locaUtils->sciformat(conParam) << std::endl;
00491 }
00492 grpPtr->printSolution(conParam);
00493 if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
00494 globalData->locaUtils->out() <<
00495 "\tPrinting Right Null Vector for bif param = " <<
00496 globalData->locaUtils->sciformat(getBifParam()) << std::endl;
00497 }
00498 grpPtr->printSolution(*(constraint->getRightNullVec()), getBifParam());
00499 if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
00500 globalData->locaUtils->out() <<
00501 "\tPrinting Left Null Vector for sigma = " <<
00502 globalData->locaUtils->sciformat(constraint->getSigma()) << std::endl;
00503 }
00504 grpPtr->printSolution(*(constraint->getLeftNullVec()),
00505 constraint->getSigma());
00506 }
00507
00508 void
00509 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00510 printSolution(const NOX::Abstract::Vector& x,
00511 const double conParam) const
00512 {
00513 const LOCA::MultiContinuation::ExtendedVector& tp_x =
00514 dynamic_cast<const LOCA::MultiContinuation::ExtendedVector&>(x);
00515
00516 if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
00517 globalData->locaUtils->out() <<
00518 "LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::printSolution\n";
00519
00520 globalData->locaUtils->out() << "Turning Point located at: " <<
00521 globalData->locaUtils->sciformat(conParam) << " " <<
00522 globalData->locaUtils->sciformat(tp_x.getScalar(0)) << std::endl;
00523
00524 globalData->locaUtils->out() <<
00525 "\tPrinting Solution Vector for conParam = " <<
00526 globalData->locaUtils->sciformat(conParam) << std::endl;
00527 }
00528 grpPtr->printSolution(*(tp_x.getXVec()), conParam);
00529 if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
00530 globalData->locaUtils->out() <<
00531 "\tPrinting Right Null Vector for bif param = " <<
00532 globalData->locaUtils->sciformat(tp_x.getScalar(0)) << std::endl;
00533 }
00534 grpPtr->printSolution(*(constraint->getRightNullVec()), tp_x.getScalar(0));
00535 if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
00536 globalData->locaUtils->out() <<
00537 "\tPrinting Left Null Vector for sigma = " <<
00538 globalData->locaUtils->sciformat(constraint->getSigma()) << std::endl;
00539 }
00540 grpPtr->printSolution(*(constraint->getLeftNullVec()),
00541 constraint->getSigma());
00542 }
00543
00544 int
00545 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00546 getBorderedWidth() const
00547 {
00548 return conGroup->getBorderedWidth();
00549 }
00550
00551 Teuchos::RCP<const NOX::Abstract::Group>
00552 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00553 getUnborderedGroup() const
00554 {
00555 return conGroup->getUnborderedGroup();
00556 }
00557
00558 bool
00559 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00560 isCombinedAZero() const
00561 {
00562 return conGroup->isCombinedAZero();
00563 }
00564
00565 bool
00566 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00567 isCombinedBZero() const
00568 {
00569 return conGroup->isCombinedBZero();
00570 }
00571
00572 bool
00573 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00574 isCombinedCZero() const
00575 {
00576 return conGroup->isCombinedCZero();
00577 }
00578
00579 void
00580 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00581 extractSolutionComponent(const NOX::Abstract::MultiVector& v,
00582 NOX::Abstract::MultiVector& v_x) const
00583 {
00584 conGroup->extractSolutionComponent(v, v_x);
00585 }
00586
00587 void
00588 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00589 extractParameterComponent(bool use_transpose,
00590 const NOX::Abstract::MultiVector& v,
00591 NOX::Abstract::MultiVector::DenseMatrix& v_p) const
00592 {
00593 conGroup->extractParameterComponent(use_transpose, v, v_p);
00594 }
00595
00596 void
00597 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00598 loadNestedComponents(const NOX::Abstract::MultiVector& v_x,
00599 const NOX::Abstract::MultiVector::DenseMatrix& v_p,
00600 NOX::Abstract::MultiVector& v) const
00601 {
00602 conGroup->loadNestedComponents(v_x, v_p, v);
00603 }
00604
00605 void
00606 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00607 fillA(NOX::Abstract::MultiVector& A) const
00608 {
00609 conGroup->fillA(A);
00610 }
00611
00612 void
00613 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00614 fillB(NOX::Abstract::MultiVector& B) const
00615 {
00616 conGroup->fillB(B);
00617 }
00618
00619 void
00620 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00621 fillC(NOX::Abstract::MultiVector::DenseMatrix& C) const
00622 {
00623 conGroup->fillC(C);
00624 }
00625
00626 NOX::Abstract::Group::ReturnType
00627 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00628 applyJacobianTransposeInverse(Teuchos::ParameterList& params,
00629 const NOX::Abstract::Vector& input,
00630 NOX::Abstract::Vector& result) const
00631 {
00632 return conGroup->applyJacobianTransposeInverse(params, input, result);
00633 }
00634
00635 NOX::Abstract::Group::ReturnType
00636 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00637 applyJacobianTransposeInverseMultiVector(Teuchos::ParameterList& params,
00638 const NOX::Abstract::MultiVector& input,
00639 NOX::Abstract::MultiVector& result) const
00640 {
00641 return conGroup->applyJacobianTransposeInverseMultiVector(params, input, result);
00642 }
00643
00644 double
00645 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00646 getBifParam() const
00647 {
00648 return grpPtr->getParam(bifParamID);
00649 }
00650
00651 Teuchos::RCP<const NOX::Abstract::Vector>
00652 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00653 getLeftNullVec() const
00654 {
00655 return constraint->getLeftNullVec();
00656 }
00657
00658 Teuchos::RCP<const NOX::Abstract::Vector>
00659 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00660 getRightNullVec() const
00661 {
00662 return constraint->getRightNullVec();
00663 }
00664
00665 void
00666 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00667 setBifParam(double param)
00668 {
00669 conGroup->setParam(bifParamID, param);
00670 }
00671
00672 void
00673 LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::
00674 getInitialVectors(Teuchos::RCP<NOX::Abstract::Vector>& aVecPtr,
00675 Teuchos::RCP<NOX::Abstract::Vector>& bVecPtr,
00676 bool isSymmetric)
00677 {
00678 string callingFunction =
00679 "LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup::getIntitialVectors()";
00680
00681
00682 string method =
00683 turningPointParams->get("Initial Null Vector Computation",
00684 "User Provided");
00685 if (method == "Solve df/dp") {
00686 NOX::Abstract::Group::ReturnType status;
00687 NOX::Abstract::Group::ReturnType finalStatus = NOX::Abstract::Group::Ok;
00688 std::vector<int> paramID(1);
00689 paramID[0] = bifParamID;
00690 Teuchos::RCP<NOX::Abstract::MultiVector> fdfdp =
00691 grpPtr->getX().createMultiVector(2);
00692 aVecPtr = grpPtr->getX().clone(NOX::ShapeCopy);
00693 bVecPtr = grpPtr->getX().clone(NOX::ShapeCopy);
00694 aVecPtr->init(0.0);
00695 bVecPtr->init(0.0);
00696
00697
00698 status = grpPtr->computeDfDpMulti(paramID, *fdfdp, false);
00699 finalStatus =
00700 globalData->locaErrorCheck->combineAndCheckReturnTypes(status,
00701 finalStatus,
00702 callingFunction);
00703
00704
00705 status = grpPtr->computeJacobian();
00706 finalStatus =
00707 globalData->locaErrorCheck->combineAndCheckReturnTypes(status,
00708 finalStatus,
00709 callingFunction);
00710
00711
00712 Teuchos::RCP<Teuchos::ParameterList> lsParams =
00713 parsedParams->getSublist("Linear Solver");
00714 status = grpPtr->applyJacobianInverse(*lsParams, (*fdfdp)[1], *bVecPtr);
00715 finalStatus =
00716 globalData->locaErrorCheck->combineAndCheckReturnTypes(status,
00717 finalStatus,
00718 callingFunction);
00719
00720
00721 if (!isSymmetric) {
00722
00723 Teuchos::RCP<LOCA::Abstract::TransposeSolveGroup> ts_grp =
00724 Teuchos::rcp_dynamic_cast<LOCA::Abstract::TransposeSolveGroup>(grpPtr);
00725 if (ts_grp == Teuchos::null)
00726 globalData->locaErrorCheck->throwError(
00727 callingFunction,
00728 string("Group must implement LOCA::Abstract::TransposeSolveGroup") +
00729 string(" to compute initial left null vector"));
00730
00731 Teuchos::RCP<Teuchos::ParameterList> lsParams =
00732 parsedParams->getSublist("Linear Solver");
00733 status =
00734 ts_grp->applyJacobianTransposeInverse(*lsParams, (*fdfdp)[1],
00735 *aVecPtr);
00736 finalStatus =
00737 globalData->locaErrorCheck->combineAndCheckReturnTypes(
00738 status,
00739 finalStatus,
00740 callingFunction);
00741 }
00742 else
00743 *aVecPtr = *bVecPtr;
00744
00745
00746 aVecPtr->scale(std::sqrt(static_cast<double>(aVecPtr->length())) / aVecPtr->norm());
00747 bVecPtr->scale(std::sqrt(static_cast<double>(bVecPtr->length())) / bVecPtr->norm());
00748 }
00749
00750 else {
00751
00752
00753 if (!turningPointParams->isParameter("Initial A Vector")) {
00754 globalData->locaErrorCheck->throwError(callingFunction,
00755 "\"Initial A Vector\" is not set!");
00756 }
00757 aVecPtr =
00758 (*turningPointParams).INVALID_TEMPLATE_QUALIFIER
00759 get< Teuchos::RCP<NOX::Abstract::Vector> >("Initial A Vector");
00760
00761
00762 if (!isSymmetric) {
00763 if (!turningPointParams->isParameter("Initial B Vector")) {
00764 globalData->locaErrorCheck->throwError(callingFunction,
00765 "\"Initial B Vector\" is not set!");
00766 }
00767 bVecPtr =
00768 (*turningPointParams).INVALID_TEMPLATE_QUALIFIER
00769 get< Teuchos::RCP<NOX::Abstract::Vector> >("Initial B Vector");
00770 }
00771 }
00772 }