Hermes2D  3.0
asmlist.cpp
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 #include "asmlist.h"
17 
18 namespace Hermes
19 {
20  namespace Hermes2D
21  {
22  template<typename Scalar>
24  {
25  this->cnt = other.cnt;
26  memcpy(this->idx, other.idx, sizeof(int)* H2D_MAX_LOCAL_BASIS_SIZE);
27  memcpy(this->dof, other.dof, sizeof(int)* H2D_MAX_LOCAL_BASIS_SIZE);
28  memcpy(this->coef, other.coef, sizeof(Scalar)* H2D_MAX_LOCAL_BASIS_SIZE);
29  }
30 
31  template<typename Scalar>
33  {
34  cnt = 0;
35  }
36 
37  template<typename Scalar>
39  {
40  return this->idx;
41  }
42 
43  template<typename Scalar>
44  int* AsmList<Scalar>::get_dof()
45  {
46  return this->dof;
47  }
48 
49  template<typename Scalar>
50  unsigned int AsmList<Scalar>::get_cnt()
51  {
52  return this->cnt;
53  }
54 
55  template<typename Scalar>
56  Scalar* AsmList<Scalar>::get_coef()
57  {
58  return this->coef;
59  }
60 
61  template<typename Scalar>
62  void AsmList<Scalar>::add_triplet(int i, int d, Scalar c)
63  {
64  if (!(cnt < H2D_MAX_LOCAL_BASIS_SIZE - 1))
65  assert(cnt < H2D_MAX_LOCAL_BASIS_SIZE - 1);
66 
67  idx[cnt] = i;
68  dof[cnt] = d;
69  coef[cnt++] = c;
70  }
71 
72  template HERMES_API class AsmList < double > ;
73  template HERMES_API class AsmList < std::complex<double> > ;
74  }
75 }
Definition: adapt.h:24
AsmList()
Constructor.
Definition: asmlist.cpp:32
void add_triplet(int i, int d, Scalar c)
Adds a record for one basis function (shape functions index, basis functions index, coefficient).
Definition: asmlist.cpp:62
int dof[H2D_MAX_LOCAL_BASIS_SIZE]
array of basis function numbers (DOFs)
Definition: asmlist.h:50
unsigned short cnt
the number of items in the arrays idx, dof and coef
Definition: asmlist.h:54
Scalar coef[H2D_MAX_LOCAL_BASIS_SIZE]
array of coefficients
Definition: asmlist.h:52
int idx[H2D_MAX_LOCAL_BASIS_SIZE]
array of shape function indices
Definition: asmlist.h:48