Commit 1681e00a authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

renamed path dune/amdis to amdis

parent 91f95d14
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include <iostream>
#include <dune/amdis/AMDiS.hpp>
#include <dune/amdis/ProblemStat.hpp>
#include <dune/amdis/Operators.hpp>
#include <dune/amdis/common/Literals.hpp>
#include <dune/amdis/common/FieldMatVec.hpp>
#include <dune/amdis/gridfunctions/Integrate.hpp>
using namespace AMDiS;
// 1 component with polynomial degree 1
//using Grid = Dune::AlbertaGrid<AMDIS_DIM, AMDIS_DOW>;
using ElliptParam = YaspGridBasis<AMDIS_DIM, 2>;
using ElliptProblem = ProblemStat<ElliptParam>;
int main(int argc, char** argv)
{
AMDiS::init(argc, argv);
using namespace Dune::Indices;
ElliptProblem prob("ellipt");
prob.initialize(INIT_ALL);
auto u = prob.getSolution(_0);
// eval a functor at global coordinates (at quadrature points)
auto expr1 = evalAtQP([](Dune::FieldVector<double, AMDIS_DOW> const& x) { return x[0] + x[1]; });
auto expr2 = [](Dune::FieldVector<double, AMDIS_DOW> const& x) { return x[0] + x[1]; };
auto expr3 = [](auto const& x) { return x[0] + x[1]; };
// constant values at quadrature points
auto expr4 = 1.0;
auto expr5 = Dune::FieldVector<double, AMDIS_DOW>{1.0, 2.0};
auto expr6 = std::ref(expr4);
// Coordinate vector and component
auto expr7 = X();
auto expr8 = X(0);
// Evaluation of the DOFVector (component) at quadrature points
auto expr9 = prob.getSolution(_0);
// ---------------------------------
// derivative of expressions
auto diff4 = gradientAtQP(expr4);
// auto diff5 = gradientAtQP(expr5);
auto diff6 = gradientAtQP(expr6);
// auto diff7 = gradientAtQP(expr7);
auto diff8 = gradientAtQP(expr8);
auto diff9 = gradientAtQP(expr9);
// ---------------------------------
u.interpolate(expr1);
u.interpolate(expr2);
u.interpolate(expr3);
u.interpolate(expr4);
u.interpolate(expr6);
u.interpolate(expr8);
u.interpolate(expr9);
// ---------------------------------
// operations with expressions
auto op1 = expr1 + expr2;
auto op2 = expr1 * expr4;
auto op3 = two_norm(expr5);
auto op4 = min(expr6, expr8);
auto op5 = one_norm(expr7);
auto op6 = invokeAtQP([](double v) { return 2*v; }, op5);
u.interpolate(two_norm(diff4));
u.interpolate(two_norm(diff6));
u.interpolate(two_norm(diff8));
u.interpolate(two_norm(diff9));
// ---------------------------------
// integration of expressions
auto gv = u.basis().gridView();
auto int1 = integrate(op1, gv, 5);
auto int2 = integrate(op2, gv, 5);
auto int3 = integrate(op3, gv);
auto int4 = integrate(op4, gv, 5);
auto int5 = integrate(op5, gv, 5);
auto int6 = integrate(op6, gv, 5);
std::cout << int1 << int2 << int3 << int4 << int5 << int6 << "\n";
AdaptInfo adaptInfo("adapt", 1);
prob.writeFiles(adaptInfo, true);
AMDiS::finalize();
return 0;
}
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include <iostream>
#include <dune/amdis/AMDiS.hpp>
#include <dune/amdis/AdaptInstationary.hpp>
#include <dune/amdis/ProblemInstat.hpp>
#include <dune/amdis/ProblemStat.hpp>
#include <dune/amdis/Terms.hpp>
#include <dune/amdis/common/Literals.hpp>
#include <dune/grid/utility/structuredgridfactory.hh>
using namespace AMDiS;
using Grid = Dune::AlbertaGrid<AMDIS_DIM, AMDIS_DOW>;
// 1 component with polynomial degree 1
using Param = LagrangeTraits<Grid, 1>;
using ElliptProblem = ProblemStat<Param>;
using ElliptProblemInstat = ProblemInstat<Param>;
int main(int argc, char** argv)
{
AMDiS::init(argc, argv);
// Create grid from structured grid
std::array<unsigned int, 2> n = {{4, 4}};
Dune::FieldVector<double, 2> lower = {{0.0, 0.0}};
Dune::FieldVector<double, 2> upper = {{1.0, 1.0}};
auto grid = Dune::StructuredGridFactory<Grid>::createSimplexGrid(lower, upper, n);
// NOTE: can not be used with AlbertaGrid
ElliptProblem prob("ellipt", *grid);
prob.initialize(INIT_ALL);
ElliptProblemInstat probInstat("ellipt", prob);
probInstat.initialize(INIT_UH_OLD);
AdaptInfo adaptInfo("adapt");
using Op = ElliptProblem::ElementOperator;
Op opL, opForce;
opL.addSOT(1.0);
prob.addMatrixOperator(opL, 0, 0);
opForce.addZOT( eval([](auto const& x) { return -1.0; }) );
prob.addVectorOperator(opForce, 0);
using BOp = ElliptProblem::IntersectionOperator;
BOp opB;
opB.addZOT(1.0);
prob.addVectorOperator({1}, opB, 0);
// set boundary condition
auto predicate = [](auto const& x){ return x[0] < 1.e-8 || x[1] < 1.e-8; }; // define boundary
auto dbcValues = [](auto const& x){ return 0.0; }; // set value
prob.addDirichletBC(predicate, 0, 0, dbcValues);
*prob.getSolution() = 0.0; // maybe not necessary
prob.buildAfterCoarsen(adaptInfo, Flag(0));
prob.solve(adaptInfo);
prob.writeFiles(adaptInfo, true);
AMDiS::finalize();
return 0;
}
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include <iostream>
#include <dune/amdis/AMDiS.hpp>
#include <dune/amdis/AdaptInstationary.hpp>
#include <dune/amdis/ProblemInstat.hpp>
#include <dune/amdis/ProblemStat.hpp>
#include <dune/amdis/Terms.hpp>
#include <dune/amdis/common/Literals.hpp>
using namespace AMDiS;
#define DIM 2
int main(int argc, char** argv)
{
AMDiS::init(argc, argv);
using namespace Dune::Functions::BasisBuilder;
const int dim = DIM;
typedef Dune::YaspGrid<dim> GridType;
Dune::FieldVector<double,dim> bbox = {1, 1};
std::array<int,dim> num = {1, 1};
GridType grid(bbox,num);
typedef GridType::LeafGridView GridView;
GridView gridView = grid.leafGridView();
auto basis = makeBasis(
gridView,
composite(
power<dim>(
lagrange<2>(),
flatLexicographic()),
lagrange<1>(),
blockedLexicographic()
));
auto localView = basis.localView();
forEachNode(localView.tree(), [&](auto const& rowNode, auto rowTreePath)
{
msg("Basis[", to_string(rowTreePath), "]: treeIndex = ",rowNode.treeIndex());
});
}
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include <dune/common/reservedvector.hh> #include <dune/common/reservedvector.hh>
#include <dune/functions/functionspacebases/flatmultiindex.hh> #include <dune/functions/functionspacebases/flatmultiindex.hh>
#include <dune/amdis/common/Concepts.hpp> #include <amdis/common/Concepts.hpp>
#include <dune/amdis/common/FieldMatVec.hpp> #include <amdis/common/FieldMatVec.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
#include <iostream> #include <iostream>
#include <dune/amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <dune/amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <dune/amdis/Operators.hpp> #include <amdis/Operators.hpp>
#include <dune/amdis/common/Literals.hpp> #include <amdis/common/Literals.hpp>
#include <dune/amdis/common/FieldMatVec.hpp> #include <amdis/common/FieldMatVec.hpp>
#include <dune/amdis/gridfunctions/Integrate.hpp> #include <amdis/gridfunctions/Integrate.hpp>
using namespace AMDiS; using namespace AMDiS;
......
#include <cmath> #include <cmath>
#include <dune/amdis/common/FieldMatVec.hpp> #include <amdis/common/FieldMatVec.hpp>
#include <dune/amdis/common/Math.hpp> #include <amdis/common/Math.hpp>
#include "Tests.hpp" #include "Tests.hpp"
......
#include <dune/amdis/utility/Filesystem.hpp> #include <amdis/utility/Filesystem.hpp>
#include "Tests.hpp" #include "Tests.hpp"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <dune/functions/functionspacebases/powerbasis.hh> #include <dune/functions/functionspacebases/powerbasis.hh>
#include <dune/functions/functionspacebases/lagrangebasis.hh> #include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <dune/amdis/utility/FiniteElementType.hpp> #include <amdis/utility/FiniteElementType.hpp>
#include "Tests.hpp" #include "Tests.hpp"
int main() int main()
......
#include <dune/amdis/common/FieldMatVec.hpp> #include <amdis/common/FieldMatVec.hpp>
#include <dune/amdis/common/MultiTypeMatrix.hpp> #include <amdis/common/MultiTypeMatrix.hpp>
using namespace AMDiS; using namespace AMDiS;
......
#include <dune/amdis/common/FieldMatVec.hpp> #include <amdis/common/FieldMatVec.hpp>
#include <dune/amdis/common/MultiTypeVector.hpp> #include <amdis/common/MultiTypeVector.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <dune/functions/functionspacebases/powerbasis.hh> #include <dune/functions/functionspacebases/powerbasis.hh>
#include <dune/functions/functionspacebases/lagrangebasis.hh> #include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <dune/amdis/utility/RangeType.hpp> #include <amdis/utility/RangeType.hpp>
#include "Tests.hpp" #include "Tests.hpp"
int main() int main()
......
#include <string> #include <string>
#include <vector> #include <vector>
#include <dune/amdis/utility/String.hpp> #include <amdis/utility/String.hpp>
#include "Tests.hpp" #include "Tests.hpp"
using namespace AMDiS; using namespace AMDiS;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <dune/functions/functionspacebases/lagrangebasis.hh> #include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <dune/functions/functionspacebases/powerbasis.hh> #include <dune/functions/functionspacebases/powerbasis.hh>
#include <dune/amdis/utility/TreeData.hpp> #include <amdis/utility/TreeData.hpp>
#include "Tests.hpp" #include "Tests.hpp"
......
Supports Markdown
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