Rheolef  7.1
an efficient C++ finite element environment
csr.cc
Go to the documentation of this file.
1 
22 #include "rheolef/csr.h"
23 namespace rheolef {
24 // ----------------------------------------------------------------------------
25 // build from diag
26 // ----------------------------------------------------------------------------
27 template<class T>
28 template<class A>
29 void
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
42 template<class T>
43 template<class A>
44 void
46 {
47  base::build_from_diag (d);
48  _ext.resize (d.ownership(), d.ownership(), 0);
49  _jext2dis_j.resize(0);
50  _dis_nnz = d.dis_size();
51  _scatter_initialized = false;
52 }
53 #endif // _RHEOLEF_HAVE_MPI
54 template<class T, class M>
56 diag (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) \
67 template void csr_rep<T,M>::build_from_diag (const disarray_rep<T,M,A>&);
68 
69 #define _RHEOLEF_instanciation(T,M) \
70 template 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
mkgeo_ball.n
int n
Definition: mkgeo_ball.sh:150
rheolef::csr_rep
Definition: csr.h:81
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::sequential
Definition: distributed.h:28
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
mkgeo_ball.d
int d
Definition: mkgeo_ball.sh:154
rheolef::vec
see the vec page for the full documentation
Definition: vec.h:79
a
Definition: diffusion_isotropic.h:25
rheolef::distributed
Definition: distributed.h:88
rheolef::disarray_rep< T, distributed, A >
Definition: disarray.h:289
rheolef::csr
see the csr page for the full documentation
Definition: csr.h:317
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
rheolef::csr_rep< T, sequential >::iterator
vector_of_iterator< pair_type >::iterator iterator
Definition: csr.h:90
mkgeo_ball.a
int a
Definition: mkgeo_ball.sh:151