Beispiel #1
0
LOCA::Homotopy::Group::Group(
	 Teuchos::ParameterList& locaSublist,
	 const Teuchos::RCP<LOCA::GlobalData>& global_data,
	 const Teuchos::RCP<LOCA::Homotopy::AbstractGroup>& g,
	 const NOX::Abstract::Vector& randomVector) :
  globalData(global_data),
  grpPtr(g),
  gVecPtr(g->getX().clone(NOX::ShapeCopy)),
  randomVecPtr(gVecPtr->clone(NOX::ShapeCopy)),
  newtonVecPtr(),
  gradVecPtr(),
  paramVec(grpPtr->getParams()),
  conParam(0.0),
  conParamID(-1),
  conParamLabel("Homotopy Continuation Parameter"),
  augmentJacForHomotopyNotImplemented(false)
{
  // construct a random vector for the problem 
  *randomVecPtr = randomVector;

  // Set the isValid flags to false
  resetIsValidFlags();

  // Set the homotopy parameter as a parameter in the ParameterVector.
  // This will allow us to do an invasive homotopy since the app can now 
  // get access to the homotopy continuation parameter.
  paramVec.addParameter(conParamLabel, conParam);
  grpPtr->setParams(paramVec);

  // Set up paramID
  conParamID = paramVec.getIndex(conParamLabel);

  setStepperParameters(locaSublist);

}
Beispiel #2
0
LOCA::Homotopy::DeflatedGroup::
DeflatedGroup(
       const Teuchos::RCP<LOCA::GlobalData>& global_data,
       const Teuchos::RCP<Teuchos::ParameterList>& topParams,
       const Teuchos::RCP<Teuchos::ParameterList>& hParams,
       const Teuchos::RCP<LOCA::Homotopy::AbstractGroup>& g,
       const Teuchos::RCP<const NOX::Abstract::Vector>& start_vec,
       const std::vector< Teuchos::RCP<const NOX::Abstract::Vector> >& prev_solns,
       const double identity_sign)
  : globalData(global_data),
    parsedParams(),
    homotopyParams(hParams),
    grpPtr(g),
    bordered_grp(),
    xMultiVec(globalData, g->getX(), 1, 1, NOX::DeepCopy),
    fMultiVec(globalData, g->getX(), 1, 1, NOX::ShapeCopy),
    newtonMultiVec(globalData, g->getX(), 1, 1, NOX::ShapeCopy),
    gradientMultiVec(globalData, g->getX(), 1, 1, NOX::ShapeCopy),
    xVec(),
    fVec(),
    newtonVec(),
    gradientVec(),
    startVec(start_vec),
    identitySign(identity_sign),
    solns(prev_solns),
    distVec(startVec->clone(NOX::ShapeCopy)),
    totalDistMultiVec(startVec->createMultiVector(1, NOX::ShapeCopy)),
    underlyingF(startVec->createMultiVector(1, NOX::ShapeCopy)),
    jacOp(),
    borderedSolver(),
    minusOne(),
    numSolns(solns.size()),
    distances(numSolns),
    distProd(0.0),
    index_f(1),
    paramVec(grpPtr->getParams()),
    conParam(0.0),
    conParamID(-1),
    conParamLabel("Homotopy Continuation Parameter"),
    augmentJacForHomotopyNotImplemented(false),
    isValidF(false),
    isValidJacobian(false),
    isValidNewton(false),
    isValidGradient(false),
    isBordered(false)
{
  // Set up multi-vector views
  setupViews(); 

  // Set the homotopy parameter as a parameter in the ParameterVector.
  // This will allow us to do an invasive homotopy since the app can now 
  // get access to the homotopy continuation parameter.
  paramVec.addParameter(conParamLabel, conParam);
  grpPtr->setParams(paramVec);

  // Set up paramID
  conParamID = paramVec.getIndex(conParamLabel);

  setStepperParameters(*topParams);

  // Parse parameter list
  parsedParams = Teuchos::rcp(new LOCA::Parameter::SublistParser(globalData));
  parsedParams->parseSublists(topParams);

  // Set initial solution and parameters in solution vector
  grpPtr->setX(*startVec);
  *(xVec->getXVec()) = *startVec;
  xVec->getScalar(0) = conParam;

  // Create "C" block in bordered solver
  minusOne = Teuchos::rcp(new NOX::Abstract::MultiVector::DenseMatrix(1, 1));
  (*minusOne)(0,0) = -1.0;

  // Instantiate bordered solver
  borderedSolver = globalData->locaFactory->createBorderedSolverStrategy(
				   parsedParams,
				   homotopyParams);

  // Determine if underlying group is bordered
  bordered_grp = 
    Teuchos::rcp_dynamic_cast<LOCA::BorderedSystem::AbstractGroup>(grpPtr);
  isBordered = (bordered_grp != Teuchos::null);

  // Create Jacobian operator for bordered solver
  jacOp = Teuchos::rcp(new LOCA::BorderedSolver::JacobianOperator(grpPtr));
}