3 #include <vtestbed/config/real_type.hh>     4 #include <vtestbed/core/statistics.hh>     5 #include <vtestbed/geometry/linear_interpolation.hh>     9     constexpr 
const char* headers[vtb::core::Statistics_base::size()] = {
    12         "surge", 
"sway", 
"heave",
    13         "roll", 
"pitch", 
"yaw",
    14         "velocity_x", 
"velocity_y", 
"velocity_z",
    15         "angular_velocity_x", 
"angular_velocity_y", 
"angular_velocity_z",
    16         "acceleration_x", 
"acceleration_y", 
"acceleration_z",
    17         "angular_acceleration_x", 
"angular_acceleration_y", 
"angular_acceleration_z",
    19         "wave_length_t", 
"wave_length_x", 
"wave_length_y",
    20         "wave_number_t", 
"wave_number_x", 
"wave_number_y",
    21         "wave_height_t", 
"wave_height_x", 
"wave_height_y",
    23         "angular_momentum_x", 
"angular_momentum_y", 
"angular_momentum_z",
    26     static_assert(vtb::core::Statistics_base::size() > 0 &&
    27             headers[vtb::core::Statistics_base::size()-1] != 0,
    33 vtb::core::Statistics_base::write_header(
std::ostream& out) {
    34     static_assert(size() > 0, 
"bad no. of records");
    36     for (size_type i=1; i<size(); ++i){ out << 
',' << headers[i]; }
    43     static_assert(size() > 0, 
"bad no. of records");
    44     out << this->_series[0].back();
    45     for (
size_type i=1; i<size(); ++i){ out << 
',' << this->_series[i].back(); }
    52 -> std::pair<array1,grid1> {
    56     const auto& t = this->time_instant_series();
    57     const auto& wss = this->wavy_surface_series();
    58     array1 result; grid1 grid;
    59     const int nt = t.size();
    60     if (nt <= 3) { 
return std::make_pair(result,grid); }
    61     const T delta = T{1}/(nt-1);
    66     grid.lbound() = t.front();
    67     grid.ubound() = t.back();
    70     for (
auto first = t.cbegin(), last = t.cend(),
    71         first2 = wss.cbegin(); first != last; ++first, ++first2) {
    72         points.emplace_back(*first, *first2);
    75     for (
int k=0; k<nt; ++k) { result(k) = curve(k*delta)(1); }
    76     return std::make_pair(result,grid);
    81     for (
auto& s : this->_series) { s.clear(); }
    82     for (
auto& w : this->_waves) { w.clear(); }
    87     const auto& pair = this->uniform_wavy_surface();
    88     this->_waves(0) = temporal_wave_statistics(pair.first, pair.second);
    89     this->record(Record::Wave_length_t, this->_waves(0).
length.mean());
    90     this->record(Record::Wave_length_x, this->_waves(1).
length.mean());
    91     this->record(Record::Wave_length_y, this->_waves(2).
length.mean());
    92     this->record(Record::Wave_number_t, this->_waves(0).number.mean());
    93     this->record(Record::Wave_number_x, this->_waves(1).number.mean());
    94     this->record(Record::Wave_number_y, this->_waves(2).number.mean());
    95     this->record(Record::Wave_height_t, this->_waves(0).height.mean());
    96     this->record(Record::Wave_height_x, this->_waves(1).height.mean());
    97     this->record(Record::Wave_height_y, this->_waves(2).height.mean());
 
T length(const blitz::TinyVector< T, N > &x)
Computes vector length without overflow.
 
void write_back(std::ostream &out) const
Write the last sample.