Go to the documentation of this file.00001 #ifndef VIENNAFEM_LINEAR_PDE_SYSTEM_HPP
00002 #define VIENNAFEM_LINEAR_PDE_SYSTEM_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <vector>
00018 #include <sstream>
00019
00020
00021 #include "viennafem/forwards.h"
00022 #include "viennafem/cell_quan.hpp"
00023 #include "viennafem/transform.hpp"
00024 #include "viennafem/bases/tetrahedron.hpp"
00025 #include "viennafem/bases/triangle.hpp"
00026 #include "viennafem/transform/dtdx_triangle.hpp"
00027 #include "viennafem/transform/dtdx_tetrahedron.hpp"
00028 #include "viennafem/weak_form.hpp"
00029 #include "viennafem/linear_pde_options.hpp"
00030 #include "viennafem/log/latex.hpp"
00031
00032
00033 #include "viennamath/manipulation/apply_coordinate_system.hpp"
00034
00035
00036 #include "viennadata/api.hpp"
00037
00038
00039 #include "viennagrid/domain.hpp"
00040
00041
00046 namespace viennafem
00047 {
00054 template <typename InterfaceType = viennamath::rt_expression_interface<viennamath::default_numeric_type>,
00055 typename MappingKeyType = viennafem::mapping_key,
00056 typename BoundaryKeyType = viennafem::boundary_key >
00057 class linear_pde_system
00058 {
00059 typedef linear_pde_system<InterfaceType,
00060 MappingKeyType,
00061 BoundaryKeyType> self_type;
00062
00063 public:
00064 typedef InterfaceType interface_type;
00065 typedef MappingKeyType mapping_key_type;
00066 typedef BoundaryKeyType boundary_key_type;
00067 typedef viennamath::rt_equation<InterfaceType> equation_type;
00068 typedef viennamath::rt_function_symbol<InterfaceType> unknown_type;
00069 typedef viennafem::linear_pde_options option_type;
00070 typedef viennafem::latex_logger<InterfaceType> logger_type;
00071
00072 linear_pde_system(std::string const & filename) : logger_(filename) {}
00073
00074 void add_pde(viennamath::rt_equation<InterfaceType> const & pde,
00075 std::vector< viennamath::rt_function_symbol<InterfaceType> > const & unknowns,
00076 viennafem::linear_pde_options const & option)
00077 {
00078 pdes_.push_back(pde);
00079 unknowns_.push_back(unknowns);
00080 options_.push_back(option);
00081 }
00082
00083 viennamath::rt_equation<InterfaceType> const & pde(std::size_t index) const { return pdes_[index]; }
00084 std::vector<viennamath::rt_equation<InterfaceType> > const & pdes() const { return pdes_; }
00085
00086 std::vector<viennamath::rt_function_symbol<InterfaceType> > const & unknown(std::size_t index) const { return unknowns_[index]; }
00087 viennafem::linear_pde_options option(std::size_t index) const { return options_[index]; }
00088
00089 std::size_t size() const { return pdes_.size(); }
00090
00091 logger_type & logger() const { return logger_; }
00092
00093 private:
00094 std::vector<viennamath::rt_equation<InterfaceType> > pdes_;
00095 std::vector<std::vector<viennamath::rt_function_symbol<InterfaceType> > > unknowns_;
00096 std::vector<viennafem::linear_pde_options> options_;
00097 mutable logger_type logger_;
00098 };
00099
00101 template <typename InterfaceType>
00102 linear_pde_system<InterfaceType> make_linear_pde_system(viennamath::rt_equation<InterfaceType> equ_1,
00103 viennamath::rt_function_symbol<InterfaceType> unknown_1,
00104 viennafem::linear_pde_options options_1)
00105 {
00106 std::stringstream ss;
00107 ss << "protocol_" << options_1.data_id() << ".tex";
00108 linear_pde_system<InterfaceType> ret(ss.str());
00109 std::vector<viennamath::rt_function_symbol<InterfaceType> > unknown_vec_1(1);
00110 unknown_vec_1[0] = unknown_1;
00111 ret.add_pde(equ_1, unknown_vec_1, options_1);
00112 return ret;
00113 }
00114
00116 template <typename InterfaceType>
00117 linear_pde_system<InterfaceType> make_linear_pde_system(viennamath::rt_equation<InterfaceType> equ_1,
00118 std::vector<viennamath::rt_function_symbol<InterfaceType> > unknowns_1,
00119 viennafem::linear_pde_options options_1)
00120 {
00121 std::stringstream ss;
00122 ss << "protocol_" << options_1.data_id() << ".tex";
00123 linear_pde_system<InterfaceType> ret(ss.str());
00124 ret.add_pde(equ_1, unknowns_1, options_1);
00125 return ret;
00126 }
00127
00128
00129
00131 template <typename InterfaceType>
00132 linear_pde_system<InterfaceType> make_linear_pde_system(viennamath::rt_equation<InterfaceType> equ_1,
00133 viennamath::rt_function_symbol<InterfaceType> unknown_1)
00134 {
00135 linear_pde_system<InterfaceType> ret("protocol_0.tex");
00136
00137 linear_pde_options options;
00138 options.data_id(0);
00139 options.trial_space_id(viennafem::space_to_id<lagrange_tag<1> >::value);
00140 options.test_space_id(viennafem::space_to_id<lagrange_tag<1> >::value);
00141
00142 std::vector<viennamath::rt_function_symbol<InterfaceType> > unknown_vec_1(1);
00143 unknown_vec_1[0] = unknown_1;
00144 ret.add_pde(equ_1, unknown_vec_1, options);
00145 return ret;
00146 }
00147
00149 template <typename InterfaceType>
00150 linear_pde_system<InterfaceType> make_linear_pde_system(viennamath::rt_equation<InterfaceType> equ_1,
00151 std::vector<viennamath::rt_function_symbol<InterfaceType> > unknowns_1)
00152 {
00153 linear_pde_system<InterfaceType> ret("protocol_0.tex");
00154
00155 linear_pde_options options;
00156 options.data_id(0);
00157 options.trial_space_id(viennafem::space_to_id<lagrange_tag<1> >::value);
00158 options.test_space_id(viennafem::space_to_id<lagrange_tag<1> >::value);
00159
00160 ret.add_pde(equ_1, unknowns_1, options);
00161 return ret;
00162 }
00163
00164
00165 }
00166 #endif