// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // == http://www.amdis-fem.org == // == == // ============================================================================ // // Software License for AMDiS // // Copyright (c) 2010 Dresden University of Technology // All rights reserved. // Authors: Simon Vey, Thomas Witkowski et al. // // This file is part of AMDiS // // See also license.opensource.txt in the distribution. /** \file ProblemNonLin.h */ #ifndef AMDIS_PROBLEMNONLIN_H_ #define AMDIS_PROBLEMNONLIN_H_ #include "ProblemStat.h" #include "NonLinSolver.h" #include "DOFVector.h" #include "SystemVector.h" #include "MatrixVector.h" #ifdef HAVE_PARALLEL_DOMAIN_AMDIS #include "parallel/PetscProblemStat.h" #endif namespace AMDiS { /** * \ingroup Problem * * \brief * Standard implementation for a vector valued non linear problem. */ class ProblemNonLin : public ProblemStat { public: /// Constructs a ProblemNonLin with given name. ProblemNonLin(const std::string& name_) : ProblemStat(name_.c_str()), nonLinSolver(NULL) { u0.resize(nComponents); u0.set(NULL); } /// Sets \ref u0 and interpolates it to \ref solution. inline void setU0(AbstractFunction > *u0Fct, int index) { FUNCNAME("ProblemNonLinVec::setU0()"); TEST_EXIT(index < nComponents)("Invalid index!\n"); u0[index] = u0Fct; solution->getDOFVector(index)->interpol(u0Fct); } /// Destructor virtual ~ProblemNonLin() {} /// Initialization of the problem. virtual void initialize(Flag initFlag, ProblemStat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). virtual void createNonLinSolver(); /** \brief * Overrides ProblemStat::solve(). Uses the non linear solver * \ref nonLinSolver. */ virtual void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false); /// Overrides ProblemStat::buildAfterCoarsen(). virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag, bool assembleMatrix = true, bool assembleVector = true); /// Returns \ref nonLinSolver. inline NonLinSolver *getNonLinSolver() { return nonLinSolver; } /// Sets \ref nonLinSolver. inline void setNonLinSolver(NonLinSolver *s) { nonLinSolver = s; } protected: /// Initial guess for the solution. Vector >*> u0; /// Non linear solver object. Used in \ref solve(). NonLinSolver *nonLinSolver; }; } #endif