Skip to content
Snippets Groups Projects
Commit b8d6ddac authored by Piotr Minakowski's avatar Piotr Minakowski
Browse files

Change to UGGrid Pk elements, comment out 3D case

parent 8e6bae01
No related branches found
No related tags found
1 merge request!15Change to UGGrid Pk elements, comment out 3D case
......@@ -129,7 +129,7 @@ to \lstinline{none}. }
Find the place where your Local Finite Element Maps are created and make it possible to use polynomial degree 3
\begin{lstlisting}
Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,deg> FEM;
Dune::PDELab::PkLocalFiniteElementMap<GV,DF,double,deg> FEM;
\end{lstlisting}
Compile your program and check the results.
......@@ -242,3 +242,4 @@ If you are done with these exercises, you can play with the initial conditions.
\bibliography{exercise04.bib}
\end{document}
\grid
......@@ -135,19 +135,26 @@ int main(int argc, char** argv)
}
}
// YaspGrid section
// UGGrid section
if (dim==2)
{
const int dim=2;
typedef Dune::YaspGrid<dim> Grid;
typedef Dune::UGGrid<dim> Grid;
typedef Grid::ctype DF;
Dune::FieldVector<DF,dim> L;
//upper right
L[0] = ptree.get("grid.structured.LX",(double)1.0);
L[1] = ptree.get("grid.structured.LY",(double)1.0);
std::array<int,dim> N;
N[0] = ptree.get("grid.structured.NX",(int)10);
N[1] = ptree.get("grid.structured.NY",(int)10);
std::shared_ptr<Grid> gridp = std::shared_ptr<Grid>(new Grid(L,N));
std::array<unsigned int,dim> N;
N[0] = ptree.get("grid.structured.NX",(unsigned int)10);
N[1] = ptree.get("grid.structured.NY",(unsigned int)10);
//lower left
Dune::FieldVector<double,dim> lowerleft(0.0);
// build a structured simplex grid
auto gridp = Dune::StructuredGridFactory<Grid>::createSimplexGrid(lowerleft, L, N);
gridp->globalRefine(refinement);
typedef Grid::LeafGridView GV;
GV gv=gridp->leafGridView();
......@@ -168,40 +175,43 @@ int main(int argc, char** argv)
driver(gv,fem,ptree);
}
}
/*
if (dim==3)
{
const int dim=3;
typedef Dune::YaspGrid<dim> Grid;
typedef Dune::UGGrid<dim> Grid;
typedef Grid::ctype DF;
Dune::FieldVector<DF,dim> L;
//upper right
L[0] = ptree.get("grid.structured.LX",(double)1.0);
L[1] = ptree.get("grid.structured.LY",(double)1.0);
L[2] = ptree.get("grid.structured.LZ",(double)1.0);
std::array<int,dim> N;
N[0] = ptree.get("grid.structured.NX",(int)1);
N[1] = ptree.get("grid.structured.NY",(int)1);
N[2] = ptree.get("grid.structured.NZ",(int)1);
std::shared_ptr<Grid> gridp = std::shared_ptr<Grid>(new Grid(L,N));
std::array<unsigned int,dim> N;
N[0] = ptree.get("grid.structured.NX",(unsigned int)1);
N[1] = ptree.get("grid.structured.NY",(unsigned int)1);
N[2] = ptree.get("grid.structured.NZ",(unsigned int)1);
//lower left
Dune::FieldVector<double,dim> lowerleft(0.0);
// build a structured simplex grid
auto gridp = Dune::StructuredGridFactory<Grid>::createSimplexGrid(lowerleft, L, N);
gridp->globalRefine(refinement);
typedef Grid::LeafGridView GV;
GV gv=gridp->leafGridView();
if (degree==1) {
typedef Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,1> FEM;
typedef Dune::PDELab::PkLocalFiniteElementMap<GV,DF,double,1> FEM;
FEM fem(gv);
driver(gv,fem,ptree);
}
if (degree==2) {
typedef Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,2> FEM;
FEM fem(gv);
driver(gv,fem,ptree);
}
//exercise 2 step 1: add degree 3 for higher order exercise
if (degree==3) {
typedef Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,3> FEM;
typedef Dune::PDELab::PkLocalFiniteElementMap<GV,DF,double,2> FEM;
FEM fem(gv);
driver(gv,fem,ptree);
}
}
}
*/
}
catch (Dune::Exception &e){
std::cerr << "Dune reported error: " << e << std::endl;
......
......@@ -126,63 +126,78 @@ int main(int argc, char** argv)
//add degree 3 for higher order exercise
}
// YaspGrid section
// UGGrid section
if (dim==2)
{
const int dim=2;
typedef Dune::YaspGrid<dim> Grid;
typedef Dune::UGGrid<dim> Grid;
typedef Grid::ctype DF;
Dune::FieldVector<DF,dim> L;
//upper right
L[0] = ptree.get("grid.structured.LX",(double)1.0);
L[1] = ptree.get("grid.structured.LY",(double)1.0);
std::array<int,dim> N;
N[0] = ptree.get("grid.structured.NX",(int)10);
N[1] = ptree.get("grid.structured.NY",(int)10);
std::shared_ptr<Grid> gridp = std::shared_ptr<Grid>(new Grid(L,N));
std::array<unsigned int,dim> N;
N[0] = ptree.get("grid.structured.NX",(unsigned int)10);
N[1] = ptree.get("grid.structured.NY",(unsigned int)10);
//lower left
Dune::FieldVector<double,dim> lowerleft(0.0);
// build a structured simplex grid
auto gridp = Dune::StructuredGridFactory<Grid>::createSimplexGrid(lowerleft, L, N);
gridp->globalRefine(refinement);
typedef Grid::LeafGridView GV;
GV gv=gridp->leafGridView();
if (degree==1) {
typedef Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,1> FEM;
typedef Dune::PDELab::PkLocalFiniteElementMap<GV,DF,double,1> FEM;
FEM fem(gv);
driver(gv,fem,ptree);
}
if (degree==2) {
typedef Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,2> FEM;
typedef Dune::PDELab::PkLocalFiniteElementMap<GV,DF,double,2> FEM;
FEM fem(gv);
driver(gv,fem,ptree);
}
//add degree 3 for higher order exercise
}
/*
if (dim==3)
{
const int dim=3;
typedef Dune::YaspGrid<dim> Grid;
typedef Dune::UGGrid<dim> Grid;
typedef Grid::ctype DF;
Dune::FieldVector<DF,dim> L;
//upper right
L[0] = ptree.get("grid.structured.LX",(double)1.0);
L[1] = ptree.get("grid.structured.LY",(double)1.0);
L[2] = ptree.get("grid.structured.LZ",(double)1.0);
std::array<int,dim> N;
N[0] = ptree.get("grid.structured.NX",(int)1);
N[1] = ptree.get("grid.structured.NY",(int)1);
N[2] = ptree.get("grid.structured.NZ",(int)1);
std::shared_ptr<Grid> gridp = std::shared_ptr<Grid>(new Grid(L,N));
std::array<unsigned int,dim> N;
N[0] = ptree.get("grid.structured.NX",(unsigned int)1);
N[1] = ptree.get("grid.structured.NY",(unsigned int)1);
N[2] = ptree.get("grid.structured.NZ",(unsigned int)1);
//lower left
Dune::FieldVector<double,dim> lowerleft(0.0);
// build a structured simplex grid
auto gridp = Dune::StructuredGridFactory<Grid>::createSimplexGrid(lowerleft, L, N);
gridp->globalRefine(refinement);
typedef Grid::LeafGridView GV;
GV gv=gridp->leafGridView();
if (degree==1) {
typedef Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,1> FEM;
typedef Dune::PDELab::PkLocalFiniteElementMap<GV,DF,double,1> FEM;
FEM fem(gv);
driver(gv,fem,ptree);
}
if (degree==2) {
typedef Dune::PDELab::QkLocalFiniteElementMap<GV,DF,double,2> FEM;
typedef Dune::PDELab::PkLocalFiniteElementMap<GV,DF,double,2> FEM;
FEM fem(gv);
driver(gv,fem,ptree);
}
//add degree 3 for higher order exercise
}
}
*/
}
catch (Dune::Exception &e){
std::cerr << "Dune reported error: " << e << std::endl;
......
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