Skip to content
Snippets Groups Projects
Commit eb61212e authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

simplification: hardwire the local matrix type

[[Imported from SVN: r5727]]
parent c031427a
No related branches found
No related tags found
No related merge requests found
...@@ -235,8 +235,6 @@ assembleMatrix(const std::vector<RigidBodyMotion<2> >& sol, ...@@ -235,8 +235,6 @@ assembleMatrix(const std::vector<RigidBodyMotion<2> >& sol,
const int numOfBaseFct = 2; const int numOfBaseFct = 2;
mat.setSize(numOfBaseFct, numOfBaseFct);
// Extract local solution // Extract local solution
std::vector<RigidBodyMotion<2> > localSolution(numOfBaseFct); std::vector<RigidBodyMotion<2> > localSolution(numOfBaseFct);
...@@ -244,7 +242,7 @@ assembleMatrix(const std::vector<RigidBodyMotion<2> >& sol, ...@@ -244,7 +242,7 @@ assembleMatrix(const std::vector<RigidBodyMotion<2> >& sol,
localSolution[i] = sol[indexSet.subIndex(*it,i,gridDim)]; localSolution[i] = sol[indexSet.subIndex(*it,i,gridDim)];
// setup matrix // setup matrix
getLocalMatrix( *it, localSolution, numOfBaseFct, mat); getLocalMatrix( *it, localSolution, mat);
// Add element matrix to global stiffness matrix // Add element matrix to global stiffness matrix
for(int i=0; i<numOfBaseFct; i++) { for(int i=0; i<numOfBaseFct; i++) {
...@@ -269,20 +267,18 @@ assembleMatrix(const std::vector<RigidBodyMotion<2> >& sol, ...@@ -269,20 +267,18 @@ assembleMatrix(const std::vector<RigidBodyMotion<2> >& sol,
template <class GridView> template <class GridView>
template <class MatrixType>
void RodAssembler<GridView,2>:: void RodAssembler<GridView,2>::
getLocalMatrix( EntityType &entity, getLocalMatrix( EntityType &entity,
const std::vector<RigidBodyMotion<2> >& localSolution, const std::vector<RigidBodyMotion<2> >& localSolution,
const int matSize, MatrixType& localMat) const Dune::Matrix<MatrixBlock>& localMat) const
{ {
const typename GridView::IndexSet& indexSet = this->gridView_.indexSet(); const typename GridView::IndexSet& indexSet = this->gridView_.indexSet();
/* ndof is the number of vectors of the element */ /* ndof is the number of vectors of the element */
int ndof = matSize; int ndof = localSolution.size();
for (int i=0; i<matSize; i++) localMat.setSize(ndof,ndof);
for (int j=0; j<matSize; j++) localMat = 0;
localMat[i][j] = 0;
Dune::P1LocalFiniteElement<double,double,gridDim> localFiniteElement; Dune::P1LocalFiniteElement<double,double,gridDim> localFiniteElement;
...@@ -327,9 +323,9 @@ getLocalMatrix( EntityType &entity, ...@@ -327,9 +323,9 @@ getLocalMatrix( EntityType &entity,
double theta = localSolution[0].q.angle_*shapeFunction[0] + localSolution[1].q.angle_*shapeFunction[1]; double theta = localSolution[0].q.angle_*shapeFunction[0] + localSolution[1].q.angle_*shapeFunction[1];
for (int i=0; i<matSize; i++) { for (int i=0; i<localMat.N(); i++) {
for (int j=0; j<matSize; j++) { for (int j=0; j<localMat.M(); j++) {
// \partial J^2 / \partial x_i \partial x_j // \partial J^2 / \partial x_i \partial x_j
localMat[i][j][0][0] += weight * shapeGrad[i][0] * shapeGrad[j][0] localMat[i][j][0][0] += weight * shapeGrad[i][0] * shapeGrad[j][0]
......
...@@ -144,10 +144,9 @@ public: ...@@ -144,10 +144,9 @@ public:
protected: protected:
/** \brief Compute the element tangent stiffness matrix */ /** \brief Compute the element tangent stiffness matrix */
template <class MatrixType>
void getLocalMatrix( EntityType &entity, void getLocalMatrix( EntityType &entity,
const std::vector<RigidBodyMotion<2> >& localSolution, const std::vector<RigidBodyMotion<2> >& localSolution,
const int matSize, MatrixType& mat) const; Dune::Matrix<MatrixBlock>& mat) const;
}; // end class }; // end class
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment