[de061d] | 1 | /*
|
---|
| 2 | * vmg - a versatile multigrid solver
|
---|
| 3 | * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn
|
---|
| 4 | *
|
---|
| 5 | * vmg is free software: you can redistribute it and/or modify
|
---|
| 6 | * it under the terms of the GNU General Public License as published by
|
---|
| 7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 8 | * (at your option) any later version.
|
---|
| 9 | *
|
---|
| 10 | * vmg is distributed in the hope that it will be useful,
|
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | * GNU General Public License for more details.
|
---|
| 14 | *
|
---|
| 15 | * You should have received a copy of the GNU General Public License
|
---|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * @file mg.hpp
|
---|
| 21 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
---|
| 22 | * @date Mon Apr 18 13:01:13 2011
|
---|
| 23 | *
|
---|
| 24 | * @brief Header file for the VMG main class.
|
---|
| 25 | *
|
---|
| 26 | */
|
---|
| 27 |
|
---|
| 28 | #ifndef MG_HPP_
|
---|
| 29 | #define MG_HPP_
|
---|
| 30 |
|
---|
| 31 | #include <map>
|
---|
| 32 |
|
---|
| 33 | #include "base/command_factory.hpp"
|
---|
| 34 | #include "base/factory.hpp"
|
---|
| 35 |
|
---|
| 36 | namespace VMG
|
---|
| 37 | {
|
---|
| 38 |
|
---|
| 39 | class BoundaryValueSetter;
|
---|
| 40 | class Comm;
|
---|
| 41 | class Cycle;
|
---|
| 42 | class Discretization;
|
---|
| 43 | class Grid;
|
---|
| 44 | class Interface;
|
---|
| 45 | class LevelOperator;
|
---|
| 46 | class Multigrid;
|
---|
| 47 | class Smoother;
|
---|
| 48 | class Solver;
|
---|
| 49 | class Stencil;
|
---|
| 50 | class TempGrid;
|
---|
| 51 |
|
---|
| 52 | class MG
|
---|
| 53 | {
|
---|
| 54 | public:
|
---|
| 55 | static MG* Instance()
|
---|
| 56 | {
|
---|
| 57 | static MG mgs;
|
---|
| 58 | return &mgs;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | static VMG::Comm* GetComm();
|
---|
| 62 | static VMG::Cycle* GetCycle();
|
---|
| 63 | static VMG::Discretization* GetDiscretization();
|
---|
| 64 | static VMG::Interface* GetInterface();
|
---|
| 65 | static VMG::LevelOperator* GetLevelOperator();
|
---|
| 66 | static VMG::Multigrid* GetRhs();
|
---|
| 67 | static VMG::Multigrid* GetSol();
|
---|
| 68 | static VMG::Grid& GetRhsMaxLevel();
|
---|
| 69 | static VMG::Grid& GetSolMaxLevel();
|
---|
| 70 | static VMG::Smoother* GetSmoother();
|
---|
| 71 | static VMG::Solver* GetSolver();
|
---|
| 72 | static VMG::TempGrid* GetTempGrid();
|
---|
| 73 | static VMG::BoundaryValueSetter* GetBoundaryValueSetter();
|
---|
| 74 |
|
---|
| 75 | static VMG::Factory& GetFactory();
|
---|
| 76 | static VMG::CommandFactory& GetCommands();
|
---|
| 77 |
|
---|
| 78 | static void PostInit();
|
---|
| 79 | static void Solve();
|
---|
| 80 | static void Destroy();
|
---|
| 81 | static bool IsInitialized();
|
---|
| 82 |
|
---|
| 83 | static void SetState(const int& key);
|
---|
| 84 |
|
---|
| 85 | private:
|
---|
| 86 | MG();
|
---|
| 87 | virtual ~MG();
|
---|
| 88 |
|
---|
| 89 | void RegisterLibraryCommands();
|
---|
| 90 |
|
---|
| 91 | vmg_float ComputeVectorNorm(const Multigrid& vec);
|
---|
| 92 |
|
---|
| 93 | static VMG::CommandFactory command_factory;
|
---|
| 94 | std::map<int, VMG::Factory> factories;
|
---|
| 95 | int state;
|
---|
| 96 | };
|
---|
| 97 |
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | #endif
|
---|