csr.cc
Go to the documentation of this file.
#include "rheolef/csr.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::csr_rep
Definition: asr.h:32
rheolef::csr_rep< T, sequential >::size_type
std::vector< T >::size_type size_type
Definition: csr.h:86
rheolef::_RHEOLEF_instanciation
_RHEOLEF_instanciation(Float, sequential, std::allocator< Float >) _RHEOLEF_instanciation(Float
rheolef::diag
csr< T, M > diag(const vec< T, M > &d)
Definition: csr.cc:56
rheolef::csr_rep< T, sequential >::data_iterator
vector_of_iterator< pair_type >::value_type data_iterator
Definition: csr.h:93
rheolef::vec
see the vec page for the full documentation
Definition: vec.h:79
a
Definition: diffusion_isotropic.h:25
rheolef::disarray_rep< T, distributed, A >
Definition: disarray.h:289
rheolef::csr< T, M >
rheolef::disarray_rep< T, sequential, A >
Definition: disarray.h:218
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
Float
see the Float page for the full documentation
mkgeo_ball.d
d
Definition: mkgeo_ball.sh:154
rheolef::csr_rep< T, sequential >::iterator
vector_of_iterator< pair_type >::iterator iterator
Definition: csr.h:90
mkgeo_ball.a
a
Definition: mkgeo_ball.sh:151
mkgeo_ball.n
n
Definition: mkgeo_ball.sh:150
rheolef::distributed
distributed
Definition: asr.cc:228