Commit 15a62026 authored by Andreas Dedner's avatar Andreas Dedner

small change to hande storage structure of valueProjection

parent 7991bc74
......@@ -25,12 +25,11 @@ namespace Dune {
}
LeastSquares(const LeastSquares &source) = delete;
template <class Vector>
Vector leastSquaresSolver(const Vector &b, const Vector &d ){
template <class Vector, class Solution>
void solve(const Vector &b, const Vector &d, Solution &solution){
assert( (b.size() == d.size()) );
assert( solution.size() == A.cols() );
Vector solution(b.size());
Vector systemVector = vectorSetUp(b,d);
Size systemMatrixDim = systemMatrixInv_.rows();
......@@ -44,14 +43,19 @@ namespace Dune {
for ( Size i = 0; i < solution.size(); ++i)
solution[i] = systemMultiply[i];
}
template <class Vector>
Vector solve(const Vector &b, const Vector &d ){
Vector solution(A.cols());
leastSquaresSolver(b,d,solution);
return solution;
}
template <class Vector>
void leastSquaresSystem(const std::vector< Vector > &bVec,
const std::vector< Vector > &dVec,
std::vector< Vector > &solnVec){
void solve(const std::vector< Vector > &bVec,
const std::vector< Vector > &dVec,
std::vector< Vector > &solnVec){
// check dimensions match
assert( (bVec.size() == dVec.size()) && (dVec.size() == solnVec.size()));
......
......@@ -273,6 +273,20 @@ namespace Dune
}
private:
template <class Matrix>
struct ColumnVector
{
ColumnVector(Matrix &matrix, int col)
: matrix_(matrix), col_(col) {}
int size() const { return matrix.rows(); }
typename Matrix::value_t& operator[](int i) {return matrix_[i][col_];}
Matrix &matrix_;
int col_;
};
template <class Matrix>
ColumnVector<Matrix> columnVector(Matrix &matrix, int col)
{ return ColumnVector(matrix,col); }
// L.solve(d,b,columnVector(valueProjection,beta));
void buildProjections ();
// issue with making these const: use of delete default constructor in some python bindings...
......
......@@ -42,11 +42,12 @@ dune.fem.parameter.append({"fem.verboserank": 0})
# a bounding box dg space and a conforming/non conforming VEM space
# <codecell>
eps = dune.ufl.Constant(0.9,"test")
uflSpace = dune.ufl.Space(2, dimRange=1)
x = SpatialCoordinate(uflSpace)
exact = as_vector( [x[0]*x[1] * cos(pi*x[0]*x[1])] )
massCoeff = 1+sin(dot(x,x))
diffCoeff = 1-0.9*cos(dot(x,x))
diffCoeff = 1-eps*cos(dot(x,x))
methods = [ ### "[legend,space,scheme,spaceKwargs,schemeKwargs]"
["lagrange","lagrange","galerkin",{},{}],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment