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

Use a #define for the dimension

parent 1394cb30
No related branches found
No related tags found
No related merge requests found
......@@ -4,33 +4,64 @@ check_PROGRAMS = \
test-gradient-method
bin_PROGRAMS = \
one-body-sample
one-body-sample-2D \
one-body-sample-3D
.PHONY: run-one-body-sample
run-one-body-sample: one-body-sample
libtool --mode execute ./one-body-sample
## 2D
.PHONY: run-one-body-sample-2D
run-one-body-sample-2D: one-body-sample-2D
libtool --mode execute ./one-body-sample-2D
.PHONY: run-one-body-sample-time
run-one-body-sample-time: one-body-sample
libtool --mode execute time ./one-body-sample >/dev/null
.PHONY: run-one-body-sample-2D-time
run-one-body-sample-2D-time: one-body-sample-2D
libtool --mode execute time ./one-body-sample-2D >/dev/null
.PHONY: run-one-body-sample-valgrind
run-one-body-sample-valgrind: one-body-sample
libtool --mode execute valgrind ./one-body-sample
.PHONY: run-one-body-sample-2D-valgrind
run-one-body-sample-2D-valgrind: one-body-sample-2D
libtool --mode execute valgrind ./one-body-sample-2D
.PHONY: run-one-body-sample-gdb
run-one-body-sample-gdb: one-body-sample
libtool --mode execute gdb ./one-body-sample
.PHONY: run-one-body-sample-2D-gdb
run-one-body-sample-2D-gdb: one-body-sample-2D
libtool --mode execute gdb ./one-body-sample-2D
one_body_sample_SOURCES = \
one_body_sample_2D_SOURCES = \
assemblers.cc \
compute_state.cc \
compute_state_ruina.cc \
mysolver.cc \
one-body-sample.cc \
vtk.cc
one_body_sample_CPPFLAGS = \
$(AM_CPPFLAGS) -Dsrcdir=\"$(srcdir)\"
one_body_sample_2D_CPPFLAGS = \
$(AM_CPPFLAGS) -Dsrcdir=\"$(srcdir)\" -DDIM=2
## 3D
.PHONY: run-one-body-sample-3D
run-one-body-sample-3D: one-body-sample-3D
libtool --mode execute ./one-body-sample-3D
.PHONY: run-one-body-sample-3D-time
run-one-body-sample-3D-time: one-body-sample-3D
libtool --mode execute time ./one-body-sample-3D >/dev/null
.PHONY: run-one-body-sample-3D-valgrind
run-one-body-sample-3D-valgrind: one-body-sample-3D
libtool --mode execute valgrind ./one-body-sample-3D
.PHONY: run-one-body-sample-3D-gdb
run-one-body-sample-3D-gdb: one-body-sample-3D
libtool --mode execute gdb ./one-body-sample-3D
one_body_sample_3D_SOURCES = \
assemblers.cc \
compute_state.cc \
compute_state_ruina.cc \
mysolver.cc \
one-body-sample.cc \
vtk.cc
one_body_sample_3D_CPPFLAGS = \
$(AM_CPPFLAGS) -Dsrcdir=\"$(srcdir)\" -DDIM=3
test_gradient_method_SOURCES = \
test-gradient-method.cc
......
#ifndef DIM
#error DIM unset
#endif
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
// #include <dune/grid/yaspgrid.hh>
......@@ -5,65 +9,31 @@
#include <dune/fufem/functionspacebases/p1nodalbasis.hh>
// {{{ 2D
typedef Dune::FieldVector<double, 2> SmallVector2;
typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2;
typedef Dune::BCRSMatrix<SmallMatrix2> MatrixType2;
typedef Dune::BlockVector<SmallVector2> VectorType2;
typedef Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming> GridType2;
// typedef Dune::YaspGrid<2> GridType2;
typedef GridType2::LeafGridView GridView2;
typedef P1NodalBasis<GridView2, double> P1Basis2;
template void assemble_neumann<GridType2, GridView2, SmallVector2, P1Basis2>(
GridView2 const &gridView, P1Basis2 const &feBasis,
Dune::BitSetVector<1> const &neumannNodes,
Dune::BlockVector<SmallVector2> &f,
Dune::VirtualFunction<double, double> const &neumann, double time);
template Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
assemble_frictional<GridType2, GridView2, SmallVector2, P1Basis2>(
GridView2 const &gridView, P1Basis2 const &feBasis,
Dune::BitSetVector<1> const &frictionalNodes);
template Dune::shared_ptr<
Dune::GlobalNonlinearity<VectorType2, MatrixType2> const>
assemble_nonlinearity<VectorType2, MatrixType2>(
Dune::ParameterTree const &parset,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
nodalIntegrals,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
double h);
// }}}
// {{{ 3D
typedef Dune::FieldVector<double, 3> SmallVector3;
typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3;
typedef Dune::BCRSMatrix<SmallMatrix3> MatrixType3;
typedef Dune::BlockVector<SmallVector3> VectorType3;
typedef Dune::FieldVector<double, DIM> SmallVector;
typedef Dune::FieldMatrix<double, DIM, DIM> SmallMatrix;
typedef Dune::BCRSMatrix<SmallMatrix> MatrixType;
typedef Dune::BlockVector<SmallVector> VectorType;
typedef Dune::ALUGrid<3, 3, Dune::simplex, Dune::nonconforming> GridType3;
// typedef Dune::YaspGrid<3> GridType3;
typedef GridType3::LeafGridView GridView3;
typedef P1NodalBasis<GridView3, double> P1Basis3;
typedef Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming> GridType;
// typedef Dune::YaspGrid<DIM> GridType;
typedef GridType::LeafGridView GridView;
typedef P1NodalBasis<GridView, double> P1Basis;
template void assemble_neumann<GridType3, GridView3, SmallVector3, P1Basis3>(
GridView3 const &gridView, P1Basis3 const &feBasis,
template void assemble_neumann<GridType, GridView, SmallVector, P1Basis>(
GridView const &gridView, P1Basis const &feBasis,
Dune::BitSetVector<1> const &neumannNodes,
Dune::BlockVector<SmallVector3> &f,
Dune::BlockVector<SmallVector> &f,
Dune::VirtualFunction<double, double> const &neumann, double time);
template Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
assemble_frictional<GridType3, GridView3, SmallVector3, P1Basis3>(
GridView3 const &gridView, P1Basis3 const &feBasis,
assemble_frictional<GridType, GridView, SmallVector, P1Basis>(
GridView const &gridView, P1Basis const &feBasis,
Dune::BitSetVector<1> const &frictionalNodes);
template Dune::shared_ptr<
Dune::GlobalNonlinearity<VectorType3, MatrixType3> const>
assemble_nonlinearity<VectorType3, MatrixType3>(
Dune::GlobalNonlinearity<VectorType, MatrixType> const>
assemble_nonlinearity<VectorType, MatrixType>(
Dune::ParameterTree const &parset,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
nodalIntegrals,
Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
double h);
// }}}
#ifndef DIM
#error DIM unset
#endif
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
//#include <dune/grid/yaspgrid.hh>
......@@ -8,34 +12,16 @@
#include <dune/tectonic/myblockproblem.hh>
#include <dune/tectonic/myconvexproblem.hh>
// {{{ 2D
typedef Dune::FieldVector<double, 2> SmallVector2;
typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2;
typedef Dune::BlockVector<SmallVector2> VectorType2;
typedef Dune::BCRSMatrix<SmallMatrix2> MatrixType2;
typedef MyConvexProblem<MatrixType2, VectorType2> MyConvexProblemType2;
typedef MyBlockProblem<MyConvexProblemType2> MyBlockProblemType2;
typedef Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming> GridType2;
// typedef Dune::YaspGrid<2> GridType2;
template class MySolver<2, VectorType2, MatrixType2, GridType2,
MyBlockProblemType2>;
// }}}
// {{{ 3D
typedef Dune::FieldVector<double, 3> SmallVector3;
typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3;
typedef Dune::BlockVector<SmallVector3> VectorType3;
typedef Dune::BCRSMatrix<SmallMatrix3> MatrixType3;
typedef Dune::FieldVector<double, DIM> SmallVector;
typedef Dune::FieldMatrix<double, DIM, DIM> SmallMatrix;
typedef Dune::BlockVector<SmallVector> VectorType;
typedef Dune::BCRSMatrix<SmallMatrix> MatrixType;
typedef MyConvexProblem<MatrixType3, VectorType3> MyConvexProblemType3;
typedef MyBlockProblem<MyConvexProblemType3> MyBlockProblemType3;
typedef MyConvexProblem<MatrixType, VectorType> MyConvexProblemType;
typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType;
typedef Dune::ALUGrid<3, 3, Dune::simplex, Dune::nonconforming> GridType3;
// typedef Dune::YaspGrid<3> GridType3;
typedef Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming> GridType;
// typedef Dune::YaspGrid<DIM> GridType;
template class MySolver<3, VectorType3, MatrixType3, GridType3,
MyBlockProblemType3>;
// }}}
template class MySolver<DIM, VectorType, MatrixType, GridType,
MyBlockProblemType>;
......@@ -10,6 +10,10 @@
#error srcdir unset
#endif
#ifndef DIM
#error DIM unset
#endif
#ifndef HAVE_PYTHON
#error Python is required
#endif
......@@ -71,7 +75,7 @@
#include "enum_parser.cc"
#include "enum_state_model.cc"
int const dim = 2;
int const dim = DIM;
template <class GridView>
void setup_boundary(GridView const &gridView,
......
#include "vtk.hh"
#ifndef DIM
#error DIM unset
#endif
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
......@@ -11,40 +13,18 @@
typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType;
// {{{ 2D
typedef Dune::FieldVector<double, 2> SmallVector2;
typedef Dune::FieldMatrix<double, 2, 2> SmallMatrix2;
typedef Dune::BlockVector<SmallVector2> VectorType2;
typedef Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming> GridType2;
// typedef Dune::YaspGrid<2> GridType2;
typedef GridType2::LeafGridView GridView2;
typedef P1NodalBasis<GridView2, double> P1Basis2;
typedef P0Basis<GridView2, double> P0Basis2;
template void writeVtk<P1Basis2, P0Basis2, VectorType2, SingletonVectorType,
GridView2>(P1Basis2 vertexBasis,
VectorType2 displacement,
SingletonVectorType state, P0Basis2 cellBasis,
SingletonVectorType stress,
GridView2 gridView, std::string filename);
// }}}
// {{{ 3D
typedef Dune::FieldVector<double, 3> SmallVector3;
typedef Dune::FieldMatrix<double, 3, 3> SmallMatrix3;
typedef Dune::BlockVector<SmallVector3> VectorType3;
typedef Dune::ALUGrid<3, 3, Dune::simplex, Dune::nonconforming> GridType3;
// typedef Dune::YaspGrid<3> GridType3;
typedef GridType3::LeafGridView GridView3;
typedef P1NodalBasis<GridView3, double> P1Basis3;
typedef P0Basis<GridView3, double> P0Basis3;
template void writeVtk<P1Basis3, P0Basis3, VectorType3, SingletonVectorType,
GridView3>(P1Basis3 vertexBasis,
VectorType3 displacement,
SingletonVectorType state, P0Basis3 cellBasis,
SingletonVectorType stress,
GridView3 gridView, std::string filename);
// }}}
typedef Dune::FieldVector<double, DIM> SmallVector;
typedef Dune::FieldMatrix<double, DIM, DIM> SmallMatrix;
typedef Dune::BlockVector<SmallVector> VectorType;
typedef Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming> GridType;
// typedef Dune::YaspGrid<> GridType;
typedef GridType::LeafGridView GridView;
typedef P1NodalBasis<GridView, double> P1Basis;
typedef P0Basis<GridView, double> MyP0Basis;
template void writeVtk<P1Basis, MyP0Basis, VectorType, SingletonVectorType,
GridView>(P1Basis vertexBasis, VectorType displacement,
SingletonVectorType state, MyP0Basis cellBasis,
SingletonVectorType stress, GridView gridView,
std::string filename);
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