Rheolef  7.2
an efficient C++ finite element environment
Loading...
Searching...
No Matches
csr.cc
Go to the documentation of this file.
1
21
22#include "rheolef/linalg.h"
23namespace rheolef {
24// ----------------------------------------------------------------------------
25// build from diag
26// ----------------------------------------------------------------------------
27template<class T>
28template<class A>
29void
31{
32 resize (d.ownership(), d.ownership(), d.ownership().size());
33 iterator ia = begin();
34 for (size_type i = 0, n = d.size(); i < n; i++) {
35 data_iterator q = ia[i];
36 (*q).first = i;
37 (*q).second = d[i];
38 ia[i+1] = ia[i] + 1;
39 }
40}
41#ifdef _RHEOLEF_HAVE_MPI
42template<class T>
43template<class A>
44void
46{
48 _ext.resize (d.ownership(), d.ownership(), 0);
49 _jext2dis_j.resize(0);
50 _dis_nnz = d.dis_size();
52}
53#endif // _RHEOLEF_HAVE_MPI
54template<class T, class M>
56diag (const vec<T,M>& d)
57{
58 csr<T,M> a;
59 a.data().build_from_diag (d.data());
60 return a;
61}
62// ----------------------------------------------------------------------------
63// instanciation in library
64// ----------------------------------------------------------------------------
65
66#define _RHEOLEF_instanciation_a(T,M,A) \
67template void csr_rep<T,M>::build_from_diag (const disarray_rep<T,M,A>&);
68
69#define _RHEOLEF_instanciation(T,M) \
70template csr<T,M> diag (const vec<T,M>&); \
71_RHEOLEF_instanciation_a(T,M,std::allocator<T>)
72
74#ifdef _RHEOLEF_HAVE_MPI
76#endif // _RHEOLEF_HAVE_MPI
77
78} // namespace rheolef
#define _RHEOLEF_instanciation(T, M, A)
Definition asr.cc:223
csr_rep< T, sequential > _ext
Definition csr.h:251
std::vector< size_type > _jext2dis_j
Definition csr.h:252
void resize(size_type loc_nrow1=0, size_type loc_ncol1=0, size_type loc_nnz1=0)
Definition csr_seq.cc:69
void build_from_diag(const disarray_rep< T, sequential, A > &d)
Definition csr.cc:30
const_iterator begin() const
Definition csr.h:107
vector_of_iterator< pair_type >::iterator iterator
Definition csr.h:90
std::vector< T >::size_type size_type
Definition csr.h:86
vector_of_iterator< pair_type >::value_type data_iterator
Definition csr.h:93
csr_rep(size_type loc_nrow1=0, size_type loc_ncol1=0, size_type loc_nnz1=0)
Definition csr_seq.cc:57
see the csr page for the full documentation
Definition csr.h:317
see the vec page for the full documentation
Definition vec.h:79
distributed
Definition asr.cc:228
double Float
see the Float page for the full documentation
Definition Float.h:143
This file is part of Rheolef.
csr< T, M > diag(const vec< T, M > &d)
Definition csr.cc:56