00001
00010 #ifndef BS_BOS_CORE_DEFAULT_WELL_H_
00011 #define BS_BOS_CORE_DEFAULT_WELL_H_
00012
00013 #include "calc_well.h"
00014 #include "default_connection.h"
00015
00016 namespace blue_sky {
00017 namespace wells {
00018
00023 template <typename strategy_t>
00024 class BS_API_PLUGIN default_well : public well <strategy_t>
00025 {
00026 public:
00027 typedef well <strategy_t> base_t;
00028 typedef well <strategy_t> well_t;
00029 typedef typename base_t::item_array_t item_array_t;
00030 typedef typename base_t::rhs_item_array_t rhs_item_array_t;
00031 typedef typename base_t::index_array_t index_array_t;
00032 typedef typename base_t::index_t index_t;
00033 typedef typename base_t::item_t item_t;
00034 typedef typename base_t::rhs_item_t rhs_item_t;
00035
00036 typedef typename base_t::sp_calc_model_t sp_calc_model_t;
00037 typedef typename base_t::sp_mesh_iface_t sp_mesh_iface_t;
00038 typedef typename base_t::sp_jmatrix_t sp_jmatrix_t;
00039
00040 typedef typename base_t::connection_t connection_t;
00041 typedef default_connection <strategy_t> default_connection_t;
00042
00043 typedef typename base_t::sp_connection_t sp_connection_t;
00044 typedef smart_ptr <default_connection_t> sp_default_connection_t;
00045
00046 typedef seq_vector <sp_default_connection_t> connection_list_t;
00047 typedef index_t connection_block_t;
00048 typedef index_t connection_index_t;
00049
00050 typedef std::map <connection_block_t, connection_index_t> connection_map_t;
00051
00052 public:
00053
00059 default_well (const std::string &well_name);
00060
00062 BLUE_SKY_TYPE_DECL_T (default_well <strategy_t>);
00063
00071 void
00072 restore_solution (double dt, const item_array_t &p_sol, const item_array_t &s_sol, index_t block_size);
00073
00083 void
00084 process (bool is_start, double dt, const sp_calc_model_t &calc_model, const sp_mesh_iface_t &mesh, sp_jmatrix_t &jmatrix);
00085
00094 void
00095 eliminate (rhs_item_t *array, index_t rw_index, index_t wr_index, double dt, index_t block_size) const;
00096
00100 void
00101 clear_data ();
00102
00107 array_ext <item_t>
00108 get_ww_value ();
00109
00114 array_ext <item_t>
00115 get_bw_value ();
00116
00117 protected:
00127 void
00128 process_internal (bool is_start, const sp_calc_model_t &calc_model, const sp_mesh_iface_t &mesh, sp_jmatrix_t &jmatrix);
00129
00138 template <bool is_prod>
00139 void
00140 calc_rate_and_derivs (const sp_calc_model_t &calc_model, const sp_mesh_iface_t &mesh, sp_jmatrix_t &jmatrix);
00141
00151 template <bool is_w, bool is_g, bool is_o, bool is_prod>
00152 void
00153 calc_rate_and_derivs_concrete (const sp_calc_model_t &calc_model, const sp_mesh_iface_t &mesh, sp_jmatrix_t &jmatrix);
00154
00155 public:
00164 sp_connection_t
00165 add_connection (index_t i_coord, index_t j_coord, index_t k_coord, index_t n_block);
00166
00172 sp_connection_t
00173 get_connection (index_t idx) const;
00174
00180 sp_connection_t
00181 get_connection_map (index_t n_block) const;
00182
00187 virtual size_t
00188 get_connections_count () const;
00189
00190 public:
00191
00192 item_t ww_value;
00193 item_t bw_value;
00194
00195 connection_list_t connection_list_;
00196 connection_map_t connection_map_;
00197 };
00198
00205 bool
00206 default_well_register_types (const blue_sky::plugin_descriptor &pd);
00207
00208
00209 }
00210 }
00211
00212 #endif // #ifndef BS_BOS_CORE_DEFAULT_WELL_H_
00213