Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / page-spacing-result.cc
blob19ae1d9b76085bf517606845f805daf90e80a938
1 /*
2 page-spacing-result.cc -- implement Page_spacing_result
4 source file of the GNU LilyPond music typesetter
6 (c) 2007--2009 Han-Wen Nienhuys <hanwen@lilypond.org>
8 */
10 #include "page-spacing-result.hh"
11 #include <cstdio>
13 Page_spacing_result::Page_spacing_result ()
15 penalty_ = 0;
16 demerits_ = infinity_f;
17 system_count_status_ = SYSTEM_COUNT_OK;
20 vsize
21 Page_spacing_result::system_count () const
23 vsize total = 0;
24 for (vsize i = 0; i < systems_per_page_.size(); i++)
25 total += systems_per_page_[i];
27 return total;
30 vsize
31 Page_spacing_result::page_count () const
33 return systems_per_page_.size();
36 Real
37 Page_spacing_result::average_force () const
39 Real average_force = 0;
40 for (vsize i = 0; i < page_count (); i++)
41 average_force += force_[i];
43 average_force /= page_count ();
44 return average_force;
47 void
48 Page_spacing_result::print () const
50 printf ("penalty %lf, demerits %lf\n" , penalty_, demerits_);
51 for (vsize i = 0; i < page_count (); i++)
52 printf (" %d: #sys=%d, force=%lf\n", int (i), int (systems_per_page_[i]),
53 force_[i]);