00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SCALAR_DISCRETIZATION_TYPE_BASE_HPP
00021 #define SCALAR_DISCRETIZATION_TYPE_BASE_HPP
00022
00023 #include <ErrorHandler.hpp>
00024 #include <string>
00025
00035 class ScalarDiscretizationTypeBase
00036 {
00037 public:
00038 enum Type {
00039 undefined =-1,
00040 functionLike = 0,
00042
00043 lagrangianFEM0 =10,
00044 lagrangianFEM1 =11,
00045 lagrangianFEM2 =12,
00047
00048 DGFEM0 =20,
00049 DGFEM1 =21,
00050 DGFEM2 =22,
00052
00053 spectralLegendre=50
00054 };
00055
00056 private:
00057 Type __type;
00063 virtual void __instanciable() const = 0;
00064 public:
00065 static Type getDefault(const Type& type)
00066 {
00067 return (type==undefined)?lagrangianFEM1:type;
00068 }
00069
00070 const ScalarDiscretizationTypeBase&
00071 operator=(const ScalarDiscretizationTypeBase::Type& type)
00072 {
00073 __type=type;
00074 return *this;
00075 }
00076
00084 static std::string name(const ScalarDiscretizationTypeBase::Type& type)
00085 {
00086 switch (type) {
00087 case lagrangianFEM0: return "FEM-P0";
00088 case lagrangianFEM1: return "FEM-P1";
00089 case lagrangianFEM2: return "FEM-P2";
00090 case DGFEM0: return "DG-P0";
00091 case DGFEM1: return "DG-P1";
00092 case DGFEM2: return "DG-P2";
00093 case spectralLegendre:return "Legendre";
00094 case undefined: return "undefined";
00095 case functionLike: return "function-like";
00096 }
00097 throw ErrorHandler(__FILE__,__LINE__,
00098 "unknown Discretization type",
00099 ErrorHandler::unexpected);
00100 }
00101
00109 static std::string name(const ScalarDiscretizationTypeBase& discretization)
00110 {
00111 return ScalarDiscretizationTypeBase::name(discretization.type());
00112 }
00113
00119 const Type& type() const
00120 {
00121 return __type;
00122 }
00123
00129 explicit ScalarDiscretizationTypeBase(const ScalarDiscretizationTypeBase::Type& type)
00130 : __type(type)
00131 {
00132 ;
00133 }
00134
00140 explicit ScalarDiscretizationTypeBase(const ScalarDiscretizationTypeBase& d)
00141 : __type(d.__type)
00142 {
00143 ;
00144 }
00145
00150 virtual ~ScalarDiscretizationTypeBase()
00151 {
00152 ;
00153 }
00154 };
00155
00156 #endif // SCALAR_DISCRETIZATION_TYPE_BASE_HPP