Skip to content
Snippets Groups Projects
Commit f9c8037a authored by Hörl, Maximilian's avatar Hörl, Maximilian
Browse files

add A, b, d, dof as member variables

parent 4e8fb584
No related branches found
No related tags found
No related merge requests found
...@@ -18,21 +18,23 @@ class DG ...@@ -18,21 +18,23 @@ class DG
public: public:
using Scalar = typename GridView::ctype; using Scalar = typename GridView::ctype;
static constexpr int dim = GridView::dimension; static constexpr int dim = GridView::dimension;
using Matrix = Dune::DynamicMatrix<Scalar>;
using Vector = Dune::DynamicVector<Scalar>;
//constructor //constructor
DG (const GridView& gridView, const Mapper& mapper, DG (const GridView& gridView, const Mapper& mapper,
const Problem& problem) : const Problem& problem) :
gridView_(gridView), mapper_(mapper), problem_(problem) {} gridView_(gridView), mapper_(mapper), problem_(problem),
dof((1 + dim) * gridView.size(0))
{
A = Matrix(dof, dof, 0.0); //initialize stiffness matrix
b = Vector(dof, 0.0); //initialize load vector
d = Vector(dof, 0.0); //initialize solution vector
}
const void operator() (const Scalar K, const Scalar mu) const const void operator() (const Scalar K, const Scalar mu)
{ {
//NOTE: what is an appropriate sparse matrix type? -> BCRS //NOTE: what is an appropriate sparse matrix type? -> BCRS
const int dof = (1 + dim)*gridView_.size(0); //degrees of freedom
using Matrix = Dune::DynamicMatrix<Scalar>;
using Vector = Dune::DynamicVector<Scalar>;
Matrix A(dof, dof, 0.0); //stiffness matrix
Vector b(dof, 0.0); //load vector
Vector d(dof, 0.0);
//NOTE: //NOTE:
// const int order = 3; //order of the quadrature rule // const int order = 3; //order of the quadrature rule
...@@ -122,7 +124,7 @@ public: ...@@ -122,7 +124,7 @@ public:
{ {
std::cout << "\t" << intersctGeo.corner(k); std::cout << "\t" << intersctGeo.corner(k);
} }
std::cout << "\n\n"; std::cout << "\tnormal: " << normal << "\n\n";
//TODO: quadrature rule cannot be used for dim = 1! //TODO: quadrature rule cannot be used for dim = 1!
// const Dune::QuadratureRule<double,dim-1>& secondOrderRule = // const Dune::QuadratureRule<double,dim-1>& secondOrderRule =
...@@ -480,10 +482,16 @@ public: ...@@ -480,10 +482,16 @@ public:
} }
const GridView& gridView_; const GridView& gridView_;
const Mapper& mapper_; //element mapper for gridView_ const Mapper& mapper_; //element mapper for gridView_
const Problem& problem_; //the DG problem to be solved const Problem& problem_; //the DG problem to be solved
const int dof; //degrees of freedom
private:
Matrix A; //stiffness matrix
Vector b; //load vector
Vector d; //solution vector
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment