diff --git a/AMDiS/src/Parametric.cc b/AMDiS/src/Parametric.cc index b0a4b1b8d74278fc1b9ccca5296a746073d35085..a269ca5406f61231b581661e0cba6bae7ab746cd 100644 --- a/AMDiS/src/Parametric.cc +++ b/AMDiS/src/Parametric.cc @@ -60,4 +60,36 @@ namespace AMDiS { return elInfo; } + + ElInfo *ParametricSimple::addParametricInfo(ElInfo *elInfo) + { + elInfo->setParametric(true); + int dow = Global::getGeo(WORLD); + Element *element = elInfo->getElement(); + const DegreeOfFreedom **dof = element->getDof(); + + for (int i = 0; i < elInfo->getElement()->getGeo(VERTEX); i++) { + if (elInfo->getFillFlag().isSet(Mesh::FILL_COORDS)) + elInfo->getCoord(i) = dofCoords[dof[i][0]]; + + if (elInfo->getFillFlag().isSet(Mesh::FILL_OPP_COORDS)) { + TEST_EXIT(elInfo->getFillFlag().isSet(Mesh::FILL_NEIGH)) + ("FILL_NEIGH not set\n"); + + if (elInfo->getNeighbour(i)) { + const DegreeOfFreedom **neighDof = elInfo->getNeighbour(i)->getDof(); + elInfo->getOppCoord(i) = dofCoords[neighDof[elInfo->getOppVertex(i)][0]]; + } + } + } + + return elInfo; + } + + ElInfo *ParametricSimple::removeParametricInfo(ElInfo *elInfo) + { + elInfo->setParametric(false); + return elInfo; + } + } diff --git a/AMDiS/src/Parametric.h b/AMDiS/src/Parametric.h index c4fb68306e118578866e1d8d397a1e9e9dacece8..409899e6af5eb2d2f61e785891cba4b67c4a19bf 100644 --- a/AMDiS/src/Parametric.h +++ b/AMDiS/src/Parametric.h @@ -85,6 +85,26 @@ namespace AMDiS { WorldVector<DOFVector<double>*> *dofCoords_; }; + /// Implementation of linear parametric elements. + class ParametricSimple : public Parametric + { + public: + /// Constructor. \ref dofCoords are set to coords. + ParametricSimple(DOFVector<WorldVector<double> > const& coords) + : dofCoords(coords) + {} + + /// Implementation of \ref Parametric::addParametricInfo(). + ElInfo *addParametricInfo(ElInfo *elInfo); + + /// Implementation of \ref Parametric::removeParametricInfo(). + ElInfo *removeParametricInfo(ElInfo *elInfo); + + protected: + /// Pointer to a DOFVector of world coordinates. + DOFVector<WorldVector<double> > const& dofCoords; + }; + } #endif diff --git a/AMDiS/src/expressions/coords_expr.hpp b/AMDiS/src/expressions/coords_expr.hpp index c4167969025caf76568895525964f344816a83e5..49d217d90e6a093ca4f4a397c33cfcd3e74a96e2 100644 --- a/AMDiS/src/expressions/coords_expr.hpp +++ b/AMDiS/src/expressions/coords_expr.hpp @@ -96,7 +96,7 @@ namespace AMDiS inline value_type operator()(const int& iq) const { return x[iq]; } - std::string str() { return "X"; } + std::string str() const { return "X"; } }; @@ -165,7 +165,7 @@ namespace AMDiS inline double operator()(const int& iq) const { return x[iq][I]; } - std::string str() { return std::string("X<") + boost::lexical_cast<std::string>(I) + ">"; } + std::string str() const { return std::string("X<") + boost::lexical_cast<std::string>(I) + ">"; } }; @@ -211,7 +211,7 @@ namespace AMDiS inline value_type operator()(const int& iq) const { return normal; } - std::string str() { return "N"; } + std::string str() const { return "N"; } }; @@ -257,7 +257,7 @@ namespace AMDiS inline value_type operator()(const int& iq) const { return normal[I]; } - std::string str() { return std::string("N<") + boost::lexical_cast<std::string>(I) + ">"; } + std::string str() const { return std::string("N<") + boost::lexical_cast<std::string>(I) + ">"; } }; @@ -293,7 +293,7 @@ namespace AMDiS inline value_type operator()(const int& iq) const { return elementNormal; } - std::string str() { return "M"; } + std::string str() const { return "M"; } }; @@ -330,7 +330,7 @@ namespace AMDiS inline value_type operator()(const int& iq) const { return elementNormal[I]; } - std::string str() { return std::string("M<") + boost::lexical_cast<std::string>(I) + ">"; } + std::string str() const { return std::string("M<") + boost::lexical_cast<std::string>(I) + ">"; } }; } // end namespace expressions diff --git a/AMDiS/src/expressions/diff_expr.hpp b/AMDiS/src/expressions/diff_expr.hpp index 5eb8a48a464925a51f0b16127086d7d1a0ecb629..37e2f2dd7a83ee139923e95c86f069cbd8bcc7e4 100644 --- a/AMDiS/src/expressions/diff_expr.hpp +++ b/AMDiS/src/expressions/diff_expr.hpp @@ -223,6 +223,30 @@ namespace AMDiS return simplify(simplify(diff<Id>(t.term1,d)) + simplify(diff<Id>(t.term2,d))); } }; + + template<typename Id, typename Term1, typename Term2, typename Direction> + class Diff< Id, Subtract<Term1, Term2>, Direction > + { + typedef typename Simplify< typename Diff<Id, Term1>::type >::type D1; + typedef typename Simplify< typename Diff<Id, Term2>::type >::type D2; + typedef typename Simplify< typename Diff<Id, Term1, Direction>::dir_type >::type D1_; + typedef typename Simplify< typename Diff<Id, Term2, Direction>::dir_type >::type D2_; + + public: + typedef Subtract<Term1, Term2> original_type; + typedef typename Simplify< Subtract< D1, D2 > >::type type; + typedef typename Simplify< Subtract< D1_, D2_ > >::type dir_type; + + static type eval(original_type const& t) + { + return simplify(simplify(diff<Id>(t.term1)) - simplify(diff<Id>(t.term2))); + } + + static dir_type eval(original_type const& t, Direction const& d) + { + return simplify(simplify(diff<Id>(t.term1,d)) - simplify(diff<Id>(t.term2,d))); + } + }; template<typename Id, typename Term, typename Direction> struct Diff< Id, Negative<Term>, Direction > diff --git a/AMDiS/src/expressions/functorN_expr.hpp b/AMDiS/src/expressions/functorN_expr.hpp index dc5cd02eb4e95ba82b3998fccba81d18ec5b3a6e..0a1b387028cc40c736df160d7000056340a86b7e 100644 --- a/AMDiS/src/expressions/functorN_expr.hpp +++ b/AMDiS/src/expressions/functorN_expr.hpp @@ -285,6 +285,19 @@ namespace AMDiS } inline value_type operator()(const int& iq) const { return eval(iq, int_<N>()); } + + template <int I> + std::string str(int_<I>) const + { + return str(int_<I-1>()) + ", " + std::get<I>(super::term_tuple).str(); + } + + std::string str(int_<0>) const + { + return std::get<0>(super::term_tuple).str(); + } + + std::string str() const { return std::string("F(") + str(int_<N-1>()) + ")"; } }; template<typename F, typename Term> diff --git a/AMDiS/src/expressions/simplify_expr.hpp b/AMDiS/src/expressions/simplify_expr.hpp index d69487ea4049e950632b11d148fb1a90a293be52..7245ff0d7b271c78bcfbfe6698f629d3e14a6e24 100644 --- a/AMDiS/src/expressions/simplify_expr.hpp +++ b/AMDiS/src/expressions/simplify_expr.hpp @@ -139,6 +139,25 @@ namespace AMDiS static type eval(Add<CValue<0>, Term> const& t) { return simplify(t.term2); } }; + /// X - 0 -> X + template<typename Term> + struct Simplify< Subtract<Term, CValue<0> >, typename boost::enable_if_c<!traits::is_ct_value<Term>::value>::type > + { + typedef typename Simplify<Term>::type type; + + static type eval(Subtract<Term, CValue<0> > const& t) + { return simplify(t.term1); } + }; + + /// 0 - X -> -X + template<typename Term> + struct Simplify< Subtract<CValue<0>, Term>, typename boost::enable_if_c<!traits::is_ct_value<Term>::value>::type > + { + typedef Negative<typename Simplify<Term>::type> type; + + static type eval(Subtract<CValue<0>, Term> const& t) + { return -simplify(t.term2); } + }; /// X * 0 -> 0 template<typename Term> diff --git a/AMDiS/src/nonlin/ProblemNonLin.cc b/AMDiS/src/nonlin/ProblemNonLin.cc index 2ee50160d66dae840696f33ac1090dd2c38bf531..46f0763c0668f7cb041f05fd7476d16fa82ff360 100644 --- a/AMDiS/src/nonlin/ProblemNonLin.cc +++ b/AMDiS/src/nonlin/ProblemNonLin.cc @@ -72,9 +72,6 @@ namespace AMDiS { void ProblemNonLin::solve(AdaptInfo *adaptInfo, bool b0, bool b1) { TEST_EXIT(nonLinSolver)("no non-linear solver!\n"); - - MSG("HERE A\n"); - nonLinSolver->solve(solverMatrix, *solution, *rhs, adaptInfo, this); } diff --git a/AMDiS/src/parallel/MeshPartitioner.cc b/AMDiS/src/parallel/MeshPartitioner.cc index e9250d63935bd8f31ccd40f804d6b453b7044806..02380b4f1eb5d78c58078756b28be508aca9a6e1 100644 --- a/AMDiS/src/parallel/MeshPartitioner.cc +++ b/AMDiS/src/parallel/MeshPartitioner.cc @@ -55,7 +55,7 @@ namespace AMDiS { namespace Parallel { ifstream file; file.open(partitioningFile.c_str()); - TEST_EXIT(file.is_open())("Should not happen!\n"); + TEST_EXIT(file.is_open())("Could not open initial partitioning file '%s'\n", partitioningFile.c_str()); int nElements = 0; file >> nElements;