コード例 #1
0
ファイル: CWPRoot.cpp プロジェクト: kuailexs/symbiandump-mw3
// -----------------------------------------------------------------------------
// CWPRoot::Visit
// -----------------------------------------------------------------------------
//
void CWPRoot::VisitL( CWPParameter& aParameter )
    {
    FLOG( _L( "[Provisioning] CWPRoot::VisitL Parameter:" ) );
    
    if( iCharStack )
        {
        TInt charType( iCharStack->Type() );
        TInt paramID( aParameter.ID() );

        // If the current characteristic is a logical proxy or access point,
        // add it to the list of potential targets of a link
        if( (charType == KWPPxLogical && paramID == EWPParameterProxyID )
            || (charType == KWPNapDef && paramID == EWPParameterNapID) )
            {
            iProviderIDs->AppendL( aParameter.Value() );
            }
        // Handle internet-capable NAPDEF here
        else if( charType == KWPNapDef && paramID == EWPParameterInternet )
            {
            User::LeaveIfError( iProviders.Append( iCharStack ) );
            iProviderIDs->AppendL( KInternet );
            }
        // If the parameter can link, append to the list of sources of links
        else if( paramID == EWPParameterToNapID
            || paramID == EWPParameterToProxy
            || (charType == KWPBootstrap && paramID == EWPParameterProxyID) )
            {
            iNeededIDs->AppendL( aParameter.Value() );
            User::LeaveIfError( iNeeders.Append( iCharStack ) );
            }
        }
    }
void
LOCA::TurningPoint::MinimallyAugmented::Constraint::
getInitialVectors(NOX::Abstract::Vector& aVec,
		  NOX::Abstract::Vector& bVec)
{
  std::string callingFunction = 
    "LOCA::TurningPoint::MinimallyAugmented::Constraint::getIntitialVectors()";

  // Get method
  std::string method = 
    turningPointParams->get("Initial Null Vector Computation",
			    "User Provided");
  if (method == "Solve df/dp") {
    NOX::Abstract::Group::ReturnType status;
    NOX::Abstract::Group::ReturnType finalStatus = NOX::Abstract::Group::Ok;
    std::vector<int> paramID(1);
    paramID[0] = bifParamID[0];
    Teuchos::RCP<NOX::Abstract::MultiVector> fdfdp = 
      grpPtr->getX().createMultiVector(2);
    aVec.init(0.0);
    bVec.init(0.0);

    // Compute df/dp
    status = grpPtr->computeDfDpMulti(paramID, *fdfdp, false);
    finalStatus = 
      globalData->locaErrorCheck->combineAndCheckReturnTypes(status, 
							     finalStatus,
							     callingFunction);

    // Compute J
    status = grpPtr->computeJacobian();
    finalStatus = 
      globalData->locaErrorCheck->combineAndCheckReturnTypes(status, 
							     finalStatus,
							     callingFunction);

    // Compute b = J^-1*dfdp
    Teuchos::RCP<Teuchos::ParameterList> lsParams =
      parsedParams->getSublist("Linear Solver");
    status = grpPtr->applyJacobianInverse(*lsParams, (*fdfdp)[1], bVec);
    finalStatus = 
      globalData->locaErrorCheck->combineAndCheckReturnTypes(status, 
							     finalStatus,
							     callingFunction);

    // Compute a = J^-T*dfdp if necessary
    if (!isSymmetric) {
      // Cast group to one that can solve J^T
      Teuchos::RCP<LOCA::Abstract::TransposeSolveGroup> ts_grp = 
	Teuchos::rcp_dynamic_cast<LOCA::Abstract::TransposeSolveGroup>(grpPtr);
      if (ts_grp == Teuchos::null)
	globalData->locaErrorCheck->throwError(
	   callingFunction,
	   std::string("Group must implement LOCA::Abstract::TransposeSolveGroup") +
	   std::string(" to compute initial left null vector"));
      
      Teuchos::RCP<Teuchos::ParameterList> lsParams =
	parsedParams->getSublist("Linear Solver");
      status = 
	ts_grp->applyJacobianTransposeInverse(*lsParams, (*fdfdp)[1], aVec);
      finalStatus = 
	globalData->locaErrorCheck->combineAndCheckReturnTypes(
							     status, 
							     finalStatus,
							     callingFunction);
    }
    else
      aVec = bVec;
  }
  else if (method == "Constant") {
    aVec.init(1.0);
    bVec.init(1.0);
  }

  else {

    // Get initial "a" vector
    if (!turningPointParams->isParameter("Initial A Vector")) {
      globalData->locaErrorCheck->throwError(callingFunction,
					 "\"Initial A Vector\" is not set!");
    }
    Teuchos::RCP<NOX::Abstract::Vector> aVecPtr = 
      (*turningPointParams).INVALID_TEMPLATE_QUALIFIER 
      get< Teuchos::RCP<NOX::Abstract::Vector> >("Initial A Vector");
    aVec = *aVecPtr;

    // Get initial "b" vector
    if (!isSymmetric) {
      if (!turningPointParams->isParameter("Initial B Vector")) {
	globalData->locaErrorCheck->throwError(callingFunction,
					   "\"Initial B Vector\" is not set!");
      }
      Teuchos::RCP<NOX::Abstract::Vector> bVecPtr = 
	(*turningPointParams).INVALID_TEMPLATE_QUALIFIER 
        get< Teuchos::RCP<NOX::Abstract::Vector> >("Initial B Vector");
      bVec = *bVecPtr;
    }
    else
      bVec = aVec;
  }

  scaleNullVectors(aVec, bVec);
}