Update from Andrew: tweaks for cross-staff chords snippet.
[lilypond.git] / lily / page-spacing-result.cc
blob72164cc2bd7758c405d89a91dbba03cd83e6b497
1 /*
2 page-spacing-result.cc -- implement Page_spacing_result
4 source file of the GNU LilyPond music typesetter
6 (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
8 */
10 #include "page-spacing-result.hh"
12 Page_spacing_result::Page_spacing_result ()
14 penalty_ = 0;
15 demerits_ = infinity_f;
18 vsize
19 Page_spacing_result::system_count () const
21 vsize total = 0;
22 for (vsize i = 0; i < systems_per_page_.size(); i++)
23 total += systems_per_page_[i];
25 return total;
28 vsize
29 Page_spacing_result::page_count () const
31 return systems_per_page_.size();
34 Real
35 Page_spacing_result::average_force () const
37 Real average_force = 0;
38 for (vsize i = 0; i < page_count (); i++)
39 average_force += force_[i];
41 average_force /= page_count ();
42 return average_force;
45 void
46 Page_spacing_result::print () const
48 printf ("penalty %lf, demerits %lf\n" , penalty_, demerits_);
49 for (vsize i = 0; i < page_count (); i++)
50 printf (" %d: #sys=%d, force=%lf\n", int (i), int (systems_per_page_[i]),
51 force_[i]);