00001 #ifndef PC_UC_Solver_hh 00002 #define PC_UC_Solver_hh 00003 00004 #pragma once 00005 00006 #include <iostream> 00007 #include <memory> 00008 #include <algorithm> 00009 #include <sstream> 00010 #include <unistd.h> // for command line parsing 00011 #include <fstream> 00012 #include <memory> 00013 #include <vector> 00014 #include <fstream> 00015 #include <sstream> 00016 #include <string> 00017 #include <map> 00018 00019 #include "basics.hh" 00020 #include "basics/outputMatlab.hh" 00021 #include "geometry.hh" 00022 #include "space.hh" 00023 #include "operator.hh" 00024 #include "hp2D.hh" 00025 00026 typedef std::map<int, double> MID; 00027 00031 class PC_UC_Solver { 00032 public: 00033 enum EquationType {TRANSVERSAL_ELECTRIC, TRANSVERSAL_MAGNETIC}; 00034 00035 PC_UC_Solver(const concepts::Space<concepts::Real>& space, 00036 EquationType type, 00037 const MID& attrToEpsilon, 00038 double omega, 00039 const concepts::BoundaryConditions& bc); 00040 00041 static concepts::PiecewiseConstFormula<concepts::Real> genTMCoeff( 00042 const MID& attToEps); 00043 00044 static concepts::PiecewiseConstFormula<concepts::Real> genTECoeff( 00045 const MID& attToEps); 00046 00047 void setRhs(const std::string& rhs_r, const std::string& rhs_i); 00048 //TODO: implement methods taking Formula or ElementFormula instances 00049 00050 void solve(concepts::Cmplx k1, concepts::Cmplx k2, 00051 concepts::Vector<concepts::Cmplx>& sol ); 00052 00053 void setOmega(double omega); 00054 00055 private: 00056 const concepts::Space<concepts::Real>& space; 00057 concepts::BoundaryConditions bc; 00058 00059 double omega; 00060 00061 static concepts::PiecewiseConstFormula<concepts::Real> zero_F; 00062 static concepts::PiecewiseConstFormula<concepts::Real> one_F; 00063 concepts::PiecewiseConstFormula<concepts::Real> coeff_TM_F; 00064 concepts::PiecewiseConstFormula<concepts::Real> coeff_TE_F; 00065 hp2D::Laplace<concepts::Real> lap_BF; 00066 hp2D::Advection<concepts::Real> adv_BF_1; 00067 hp2D::Advection<concepts::Real> adv_BF_2; 00068 hp2D::Identity<Real> id_heat_BF; 00069 hp2D::Identity<Real> id_mass_BF; 00070 00071 concepts::Vector<concepts::Cmplx> rhs; 00072 concepts::SparseMatrix<concepts::Real> lap_M; 00073 concepts::SparseMatrix<concepts::Real> id_mass_M; 00074 concepts::SparseMatrix<concepts::Real> id_heat_M; 00075 concepts::SparseMatrix<concepts::Real> adv_M_1; 00076 concepts::SparseMatrix<concepts::Real> adv_M_2; 00077 00078 }; 00079 00080 #endif // PC_UC_Solver_hh