1 #include <vtestbed/config/real_type.hh>     2 #include <vtestbed/core/cosine_wave.hh>     3 #include <vtestbed/core/linear_wave.hh>     4 #include <vtestbed/core/stokes_wave.hh>     5 #include <vtestbed/guile/macros.hh>     6 #include <vtestbed/guile/traits.hh>    18     SCM propagating_cosine_type;
    19     SCM standing_cosine_type;
    22     SCM kw_amplitude, kw_length, kw_direction;
    29         template <> SCM propagating_cosine_traits::type() { return ::propagating_cosine_type; }
    30         template <> SCM standing_cosine_traits::type() { return ::standing_cosine_type; }
    31         template <> SCM stokes_traits::type() { return ::stokes_type; }
    32         template <> SCM linear_wave_traits::type() { return ::linear_wave_type; }
    35         propagating_cosine_traits::define() {
    36             ::propagating_cosine_type =
    37                 define_type<propagating_cosine>(
"<propagating-cosine-wave>");
    41         standing_cosine_traits::define() {
    42             ::standing_cosine_type = define_type<standing_cosine>(
"<standing-cosine-wave>");
    46         stokes_traits::define() {
    47             ::stokes_type = define_type<stokes>(
"<propagating-stokes-wave>");
    51         linear_wave_traits::define() {
    52             ::linear_wave_type = define_type<stokes>(
"<linear-wave>");
    63             using T = VTB_REAL_TYPE;
    64             SCM amplitude = to_scm(T(1)), length = to_scm(T(40)), direction = to_scm(T(0));
    65             scm_c_bind_keyword_arguments(
"make-wave", rest,
    66                                          scm_t_keyword_arguments_flags{},
    67                                          kw_amplitude, &litude,
    69                                          kw_direction, &direction,
    71             if (type == propagating_cosine_type) {
    75                 return propagating_cosine_traits::make(wave);
    77             if (type == propagating_cosine_type) {
    81                 return standing_cosine_traits::make(wave);
    83             if (type == stokes_type) {
    87                 return stokes_traits::make(wave);
    89             if (type == linear_wave_type) {
    93                 return linear_wave_traits::make(wave);
    95             return SCM_UNSPECIFIED;
    99             kw_amplitude = scm_from_utf8_keyword(
"amplitude");
   100             kw_length = scm_from_utf8_keyword(
"length");
   101             kw_direction = scm_from_utf8_keyword(
"direction");
   102             define_procedure(
"make-wave", 1, 0, 1, VTB_GUILE_2(
make_wave));
 Propagating plain wave which has cosine shape.
 
Propagating third-order Stokes wave.
 
SCM make_wave(SCM type, SCM rest)
Construct wave from amplitude, length and direction using dispersion relation.
 
Standing plain wave which has cosine shape.