44 #include "AbstractLinAlgPack_DirectSparseSolverImp.hpp" 45 #include "Teuchos_AbstractFactoryStd.hpp" 46 #include "Teuchos_Assert.hpp" 47 #include "Teuchos_dyn_cast.hpp" 64 this->
initialize(dim,fact_struc,fact_nonzeros);
74 const char msg_err[] =
"DirectSparseSolverImp::BasisMatrixImp::initialize(...): Error!";
75 TEUCHOS_TEST_FOR_EXCEPTION( dim < 0, std::logic_error, msg_err );
76 TEUCHOS_TEST_FOR_EXCEPTION( fact_struc.get() == NULL, std::logic_error, msg_err );
77 TEUCHOS_TEST_FOR_EXCEPTION( fact_nonzeros.get() == NULL, std::logic_error, msg_err );
80 fact_struc_ = fact_struc;
81 fact_nonzeros_ = fact_nonzeros;
82 vec_space_.initialize(dim);
88 fact_struc_ = Teuchos::null;
89 fact_nonzeros_ = Teuchos::null;
90 vec_space_.initialize(0);
96 return fact_nonzeros_;
123 MatrixNonsing::mat_mns_mut_ptr_t
129 bm->initialize(dim_,fact_struc_,fact_nonzeros_);
156 using Teuchos::dyn_cast;
158 const char msg_err[] =
"DirectSparseSolverImp::analyze_and_factor(...): Error!";
159 TEUCHOS_TEST_FOR_EXCEPTION( row_perm == NULL, std::logic_error, msg_err );
160 TEUCHOS_TEST_FOR_EXCEPTION( col_perm == NULL, std::logic_error, msg_err );
161 TEUCHOS_TEST_FOR_EXCEPTION( rank == NULL, std::logic_error, msg_err );
162 TEUCHOS_TEST_FOR_EXCEPTION( basis_matrix == NULL, std::logic_error, msg_err );
171 bool alloc_new_fact_struc =
false;
172 if( bm_fact_struc.total_count() == 1 )
173 fact_struc = bm_fact_struc;
174 else if( this_fact_struc.total_count() == 1 )
175 fact_struc = this_fact_struc;
176 else if( bm_fact_struc.get() == this_fact_struc.get() && bm_fact_struc.total_count() == 2 )
177 fact_struc = bm_fact_struc;
179 alloc_new_fact_struc =
true;
180 if( alloc_new_fact_struc )
185 if( bm_fact_nonzeros.total_count() == 1 )
186 fact_nonzeros = bm_fact_nonzeros;
191 A,fact_struc.get(),fact_nonzeros.get(),row_perm,col_perm,rank,out
194 basis_matrix_imp.
initialize(*rank,fact_struc,fact_nonzeros);
197 fact_struc_ = fact_struc;
208 using Teuchos::dyn_cast;
210 const char msg_err[] =
"DirectSparseSolverImp::analyze_and_factor(...): Error!";
212 TEUCHOS_TEST_FOR_EXCEPTION( basis_matrix == NULL, std::logic_error, msg_err );
220 TEUCHOS_TEST_FOR_EXCEPTION(
221 fact_struc_in.get() == NULL && this_fact_struc.get() == NULL
225 if( fact_struc_in.get() != NULL )
226 fact_struc = fact_struc_in;
228 fact_struc = this_fact_struc;
232 if( bm_fact_nonzeros.total_count() == 1 )
233 fact_nonzeros = bm_fact_nonzeros;
237 this->
imp_factor(A,*fact_struc,fact_nonzeros.get(),out);
239 basis_matrix_imp.
initialize(rank_,fact_struc,fact_nonzeros);
250 fact_struc_ = Teuchos::null;
BasisMatrixImp()
Default initializers to uninitialized.
const BasisMatrix::fact_struc_ptr_t & get_fact_struc() const
Abstract class for objects that represent the factorized matrix and can be used to solve for differen...
virtual const fact_struc_ptr_t & get_fact_struc() const
virtual const Teuchos::RCP< FactorizationStructure > create_fact_struc() const =0
Create a new, uninitialized FactorizationStructure object.
virtual const fact_nonzeros_ptr_t & get_fact_nonzeros() const
Return a reference to a smart pointer to the object that represents the factorization nonzeros...
void factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, BasisMatrix *basis_matrix, const BasisMatrix::fact_struc_ptr_t &fact_struc, std::ostream *out)
Abstract interface for objects that represent a space for mutable coordinate vectors.
virtual void imp_analyze_and_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, FactorizationStructure *fact_struc, FactorizationNonzeros *fact_nonzeros, DenseLinAlgPack::IVector *row_perm, DenseLinAlgPack::IVector *col_perm, size_type *rank, std::ostream *out=NULL)=0
Called to implement the analyze_and_factor() without having to worry about memory mangagment details...
Mix-in interface for extracing explicit elements from a sparse matrix in one of several Fortran compa...
virtual void initialize(size_type dim, const fact_struc_ptr_t &fact_struc, const fact_nonzeros_ptr_t &fact_nonzeros)
Initialize given initialized factorization structure and factorization nonzeros objects.
Teuchos::RCP< FactorizationStructure > fact_struc_ptr_t
void analyze_and_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, DenseLinAlgPack::IVector *row_perm, DenseLinAlgPack::IVector *col_perm, size_type *rank, BasisMatrix *basis_matrix, std::ostream *out)
virtual Teuchos::RCP< BasisMatrixImp > create_matrix() const =0
Called by this->clone-mns().
void set_uninitialized()
Make uninitialized.
Implementation node subclass that combines factorization structure and factorization nonzeros into a ...
virtual void imp_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, const FactorizationStructure &fact_struc, FactorizationNonzeros *fact_nonzeros, std::ostream *out=NULL)=0
Called to implement the analyze_and_factor() without having to worry about memory mangagment details...
const VectorSpace & space_rows() const
virtual const Teuchos::RCP< FactorizationNonzeros > create_fact_nonzeros() const =0
Create a new, uninitialized FactorizationNonzeros object.
Teuchos::RCP< FactorizationNonzeros > fact_nonzeros_ptr_t
const VectorSpace & space_cols() const
mat_mns_mut_ptr_t clone_mns()