AmesosBucklingOp::AmesosBucklingOp( Epetra_LinearProblem& problem,
				    const Teuchos::RCP<Amesos_BaseSolver>& solver,
				    const Teuchos::RCP<Epetra_Operator>& stiffMtx
				    )
  : solver_(solver),
    stiffMtx_(stiffMtx)
{
  problem_ = const_cast<Epetra_LinearProblem*>( solver->GetProblem() );
}
Пример #2
0
//-----------------------------------------------------------------------------
// Function      : N_LAS_AmesosGenOp::N_LAS_AmesosGenOp
// Purpose       : Constructor 
// Special Notes :
// Scope         : Public
// Creator       : Heidi Thornquist, SNL 
// Creation Date : 06/04/12
//-----------------------------------------------------------------------------
N_LAS_AmesosGenOp::N_LAS_AmesosGenOp( const Teuchos::RCP<Amesos_BaseSolver>& solver,
                                      const Teuchos::RCP<Epetra_Operator>& B,
                                      bool useTranspose )
  : useTranspose_(useTranspose),
    solver_(solver),
    B_(B)
{
  problem_ = Teuchos::rcp( const_cast<Epetra_LinearProblem*>( solver->GetProblem() ), false);

  if ( solver_->UseTranspose() )
    solver_->SetUseTranspose(!useTranspose);
  else
    solver_->SetUseTranspose(useTranspose);

  if ( B_->UseTranspose() )
    B_->SetUseTranspose(!useTranspose);
  else
    B_->SetUseTranspose(useTranspose);
}
AmesosGenOp::AmesosGenOp( Epetra_LinearProblem& problem,
                          const Teuchos::RCP<Amesos_BaseSolver>& solver,
                          const Teuchos::RCP<Epetra_Operator>& massMtx,
                          bool useTranspose )
  : useTranspose_(useTranspose),
    solver_(solver),
    massMtx_(massMtx)
{
  problem_ = const_cast<Epetra_LinearProblem*>( solver->GetProblem() );
  
  if ( solver_->UseTranspose() )
    solver_->SetUseTranspose(!useTranspose); 
  else
    solver_->SetUseTranspose(useTranspose);
  
  if ( massMtx_->UseTranspose() )
    massMtx_->SetUseTranspose(!useTranspose);
  else
    massMtx_->SetUseTranspose(useTranspose);    
}
AmesosGenOp::
AmesosGenOp (const Teuchos::RCP<Amesos_BaseSolver>& solver,
             const Teuchos::RCP<Epetra_Operator>& massMtx,
             const bool useTranspose)
  : solver_ (solver),
    massMtx_ (massMtx),
    problem_ (NULL),
    useTranspose_ (useTranspose)
{
  if (solver.is_null ()) {
    throw std::invalid_argument ("AmesosGenOp constructor: The 'solver' "
                                 "input argument is null.");
  }
  if (massMtx.is_null ()) {
    throw std::invalid_argument ("AmesosGenOp constructor: The 'massMtx' "
                                 "input argument is null.");
  }

  Epetra_LinearProblem* problem = const_cast<Epetra_LinearProblem*> (solver->GetProblem ());
  if (problem == NULL) {
    throw std::invalid_argument ("The solver's GetProblem() method returned "
                                 "NULL.  This probably means that its "
                                 "LinearProblem has not yet been set.");
  }
  problem_ = problem;

  if (solver_->UseTranspose ()) {
    solver_->SetUseTranspose (! useTranspose);
  } else {
    solver_->SetUseTranspose (useTranspose);
  }

  if (massMtx_->UseTranspose ()) {
    massMtx_->SetUseTranspose (! useTranspose);
  } else {
    massMtx_->SetUseTranspose (useTranspose);
  }
}