6#ifndef aglowav2Element_hh
7#define aglowav2Element_hh
25 template<
class F = concepts::Real>
32 inline Key() : l_(0), j_(0) {}
37 inline Key(uint l, uint j) : l_(l), j_(j) {}
38 inline Key(
const Key& k) : l_(k.l()), j_(k.j()) {}
40 int operator==(
const Key& k)
const {
return l_ == k.l() && j_ == k.j();}
41 int operator<(
const Key& k)
const {
42 return l_ < k.l() || (l_ == k.l() && j_ < k.j());
44 inline uint& l() {
return l_;}
45 inline uint l()
const {
return l_;}
46 inline uint& j() {
return j_;}
47 inline uint j()
const {
return j_;}
61 inline const Key&
key()
const {
return key_;}
62 inline Key&
key() {
return key_;}
85 : cntr_(cntr), rd_(rd), key_(key), sz_(sz) {
94 template<
class F = concepts::Real>
103 inline Matrix(uint n, uint m, F* val,
bool row)
104 : n_(n), m_(m), val_(val), row_(row) {}
106 inline const F* source()
const {
return val_;}
107 inline F* destination()
const {
return val_;}
108 inline uint nrow()
const {
return n_;}
109 inline uint ncol()
const {
return m_;}
110 inline bool roworder()
const {
return row_;}
111 inline void transpose() {
112 row_ = row_ ? 0 : 1; uint n = n_; n_ = m_; m_ = n;
129 friend std::ostream& operator<<(std::ostream& os,
const M000& m);
146 uint
n = 0, uint m = 0)
const;
155 uint
n = 0, uint m = 0)
const;
167 void mult_T(
const F* src, F* dst,
const uint s,
const uint t)
const;
173 inline uint
n()
const {
return n_;}
184 const F* sv = src.source();
185 F* dv = dst.destination();
188 if (src.roworder()) {
189 if (dst.roworder()) {
191 for(uint i = 0; i < dst.nrow(); i++) {
193 for(uint j = 0; j < dst.ncol(); j++) {
195 const F* svj = sv + j;
196 for(uint k = 0; k < src.nrow(); k++) {
197 *dv += *svj * matrow[k]; svj += src.ncol();
206 for(uint i = 0; i < dst.ncol(); i++) {
207 for(uint j = 0; j < dst.nrow(); j++) {
210 const F* svi = sv + i;
211 for(uint k = 0; k < src.nrow(); k++) {
212 *dv += *svi * matrow[k]; svi += src.ncol();
221 if (dst.roworder()) {
223 for(uint i = 0; i < dst.nrow(); i++) {
225 for(uint j = 0; j < dst.ncol(); j++) {
227 const F* svj = sv + j*src.nrow();
228 for(uint k = 0; k < src.nrow(); k++) {
229 *dv += *svj++ * matrow[k];
238 for(uint i = 0; i < dst.ncol(); i++) {
239 for(uint j = 0; j < dst.nrow(); j++) {
242 const F* svi = sv + i*src.nrow();
243 for(uint k = 0; k < src.nrow(); k++) {
244 *dv += *svi++ * matrow[k];
256 uint n, uint m)
const {
257 const F* sv = src.source();
258 F* dv = dst.destination();
261 if (src.roworder()) {
262 if (dst.roworder()) {
264 for(uint i = 0; i < dst.nrow(); i++) {
265 for(uint j = 0; j < dst.ncol(); j++) {
268 const F* svj = sv + j;
269 for(uint k = 0; k < src.nrow(); k++) {
270 *dv += *svj * *matrow; svj += src.ncol(); matrow += n_;
279 for(uint i = 0; i < dst.ncol(); i++) {
280 for(uint j = 0; j < dst.nrow(); j++) {
283 const F* svi = sv + i;
284 for(uint k = 0; k < src.nrow(); k++) {
285 *dv += *svi * *matrow; svi += src.ncol(); matrow += n_;
294 if (dst.roworder()) {
296 for(uint i = 0; i < dst.nrow(); i++) {
297 for(uint j = 0; j < dst.ncol(); j++) {
300 const F* svj = sv + j*src.nrow();
301 for(uint k = 0; k < src.nrow(); k++) {
302 *dv += *svj++ * *matrow; matrow += n_;
311 for(uint i = 0; i < dst.ncol(); i++) {
312 for(uint j = 0; j < dst.nrow(); j++) {
315 const F* svi = sv + i*src.nrow();
316 for(uint k = 0; k < src.nrow(); k++) {
317 *dv += *svi++ * *matrow; matrow += n_;
328 void M000::mult_T(
const F* src, F* dst,
const uint s,
const uint t)
const {
329 for(uint i = 0; i < t; i++) {
330 for(uint j = 0; j < s; j++) {
332 const F* sj = src + j;
334 for(uint k = 0; k < n_; k++, mi += n_, sj += s) *dst += *sj * *mi;
345 template<
class F = concepts::Real>
380 inline uint
gamma()
const {
return gamma_;}
381 inline uint&
gamma() {
return gamma_;}
390 inline uint
index()
const {
return idx_;}
394 std::ostream&
info(std::ostream& os)
const;
426 lnk_(0), chld_(chld), nelm_(nelm), gamma_(1), idx_(index_++) {
432 std::memcpy(elm_, elm, nelm_*
sizeof(elm[0]));
uint nelement() const
Number of elements.
std::ostream & info(std::ostream &os) const
Information about the element.
Haar3d000(const concepts::Real3d &cntr, concepts::Real rd, const concepts::Real *m, uint n, uint idx[], uint idxn, concepts::Real sz, Haar3d000< F > *chld, const bem::Constant3d002< F > **elm, uint nelm)
const concepts::TMatrixBase< F > & T() const
Global degree of freedom.
Haar3d000< F > * child() const
Children.
const M000 & trafoM() const
Local transformation matrix.
Haar3d000< F > * link() const
Elements on the same level.
uint index() const
Index defined and used by some operators.
const bem::Constant3d002< F > * element(uint j) const
-th element of the wavelet
void replaceT(uint idx[], uint idxn)
Replace the T matrix (used for the sparsity pattern of the operator)
const Key & key() const
Key of the element.
concepts::Real size() const
Size of the support.
concepts::Real radius() const
Radius of the element.
virtual Haar3dXXX< F > * child() const =0
children of the element
const concepts::Real3d & center() const
Center of the element.
Haar3dXXX(const concepts::Real3d &cntr, concepts::Real rd, concepts::Real sz, const Key &key=Key())
Constructor.
virtual Haar3dXXX< F > * link() const =0
elements on the same level
virtual ~Haar3dXXX()
Destructor.
const concepts::Real & operator()(uint i, uint j) const
returns the matrix element
void mult_T(const Matrix< F > &src, Matrix< F > &dst, uint n=0, uint m=0) const
uint n() const
returns the matrix dimension
void mult(const Matrix< F > &src, Matrix< F > &dst, uint n=0, uint m=0) const
M000(const concepts::Real *m, uint n)
Matrix(uint n, uint m, F *val, bool row)
Set< F > makeSet(uint n, const F &first,...)