00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <SolverDriver.hpp>
00022
00023 #include <FiniteElementMethod.hpp>
00024 #include <PenalizedFictitousDomain.hpp>
00025 #include <EliminatedFictitiousDomain.hpp>
00026
00027 #include <FatBoundary.hpp>
00028
00029 #include <SpectralMethod.hpp>
00030
00031 #include <PDESolution.hpp>
00032 #include <PDESolver.hpp>
00033
00034 void SolverDriver::run()
00035 {
00036 PDESolution& u = static_cast<PDESolution&>(__u);
00037 ReferenceCounting<Method> M = NULL;
00038
00039 switch (__methodClass) {
00040 case SolverDriver::fictitiousFEM: {
00041 ffout(2) << "Using FEM fictitious domain discretization:\n";
00042 ffout(2) << "Method: ";
00043 switch (__methodType) {
00044 case (SolverDriverOptions::penalty): {
00045 M = new PenalizedFictitousDomain(__discretizationType,
00046 __mesh,
00047 __degreeOfFreedomSet);
00048 ffout(2) << "Penalty\n";
00049 break;
00050 }
00051 case (SolverDriverOptions::eliminate): {
00052 M = new EliminatedFictitiousDomain(__discretizationType,
00053 __mesh,
00054 __degreeOfFreedomSet);
00055 ffout(2) << "Elimination\n";
00056 break;
00057 }
00058 case (SolverDriverOptions::fatBoundary): {
00059 M = new FatBoundary(__discretizationType,
00060 __mesh);
00061 break;
00062 }
00063 default: {
00064 throw ErrorHandler(__FILE__,__LINE__,
00065 "not defined method",
00066 ErrorHandler::unexpected);
00067 break;
00068 }
00069 }
00070 break;
00071 }
00072 case SolverDriver::fem: {
00073 ffout(2) << "Using FEM discretization:\n";
00074 switch(__methodType) {
00075 case SolverDriverOptions::penalty: {
00076 fferr(2) <<
00077 "WARNING: penalty method is not an option for standard FEM\n"
00078 "WARNING: using elimination for Dirichlet conditions\n";
00079 }
00080 default: {
00081 }
00082 }
00083 M = new FiniteElementMethod(__discretizationType,
00084 __mesh,
00085 __degreeOfFreedomSet);
00086 break;
00087 }
00088 case SolverDriver::spectral: {
00089 ffout(2) << "Using spectral discretization:\n";
00090 M = new SpectralMethod(__discretizationType,
00091 __mesh,
00092 __degreeOfFreedomSet);
00093 break;
00094 }
00095 default: {
00096 throw ErrorHandler(__FILE__,__LINE__,
00097 "method type is not implemented",
00098 ErrorHandler::unexpected);
00099 }
00100 }
00101
00102 PDESolver solver(__p, M, u);
00103
00104 solver.Solve();
00105 }
00106