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

[Cleanup] Rename: DIM -> MY_DIM for UG

parent 255bd087
Branches
No related tags found
No related merge requests found
Showing
with 66 additions and 66 deletions
...@@ -17,11 +17,11 @@ common_sources = \ ...@@ -17,11 +17,11 @@ common_sources = \
sand_wedge_2D_SOURCES = $(common_sources) sand-wedge.cc sand_wedge_2D_SOURCES = $(common_sources) sand-wedge.cc
sand_wedge_2D_CPPFLAGS = \ sand_wedge_2D_CPPFLAGS = \
$(AM_CPPFLAGS) $(BOOST_CPPFLAGS) \ $(AM_CPPFLAGS) $(BOOST_CPPFLAGS) \
-Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DDIM=2 -Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DMY_DIM=2
sand_wedge_3D_SOURCES = $(common_sources) sand-wedge.cc sand_wedge_3D_SOURCES = $(common_sources) sand-wedge.cc
sand_wedge_3D_CPPFLAGS = \ sand_wedge_3D_CPPFLAGS = \
$(AM_CPPFLAGS) $(BOOST_CPPFLAGS) \ $(AM_CPPFLAGS) $(BOOST_CPPFLAGS) \
-Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DDIM=3 -Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DMY_DIM=3
# Some are for clang, others are for gcc # Some are for clang, others are for gcc
AM_CXXFLAGS = \ AM_CXXFLAGS = \
......
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include "explicitgrid.hh" #include "explicitgrid.hh"
template class MyAssembler<GridView, DIM>; template class MyAssembler<GridView, MY_DIM>;
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include "explicitvectors.hh" #include "explicitvectors.hh"
......
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include <dune/common/function.hh> #include <dune/common/function.hh>
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
using Function = Dune::VirtualFunction<double, double>; using Function = Dune::VirtualFunction<double, double>;
using Factory = SolverFactory< using Factory = SolverFactory<
DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>, MY_DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
Grid>; Grid>;
using MyStateUpdater = StateUpdater<ScalarVector, Vector>; using MyStateUpdater = StateUpdater<ScalarVector, Vector>;
using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, DIM>; using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, MY_DIM>;
template class CoupledTimeStepper<Factory, MyStateUpdater, MyVelocityUpdater>; template class CoupledTimeStepper<Factory, MyStateUpdater, MyVelocityUpdater>;
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
#include <dune/grid/alugrid.hh> #include <dune/grid/alugrid.hh>
#pragma clang diagnostic pop #pragma clang diagnostic pop
using Grid = Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming>; using Grid = Dune::ALUGrid<MY_DIM, MY_DIM, Dune::simplex, Dune::nonconforming>;
using GridView = Grid::LeafGridView; using GridView = Grid::LeafGridView;
#endif #endif
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bcrsmatrix.hh>
#include <dune/istl/bvector.hh> #include <dune/istl/bvector.hh>
using LocalVector = Dune::FieldVector<double, DIM>; using LocalVector = Dune::FieldVector<double, MY_DIM>;
using LocalMatrix = Dune::FieldMatrix<double, DIM, DIM>; using LocalMatrix = Dune::FieldMatrix<double, MY_DIM, MY_DIM>;
using Vector = Dune::BlockVector<LocalVector>; using Vector = Dune::BlockVector<LocalVector>;
using Matrix = Dune::BCRSMatrix<LocalMatrix>; using Matrix = Dune::BCRSMatrix<LocalMatrix>;
using ScalarVector = Dune::BlockVector<Dune::FieldVector<double, 1>>; using ScalarVector = Dune::BlockVector<Dune::FieldVector<double, 1>>;
......
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include <dune/common/function.hh> #include <dune/common/function.hh>
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
using Function = Dune::VirtualFunction<double, double>; using Function = Dune::VirtualFunction<double, double>;
using Factory = SolverFactory< using Factory = SolverFactory<
DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>, MY_DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
Grid>; Grid>;
using MyStateUpdater = StateUpdater<ScalarVector, Vector>; using MyStateUpdater = StateUpdater<ScalarVector, Vector>;
using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, DIM>; using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, MY_DIM>;
template class FixedPointIterator<Factory, MyStateUpdater, MyVelocityUpdater>; template class FixedPointIterator<Factory, MyStateUpdater, MyVelocityUpdater>;
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include "explicitvectors.hh" #include "explicitvectors.hh"
......
...@@ -10,7 +10,7 @@ namespace { ...@@ -10,7 +10,7 @@ namespace {
using LocalVector2D = Dune::FieldVector<double, 2>; using LocalVector2D = Dune::FieldVector<double, 2>;
using LocalMatrix2D = Dune::FieldMatrix<double, 2, 2>; using LocalMatrix2D = Dune::FieldMatrix<double, 2, 2>;
using LocalVector = Dune::FieldVector<double, DIM>; using LocalVector = Dune::FieldVector<double, MY_DIM>;
// kludge because fieldvectors have no initialiser_list constructor, see // kludge because fieldvectors have no initialiser_list constructor, see
// https://dune-project.org/flyspray/index.php?do=details&task_id=1166 // https://dune-project.org/flyspray/index.php?do=details&task_id=1166
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
#include "mygrid.hh" #include "mygrid.hh"
#include "midpoint.hh" #include "midpoint.hh"
#if DIM == 3 #if MY_DIM == 3
SimplexManager::SimplexManager(unsigned int shift) : shift_(shift) {} SimplexManager::SimplexManager(unsigned int shift) : shift_(shift) {}
#endif #endif
void SimplexManager::addFromVertices(unsigned int U, unsigned int V, void SimplexManager::addFromVertices(unsigned int U, unsigned int V,
unsigned int W) { unsigned int W) {
#if DIM == 3 #if MY_DIM == 3
unsigned int const U2 = U + shift_; unsigned int const U2 = U + shift_;
unsigned int const V2 = V + shift_; unsigned int const V2 = V + shift_;
unsigned int const W2 = W + shift_; unsigned int const W2 = W + shift_;
...@@ -51,10 +51,10 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() { ...@@ -51,10 +51,10 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
unsigned int const vc = 11; unsigned int const vc = 11;
#if DIM == 3 #if MY_DIM == 3
Dune::FieldMatrix<double, 2 * vc, DIM> vertices; Dune::FieldMatrix<double, 2 * vc, MY_DIM> vertices;
#else #else
Dune::FieldMatrix<double, vc, DIM> vertices; Dune::FieldMatrix<double, vc, MY_DIM> vertices;
#endif #endif
for (size_t i = 0; i < 2; ++i) { for (size_t i = 0; i < 2; ++i) {
size_t k = 0; size_t k = 0;
...@@ -70,7 +70,7 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() { ...@@ -70,7 +70,7 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
vertices[k++][i] = ACC[i]; vertices[k++][i] = ACC[i];
vertices[k++][i] = C[i]; vertices[k++][i] = C[i];
assert(k == vc); assert(k == vc);
#if DIM == 3 #if MY_DIM == 3
vertices[k++][i] = A[i]; vertices[k++][i] = A[i];
vertices[k++][i] = AAB[i]; vertices[k++][i] = AAB[i];
vertices[k++][i] = AB[i]; vertices[k++][i] = AB[i];
...@@ -86,7 +86,7 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() { ...@@ -86,7 +86,7 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
#endif #endif
} }
#if DIM == 3 #if MY_DIM == 3
for (size_t k = 0; k < vc; ++k) { for (size_t k = 0; k < vc; ++k) {
vertices[k][2] = -MyGeometry::depth / 2.0; vertices[k][2] = -MyGeometry::depth / 2.0;
vertices[k + vc][2] = MyGeometry::depth / 2.0; vertices[k + vc][2] = MyGeometry::depth / 2.0;
...@@ -97,13 +97,13 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() { ...@@ -97,13 +97,13 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
gridFactory.insertVertex(vertices[i]); gridFactory.insertVertex(vertices[i]);
Dune::GeometryType cell; Dune::GeometryType cell;
#if DIM == 3 #if MY_DIM == 3
cell.makeTetrahedron(); cell.makeTetrahedron();
#else #else
cell.makeTriangle(); cell.makeTriangle();
#endif #endif
#if DIM == 3 #if MY_DIM == 3
SimplexManager sm(vc); SimplexManager sm(vc);
#else #else
SimplexManager sm; SimplexManager sm;
...@@ -122,8 +122,8 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() { ...@@ -122,8 +122,8 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
// sanity-check choices of simplices // sanity-check choices of simplices
for (size_t i = 0; i < simplices.size(); ++i) { for (size_t i = 0; i < simplices.size(); ++i) {
Dune::FieldMatrix<double, DIM, DIM> check; Dune::FieldMatrix<double, MY_DIM, MY_DIM> check;
for (size_t j = 0; j < DIM; ++j) for (size_t j = 0; j < MY_DIM; ++j)
check[j] = vertices[simplices[i][j + 1]] - vertices[simplices[i][j]]; check[j] = vertices[simplices[i][j + 1]] - vertices[simplices[i][j]];
assert(check.determinant() > 0); assert(check.determinant() > 0);
gridFactory.insertElement(cell, simplices[i]); gridFactory.insertElement(cell, simplices[i]);
...@@ -173,7 +173,7 @@ bool MyFaces<GridView>::xyBetween(Vector const &v1, Vector const &v2, ...@@ -173,7 +173,7 @@ bool MyFaces<GridView>::xyBetween(Vector const &v1, Vector const &v2,
template <class GridView> template <class GridView>
MyFaces<GridView>::MyFaces(GridView const &gridView) MyFaces<GridView>::MyFaces(GridView const &gridView)
: :
#if DIM == 3 #if MY_DIM == 3
lower(gridView), lower(gridView),
right(gridView), right(gridView),
upper(gridView), upper(gridView),
...@@ -191,7 +191,7 @@ MyFaces<GridView>::MyFaces(GridView const &gridView) ...@@ -191,7 +191,7 @@ MyFaces<GridView>::MyFaces(GridView const &gridView)
lower.insertFacesByProperty([&](typename GridView::Intersection const &in) { lower.insertFacesByProperty([&](typename GridView::Intersection const &in) {
return isClose(0, in.geometry().center()[1]); return isClose(0, in.geometry().center()[1]);
}); });
#if DIM == 3 #if MY_DIM == 3
front.insertFacesByProperty([&](typename GridView::Intersection const &in) { front.insertFacesByProperty([&](typename GridView::Intersection const &in) {
return isClose(MyGeometry::depth / 2.0, in.geometry().center()[2]); return isClose(MyGeometry::depth / 2.0, in.geometry().center()[2]);
}); });
......
...@@ -19,7 +19,7 @@ template <class GridView> struct MyFaces { ...@@ -19,7 +19,7 @@ template <class GridView> struct MyFaces {
BoundaryPatch<GridView> right; BoundaryPatch<GridView> right;
BoundaryPatch<GridView> upper; BoundaryPatch<GridView> upper;
#if DIM == 3 #if MY_DIM == 3
BoundaryPatch<GridView> front; BoundaryPatch<GridView> front;
BoundaryPatch<GridView> back; BoundaryPatch<GridView> back;
#endif #endif
...@@ -45,7 +45,7 @@ class SimplexManager { ...@@ -45,7 +45,7 @@ class SimplexManager {
public: public:
using SimplexList = std::vector<std::vector<unsigned int>>; using SimplexList = std::vector<std::vector<unsigned int>>;
#if DIM == 3 #if MY_DIM == 3
SimplexManager(unsigned int shift); SimplexManager(unsigned int shift);
#endif #endif
...@@ -56,7 +56,7 @@ class SimplexManager { ...@@ -56,7 +56,7 @@ class SimplexManager {
private: private:
SimplexList simplices_; SimplexList simplices_;
#if DIM == 3 #if MY_DIM == 3
unsigned int const shift_; unsigned int const shift_;
#endif #endif
}; };
......
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include "explicitgrid.hh" #include "explicitgrid.hh"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <dune/common/parametertree.hh> #include <dune/common/parametertree.hh>
class PatchFunction class PatchFunction
: public Dune::VirtualFunction<Dune::FieldVector<double, DIM>, : public Dune::VirtualFunction<Dune::FieldVector<double, MY_DIM>,
Dune::FieldVector<double, 1>> { Dune::FieldVector<double, 1>> {
private: private:
bool static isBetween(double x, double lower, double upper) { bool static isBetween(double x, double lower, double upper) {
...@@ -17,13 +17,13 @@ class PatchFunction ...@@ -17,13 +17,13 @@ class PatchFunction
return std::abs(a - b) < 1e-14; return std::abs(a - b) < 1e-14;
}; };
bool insideRegion2(Dune::FieldVector<double, DIM> const &z) const { bool insideRegion2(Dune::FieldVector<double, MY_DIM> const &z) const {
assert(isClose(0, z[1])); assert(isClose(0, z[1]));
return isBetween(z[0], _X[0], _Y[0]); return isBetween(z[0], _X[0], _Y[0]);
} }
Dune::FieldVector<double, DIM> const &_X; Dune::FieldVector<double, MY_DIM> const &_X;
Dune::FieldVector<double, DIM> const &_Y; Dune::FieldVector<double, MY_DIM> const &_Y;
double const _v1; double const _v1;
double const _v2; double const _v2;
...@@ -32,7 +32,7 @@ class PatchFunction ...@@ -32,7 +32,7 @@ class PatchFunction
PatchFunction(double v1, double v2) PatchFunction(double v1, double v2)
: _X(MyGeometry::X), _Y(MyGeometry::Y), _v1(v1), _v2(v2) {} : _X(MyGeometry::X), _Y(MyGeometry::Y), _v1(v1), _v2(v2) {}
void evaluate(Dune::FieldVector<double, DIM> const &x, void evaluate(Dune::FieldVector<double, MY_DIM> const &x,
Dune::FieldVector<double, 1> &y) const { Dune::FieldVector<double, 1> &y) const {
y = insideRegion2(x) ? _v2 : _v1; y = insideRegion2(x) ? _v2 : _v1;
} }
......
...@@ -8,20 +8,20 @@ ...@@ -8,20 +8,20 @@
#include "mygeometry.hh" #include "mygeometry.hh"
class TwoPieceFunction class TwoPieceFunction
: public Dune::VirtualFunction<Dune::FieldVector<double, DIM>, : public Dune::VirtualFunction<Dune::FieldVector<double, MY_DIM>,
Dune::FieldVector<double, 1>> { Dune::FieldVector<double, 1>> {
private: private:
bool liesBelow(Dune::FieldVector<double, DIM> const &x, bool liesBelow(Dune::FieldVector<double, MY_DIM> const &x,
Dune::FieldVector<double, DIM> const &y, Dune::FieldVector<double, MY_DIM> const &y,
Dune::FieldVector<double, DIM> const &z) const { Dune::FieldVector<double, MY_DIM> const &z) const {
return (z[0] - x[0]) * (y[1] - x[1]) / (y[0] - x[0]) >= z[1] - x[1]; return (z[0] - x[0]) * (y[1] - x[1]) / (y[0] - x[0]) >= z[1] - x[1];
}; };
bool insideRegion2(Dune::FieldVector<double, DIM> const &z) const { bool insideRegion2(Dune::FieldVector<double, MY_DIM> const &z) const {
return liesBelow(_K, _M, z); return liesBelow(_K, _M, z);
}; };
Dune::FieldVector<double, DIM> const &_K; Dune::FieldVector<double, MY_DIM> const &_K;
Dune::FieldVector<double, DIM> const &_M; Dune::FieldVector<double, MY_DIM> const &_M;
double const _v1; double const _v1;
double const _v2; double const _v2;
...@@ -30,7 +30,7 @@ class TwoPieceFunction ...@@ -30,7 +30,7 @@ class TwoPieceFunction
TwoPieceFunction(double v1, double v2) TwoPieceFunction(double v1, double v2)
: _K(MyGeometry::K), _M(MyGeometry::M), _v1(v1), _v2(v2) {} : _K(MyGeometry::K), _M(MyGeometry::M), _v1(v1), _v2(v2) {}
void evaluate(Dune::FieldVector<double, DIM> const &x, void evaluate(Dune::FieldVector<double, MY_DIM> const &x,
Dune::FieldVector<double, 1> &y) const { Dune::FieldVector<double, 1> &y) const {
y = insideRegion2(x) ? _v2 : _v1; y = insideRegion2(x) ? _v2 : _v1;
} }
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#error datadir unset #error datadir unset
#endif #endif
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#if !HAVE_ALUGRID #if !HAVE_ALUGRID
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
#include "timestepping.hh" #include "timestepping.hh"
#include "vtk.hh" #include "vtk.hh"
size_t const dims = DIM; size_t const dims = MY_DIM;
void initPython() { void initPython() {
Python::start(); Python::start();
...@@ -139,7 +139,7 @@ int main(int argc, char *argv[]) { ...@@ -139,7 +139,7 @@ int main(int argc, char *argv[]) {
if (myFaces.lower.containsVertex(i)) if (myFaces.lower.containsVertex(i))
dirichletNodes[i][1] = true; dirichletNodes[i][1] = true;
#if DIM == 3 #if MY_DIM == 3
if (myFaces.front.containsVertex(i) || myFaces.back.containsVertex(i)) if (myFaces.front.containsVertex(i) || myFaces.back.containsVertex(i))
dirichletNodes[i][2] = true; dirichletNodes[i][2] = true;
#endif #endif
......
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include "explicitgrid.hh" #include "explicitgrid.hh"
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
#include <dune/tectonic/myblockproblem.hh> #include <dune/tectonic/myblockproblem.hh>
template class SolverFactory< template class SolverFactory<
DIM, MY_DIM,
MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
Grid>; Grid>;
template class SolverFactory< template class SolverFactory<
DIM, BlockNonlinearTNNMGProblem< MY_DIM, BlockNonlinearTNNMGProblem<
ConvexProblem<ZeroNonlinearity<LocalVector, LocalMatrix>, Matrix>>, ConvexProblem<ZeroNonlinearity<LocalVector, LocalMatrix>, Matrix>>,
Grid>; Grid>;
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include <dune/common/function.hh> #include <dune/common/function.hh>
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
using Function = Dune::VirtualFunction<double, double>; using Function = Dune::VirtualFunction<double, double>;
template class Newmark<Vector, Matrix, Function, DIM>; template class Newmark<Vector, Matrix, Function, MY_DIM>;
template class BackwardEuler<Vector, Matrix, Function, DIM>; template class BackwardEuler<Vector, Matrix, Function, MY_DIM>;
#ifndef DIM #ifndef MY_DIM
#error DIM unset #error MY_DIM unset
#endif #endif
#include "explicitgrid.hh" #include "explicitgrid.hh"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment