Skip to content
Snippets Groups Projects
Commit 8c3e2dd9 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

MatrixType comes before VectorType

parent 6f607e34
Branches
No related tags found
No related merge requests found
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
#include "localnonlinearity.hh" #include "localnonlinearity.hh"
namespace Dune { namespace Dune {
template <class VectorTypeTEMPLATE, class MatrixTypeTEMPLATE> template <class MatrixTypeTEMPLATE, class VectorTypeTEMPLATE>
class GlobalNonlinearity { class GlobalNonlinearity {
public: public:
typedef VectorTypeTEMPLATE VectorType;
typedef MatrixTypeTEMPLATE MatrixType; typedef MatrixTypeTEMPLATE MatrixType;
typedef VectorTypeTEMPLATE VectorType;
int static const dim = VectorTypeTEMPLATE::block_type::dimension; int static const dim = VectorTypeTEMPLATE::block_type::dimension;
double operator()(VectorType const &x) const { double operator()(VectorType const &x) const {
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
#include "nicefunction.hh" #include "nicefunction.hh"
namespace Dune { namespace Dune {
template <class VectorType, class MatrixType> template <class MatrixType, class VectorType>
class GlobalRuinaNonlinearity class GlobalRuinaNonlinearity
: public GlobalNonlinearity<VectorType, MatrixType> { : public GlobalNonlinearity<MatrixType, VectorType> {
private: private:
typedef shared_ptr<BlockVector<FieldVector<double, 1>> const> dataptr; typedef shared_ptr<BlockVector<FieldVector<double, 1>> const> dataptr;
public: public:
using GlobalNonlinearity<VectorType, MatrixType>::dim; using GlobalNonlinearity<MatrixType, VectorType>::dim;
GlobalRuinaNonlinearity(dataptr nodalIntegrals, dataptr a, dataptr mu, GlobalRuinaNonlinearity(dataptr nodalIntegrals, dataptr a, dataptr mu,
dataptr eta, dataptr normalStress, dataptr b, dataptr eta, dataptr normalStress, dataptr b,
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
#include "ellipticenergy.hh" #include "ellipticenergy.hh"
/* Just for debugging */ /* Just for debugging */
template <int dim, class VectorType, class MatrixType> template <int dim, class MatrixType, class VectorType>
double computeEnergy( double computeEnergy(
MatrixType const &A, VectorType const &b, MatrixType const &A, VectorType const &b,
Dune::GlobalNonlinearity<VectorType, MatrixType> const &phi, Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi,
VectorType const &x) { VectorType const &x) {
double ret; double ret;
VectorType tmp(x.size()); VectorType tmp(x.size());
...@@ -123,7 +123,7 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { ...@@ -123,7 +123,7 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
*/ */
MyDirectionalConvexFunction< MyDirectionalConvexFunction<
Dune::GlobalNonlinearity<VectorType, MatrixType>> const psi(localA, Dune::GlobalNonlinearity<MatrixType, VectorType>> const psi(localA,
localb, localb,
problem.phi, problem.phi,
u, v); u, v);
...@@ -201,7 +201,7 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { ...@@ -201,7 +201,7 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
double const localb = tmp * direction; // <Av,v> double const localb = tmp * direction; // <Av,v>
MyDirectionalConvexFunction< MyDirectionalConvexFunction<
Dune::GlobalNonlinearity<VectorType, MatrixType>> const Dune::GlobalNonlinearity<MatrixType, VectorType>> const
psi(localA, localb, problem.phi, u, direction); psi(localA, localb, problem.phi, u, direction);
Interval<double> D; Interval<double> D;
......
...@@ -22,12 +22,12 @@ class MyConvexProblem { ...@@ -22,12 +22,12 @@ class MyConvexProblem {
\param u The solution vector \param u The solution vector
*/ */
MyConvexProblem(MatrixType const &A, MyConvexProblem(MatrixType const &A,
Dune::GlobalNonlinearity<VectorType, MatrixType> const &phi, Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi,
VectorType const &f) VectorType const &f)
: A(A), phi(phi), f(f) {}; : A(A), phi(phi), f(f) {};
MatrixType const &A; MatrixType const &A;
Dune::GlobalNonlinearity<VectorType, MatrixType> const &phi; Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi;
VectorType const &f; VectorType const &f;
}; };
......
...@@ -52,8 +52,8 @@ assemble_frictional(GridView const &gridView, FEBasis const &feBasis, ...@@ -52,8 +52,8 @@ assemble_frictional(GridView const &gridView, FEBasis const &feBasis,
return nodalIntegrals; return nodalIntegrals;
} }
template <class VectorType, class MatrixType> template <class MatrixType, class VectorType>
Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const> Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const>
assemble_nonlinearity( assemble_nonlinearity(
Dune::ParameterTree const &parset, Dune::ParameterTree const &parset,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
...@@ -85,7 +85,7 @@ assemble_nonlinearity( ...@@ -85,7 +85,7 @@ assemble_nonlinearity(
*L = parset.get<double>("ruina.L"); *L = parset.get<double>("ruina.L");
return Dune::make_shared< return Dune::make_shared<
Dune::GlobalRuinaNonlinearity<VectorType, MatrixType> const>( Dune::GlobalRuinaNonlinearity<MatrixType, VectorType> const>(
nodalIntegrals, a, mu, eta, normalStress, b, state, L, h); nodalIntegrals, a, mu, eta, normalStress, b, state, L, h);
} }
case Config::Laursen: case Config::Laursen:
......
...@@ -22,8 +22,8 @@ Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> ...@@ -22,8 +22,8 @@ Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
assemble_frictional(GridView const &gridView, FEBasis const &feBasis, assemble_frictional(GridView const &gridView, FEBasis const &feBasis,
Dune::BitSetVector<1> const &frictionalNodes); Dune::BitSetVector<1> const &frictionalNodes);
template <class VectorType, class MatrixType> template <class MatrixType, class VectorType>
Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const> Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const>
assemble_nonlinearity( assemble_nonlinearity(
Dune::ParameterTree const &parset, Dune::ParameterTree const &parset,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
......
...@@ -30,8 +30,8 @@ assemble_frictional<GridType, GridView, SmallVector, P1Basis>( ...@@ -30,8 +30,8 @@ assemble_frictional<GridType, GridView, SmallVector, P1Basis>(
Dune::BitSetVector<1> const &frictionalNodes); Dune::BitSetVector<1> const &frictionalNodes);
template Dune::shared_ptr< template Dune::shared_ptr<
Dune::GlobalNonlinearity<VectorType, MatrixType> const> Dune::GlobalNonlinearity<MatrixType, VectorType> const>
assemble_nonlinearity<VectorType, MatrixType>( assemble_nonlinearity<MatrixType, VectorType>(
Dune::ParameterTree const &parset, Dune::ParameterTree const &parset,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
nodalIntegrals, nodalIntegrals,
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include "mysolver.hh" #include "mysolver.hh"
template <int dim, class VectorType, class MatrixType, class GridType, template <int dim, class MatrixType, class VectorType, class GridType,
class BlockProblemType> class BlockProblemType>
MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::MySolver( MySolver<dim, MatrixType, VectorType, GridType, BlockProblemType>::MySolver(
Dune::ParameterTree parset, int refinements, double solver_tolerance, Dune::ParameterTree parset, int refinements, double solver_tolerance,
GridType const &grid, Dune::BitSetVector<dim> const &ignoreNodes) GridType const &grid, Dune::BitSetVector<dim> const &ignoreNodes)
: baseEnergyNorm(linearBaseSolverStep), : baseEnergyNorm(linearBaseSolverStep),
...@@ -43,20 +43,20 @@ MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::MySolver( ...@@ -43,20 +43,20 @@ MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::MySolver(
multigridStep->ignoreNodes_ = &ignoreNodes; multigridStep->ignoreNodes_ = &ignoreNodes;
} }
template <int dim, class VectorType, class MatrixType, class GridType, template <int dim, class MatrixType, class VectorType, class GridType,
class BlockProblemType> class BlockProblemType>
MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::~MySolver() { MySolver<dim, MatrixType, VectorType, GridType, BlockProblemType>::~MySolver() {
for (auto &x : transferOperators) for (auto &x : transferOperators)
delete x; delete x;
delete multigridStep; delete multigridStep;
} }
template <int dim, class VectorType, class MatrixType, class GridType, template <int dim, class MatrixType, class VectorType, class GridType,
class BlockProblemType> class BlockProblemType>
typename MySolver<dim, VectorType, MatrixType, GridType, typename MySolver<dim, MatrixType, VectorType, GridType,
BlockProblemType>::SolverType * BlockProblemType>::SolverType *
MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::getSolver() { MySolver<dim, MatrixType, VectorType, GridType, BlockProblemType>::getSolver() {
return multigridStep; return multigridStep;
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <dune/fufem/assemblers/transferoperatorassembler.hh> #include <dune/fufem/assemblers/transferoperatorassembler.hh>
#include <dune/tnnmg/iterationsteps/tnnmgstep.hh> #include <dune/tnnmg/iterationsteps/tnnmgstep.hh>
template <int dim, class VectorType, class MatrixType, class GridType, template <int dim, class MatrixType, class VectorType, class GridType,
class BlockProblemType> class BlockProblemType>
class MySolver { class MySolver {
private: private:
......
...@@ -23,5 +23,5 @@ typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType; ...@@ -23,5 +23,5 @@ typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType;
typedef Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming> GridType; typedef Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming> GridType;
// typedef Dune::YaspGrid<DIM> GridType; // typedef Dune::YaspGrid<DIM> GridType;
template class MySolver<DIM, VectorType, MatrixType, GridType, template class MySolver<DIM, MatrixType, VectorType, GridType,
MyBlockProblemType>; MyBlockProblemType>;
...@@ -215,7 +215,7 @@ int main(int argc, char *argv[]) { ...@@ -215,7 +215,7 @@ int main(int argc, char *argv[]) {
typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType; typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType;
// Set up TNNMG solver // Set up TNNMG solver
MySolver<dim, VectorType, MatrixType, GridType, MyBlockProblemType> MySolver<dim, MatrixType, VectorType, GridType, MyBlockProblemType>
mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid, mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid,
ignoreNodes); ignoreNodes);
...@@ -277,7 +277,7 @@ int main(int argc, char *argv[]) { ...@@ -277,7 +277,7 @@ int main(int argc, char *argv[]) {
// TODO: We should not have to reassemble the nonlinearity anew // TODO: We should not have to reassemble the nonlinearity anew
// everytime // everytime
auto myGlobalNonlinearity = auto myGlobalNonlinearity =
assemble_nonlinearity<VectorType, MatrixType>( assemble_nonlinearity<MatrixType, VectorType>(
parset.sub("boundary.friction"), nodalIntegrals, s4_new, h); parset.sub("boundary.friction"), nodalIntegrals, s4_new, h);
MyConvexProblemType const myConvexProblem(stiffnessMatrix, MyConvexProblemType const myConvexProblem(stiffnessMatrix,
*myGlobalNonlinearity, b4); *myGlobalNonlinearity, b4);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment