Loading...
Searching...
No Matches
csr.cc
Go to the documentation of this file.
#include "rheolef/linalg.h"
namespace rheolef {
// ----------------------------------------------------------------------------
// build from diag
// ----------------------------------------------------------------------------
template<class T>
template<class A>
void
csr_rep<T,sequential>::build_from_diag (const disarray_rep<T,sequential,A>& d)
{
resize (d.ownership(), d.ownership(), d.ownership().size());
iterator ia = begin();
for (size_type i = 0, n = d.size(); i < n; i++) {
data_iterator q = ia[i];
(*q).first = i;
(*q).second = d[i];
ia[i+1] = ia[i] + 1;
}
}
#ifdef _RHEOLEF_HAVE_MPI
template<class T>
template<class A>
void
csr_rep<T,distributed>::build_from_diag (const disarray_rep<T,distributed,A>& d)
{
base::build_from_diag (d);
_ext.resize (d.ownership(), d.ownership(), 0);
_jext2dis_j.resize(0);
_dis_nnz = d.dis_size();
_scatter_initialized = false;
}
#endif // _RHEOLEF_HAVE_MPI
template<class T, class M>
csr<T,M>
diag (const vec<T,M>& d)
{
csr<T,M> a;
a.data().build_from_diag (d.data());
return a;
}
// ----------------------------------------------------------------------------
// instanciation in library
// ----------------------------------------------------------------------------
#define _RHEOLEF_instanciation_a(T,M,A) \
template void csr_rep<T,M>::build_from_diag (const disarray_rep<T,M,A>&);
#define _RHEOLEF_instanciation(T,M) \
template csr<T,M> diag (const vec<T,M>&); \
_RHEOLEF_instanciation_a(T,M,std::allocator<T>)
_RHEOLEF_instanciation(Float,sequential)
#ifdef _RHEOLEF_HAVE_MPI
_RHEOLEF_instanciation(Float,distributed)
#endif // _RHEOLEF_HAVE_MPI
} // namespace rheolef
_RHEOLEF_instanciation
#define _RHEOLEF_instanciation(T, M, A)
Definition asr.cc:223
rheolef::csr_rep< T, distributed >::_ext
csr_rep< T, sequential > _ext
Definition csr.h:251
rheolef::csr_rep< T, distributed >::_scatter_initialized
bool _scatter_initialized
Definition csr.h:257
rheolef::csr_rep< T, distributed >::csr_rep
csr_rep()
Definition csr_mpi.cc:69
rheolef::csr_rep< T, distributed >::_dis_nnz
size_type _dis_nnz
Definition csr.h:253
rheolef::csr_rep< T, distributed >::_jext2dis_j
std::vector< size_type > _jext2dis_j
Definition csr.h:252
rheolef::csr_rep< T, sequential >::resize
void resize(size_type loc_nrow1=0, size_type loc_ncol1=0, size_type loc_nnz1=0)
Definition csr_seq.cc:69
rheolef::csr_rep< T, sequential >::build_from_diag
void build_from_diag(const disarray_rep< T, sequential, A > &d)
Definition csr.cc:30
rheolef::csr_rep< T, sequential >::begin
const_iterator begin() const
Definition csr.h:107
rheolef::csr_rep< T, sequential >::iterator
vector_of_iterator< pair_type >::iterator iterator
Definition csr.h:90
rheolef::csr_rep< T, sequential >::size_type
std::vector< T >::size_type size_type
Definition csr.h:86
rheolef::csr_rep< T, sequential >::data_iterator
vector_of_iterator< pair_type >::value_type data_iterator
Definition csr.h:93
rheolef::csr_rep< T, sequential >::csr_rep
csr_rep(size_type loc_nrow1=0, size_type loc_ncol1=0, size_type loc_nnz1=0)
Definition csr_seq.cc:57
rheolef::csr
see the csr page for the full documentation
Definition csr.h:317
rheolef::disarray_rep
Definition disarray.h:214
rheolef::vec
see the vec page for the full documentation
Definition vec.h:79
rheolef::distributed
distributed
Definition asr.cc:228
rheolef::Float
double Float
see the Float page for the full documentation
Definition Float.h:143
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::diag
csr< T, M > diag(const vec< T, M > &d)
Definition csr.cc:56
d
size_t d
Definition neumann-laplace-lambda.cc:28
rheolef::sequential
Definition communicator.h:62