3 #ifndef __sim_vel_model_impl_hpp
4 #define __sim_vel_model_impl_hpp
11 template <
typename ParamsT>
14 template <
typename ParamsT>
17 template <
typename ParamsT>
23 fprintf(stderr,
"sim::VelModel1D2D<>::(): error, no layers present.\n");
24 return m_dummy_params;
28 typename std::list<std::pair<VmLayer1D2D, ParamsT> >::const_reverse_iterator rit =
30 for (;rit != m_lays.rend(); ++rit)
32 if (coords.z >= rit->first.zCoord(coords.x))
37 if (rit == m_lays.rend())
43 template <
typename ParamsT>
45 const ParamsT ¶ms)
48 typename std::list<std::pair<VmLayer1D2D, ParamsT> >::iterator it = m_lays.begin();
49 bool replaced =
false;
50 for (;it != m_lays.end(); ++it)
52 if (layer.
coords().z == it->first.coords().z)
60 if (layer.
coords().z < it->first.coords().z)
66 m_lays.insert(it, std::pair<VmLayer1D2D, ParamsT>(layer, params));
69 template <
typename ParamsT>
75 template <
typename ParamsT>
78 if (
id >= m_lays.size())
81 "sim::VelModel1D2D<>::layer: error, id=%zu out of range (%zu layers presents).\n",
86 typename std::list<std::pair<VmLayer1D2D, ParamsT> >::const_iterator it = m_lays.begin();
91 template <
typename ParamsT>
94 if (
id >= m_lays.size())
97 "sim::VelModel1D2D<>::params: error, id=%zu out of range (%zu layers presents).\n",
99 return m_dummy_params;
102 typename std::list<std::pair<VmLayer1D2D, ParamsT> >::const_iterator it = m_lays.begin();
103 std::advance(it,
id);
107 template <
typename ParamsT>
110 size_t size = m_lays.size();
115 "sim::VelModel1D2D<>::removeLayer: warning, id=%zu out of range (%zu layers presents).",
122 "sim::VelModel1D2D<>::removeLayer: warning, the last layer is deleted.\n");
127 typename std::list<std::pair<VmLayer1D2D, ParamsT> >::iterator it = m_lays.begin();
128 std::advance(it,
id);
132 template <
typename ParamsT>
virtual size_t layersNum() const
Definition: sim_vel_model_impl.hpp:70
Definition: sim_vm_layers.hpp:16
virtual const ParamsT & operator()(const Point2D &coords) const
Definition: sim_vel_model_impl.hpp:18
virtual const ParamsT & params(const size_t id) const
Definition: sim_vel_model_impl.hpp:92
Definition: sim_vel_model.hpp:89
virtual void clear()
Definition: sim_vel_model_impl.hpp:133
Definition: sim_point_2d.hpp:16
virtual void removeLayer(const size_t id)
Definition: sim_vel_model_impl.hpp:108
const Point2D & coords() const
Definition: sim_vm_layers.hpp:31
virtual void appendLayer(const VmLayer1D2D &layer, const ParamsT ¶ms)
Definition: sim_vel_model_impl.hpp:44
virtual const VmLayer1D2D & layer(const size_t id) const
Definition: sim_vel_model_impl.hpp:76