From: fred Date: Sun, 24 Mar 2002 19:52:54 +0000 (+0000) Subject: lilypond-0.1.1 X-Git-Tag: release/1.5.59~4170 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f674f7223941105abc04f3cff5044d22e94bb62f;p=lilypond.git lilypond-0.1.1 --- diff --git a/flower/include/diagonal-storage.hh b/flower/include/diagonal-storage.hh index 517c5cd814..f4515edfb1 100644 --- a/flower/include/diagonal-storage.hh +++ b/flower/include/diagonal-storage.hh @@ -12,9 +12,9 @@ #include "full-storage.hh" /** - Store a single-band matrix; + Store a matrix with a single-band. - INVARIANT + @invariant Diagonal_storage(i,j) == band_(i, j-i + band_size_i()) @@ -58,7 +58,7 @@ public: virtual void mult_next(int &i, int &j) const ; virtual bool trans_ok(int i, int j) const; virtual void trans_next(int &i, int &j) const; - VIRTUAL_COPY_CONS(Diagonal_storage, Matrix_storage); + DECLARE_VIRTUAL_COPY_CONS(Diagonal_storage, Matrix_storage); DECLARE_MY_RUNTIME_TYPEINFO; virtual bool try_right_multiply(Matrix_storage * dest, Matrix_storage const *)const; }; diff --git a/lib/include/moment.hh b/lib/include/moment.hh index 4f44c07fd9..bbd3388e74 100644 --- a/lib/include/moment.hh +++ b/lib/include/moment.hh @@ -5,10 +5,24 @@ #ifndef MOMENT_HH #define MOMENT_HH +#include #include "rational.hh" + +/** + A really big time-moment. + + Windhoze-suck-suck-suck-suck-suck-thank-you-cygnus + + I get tired of all these incompatibilities. Let's just assume that + INT_MAX is really, really, really big. + + Can't we name this Saint_jut_mom (Sintjuttemis ?) */ + +const infinity_mom = Rational(INT_MAX); + class String; typedef Rational Moment; -void printm(Moment const&); + #endif // diff --git a/lily/include/break.hh b/lily/include/break.hh index bb37f4aeab..e016a8806a 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -13,37 +13,63 @@ #include "lily-proto.hh" #include "colhpos.hh" + +/** + Statistics for the number of columns calced. + */ +struct Col_stats +{ + int count_i_; + int cols_i_; + + Col_stats(); + void add(Line_of_cols const&l); + String str()const; +}; + /** Class representation of an algorithm which decides where to put the column, and where to break lines. - TODO: a decent algorithm, based on dynamic programming or something - a like. A "parindent", caching of breakpoints + TODO: A "parindent", caching of breakpoints */ class Break_algorithm { - Line_spacer* generate_spacing_problem(Line_of_cols)const; protected: + PScore *pscore_l_; Real linelength; /// search all pcols which are breakable. Line_of_cols find_breaks() const; - /// helper: solve for the columns in #curline#. - Col_hpositions solve_line(Line_of_cols) const; + Line_of_cols all_cols() const; + Array find_break_indices()const; + + + /// helper: solve for the columns in #curline#. + void solve_line(Col_hpositions*) const; + + /// helper: approximate the energyv + void approximate_solve_line(Col_hpositions*) const; /// does curline fit on the paper? bool feasible(Line_of_cols)const; - /** generate a solution with no regard to idealspacings or - constraints. should always work */ - Col_hpositions stupid_solution(Line_of_cols) const; + Line_spacer* generate_spacing_problem(Line_of_cols)const; + virtual Array do_solve()const=0; + void print_stats()const; + + virtual void do_set_pscore(); public: + Col_stats approx_stats_; + Col_stats exact_stats_; + Line_spacer* (*get_line_spacer)(); - Break_algorithm(PScore&); + Break_algorithm(); + void set_pscore(PScore*); /// check if the spacing/breaking problem is well-stated void problem_OK()const; diff --git a/lily/include/gourlay-breaking.hh b/lily/include/gourlay-breaking.hh new file mode 100644 index 0000000000..99fa0c9340 --- /dev/null +++ b/lily/include/gourlay-breaking.hh @@ -0,0 +1,28 @@ +/* + gourlay-breaking.hh -- declare Gourlay_breaking + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef GOURLAY_BREAKING_HH +#define GOURLAY_BREAKING_HH + +#include "break.hh" + +/** + A dynamic programming solution to breaking scores into lines + */ +struct Gourlay_breaking : public Break_algorithm +{ + Real energy_bound_f_ ; + + /// maximum number of measures in a line + int max_measures_i_; + void do_set_pscore(); + Array do_solve()const; + Gourlay_breaking(); +}; +#endif // GOURLAY_BREAKING_HH diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index 8b26d3ee18..bcae7cff83 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -48,6 +48,10 @@ public: virtual MInterval time_int()const; }; +/** + The request is a collection of Requests. A note that you enter in mudela is + one Request_chord, one syllable of lyrics is one Request_chord + */ class Request_chord : public Chord { public: DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/performer.hh b/lily/include/performer.hh index 35911605d9..353f1f9b13 100644 --- a/lily/include/performer.hh +++ b/lily/include/performer.hh @@ -14,6 +14,10 @@ #include "score-elem-info.hh" #include "staff-info.hh" +/** + Convert a music definition into a audio representation. + A baseclass + */ class Performer { bool init_b_; public: diff --git a/lily/include/score-elem-info.hh b/lily/include/score-elem-info.hh index 05c1413ddf..4e6b609ff2 100644 --- a/lily/include/score-elem-info.hh +++ b/lily/include/score-elem-info.hh @@ -14,7 +14,9 @@ #include "lily-proto.hh" #include "varray.hh" -/// data container. +/** + Data container for broadcasts + */ struct Score_elem_info { Score_elem * elem_l_; Request*req_l_; diff --git a/lily/include/spring-spacer.hh b/lily/include/spring-spacer.hh index 55864615a2..85b828d2fa 100644 --- a/lily/include/spring-spacer.hh +++ b/lily/include/spring-spacer.hh @@ -13,10 +13,12 @@ #include "line-spacer.hh" #include "plist.hh" #include "col-info.hh" +#include "colhpos.hh" -/** the problem, given by the columns (which include constraints) and - intercolumn spacing. The problem is: - +/** + Determine positions of columns connected by springs and held apart by rods + + Generate a spacing which \begin{itemize} \item @@ -24,6 +26,7 @@ \item Looks good, ie tries to conform to an ideal spacing as much as possible. \end{itemize} + This is converted by regarding idealspacing as "springs" attached to columns. The equilibrium of one spring is the ideal distance. The columns have a size, this imposes "hard" constraints @@ -33,7 +36,7 @@ The quality is given by the total potential energy in the springs. The lower the energy, the better the configuration. - TODO: make item widths work per pstaff. + TODO: make item widths work per Staff. */ @@ -77,22 +80,24 @@ class Spring_spacer : public Line_spacer { void add_ideal(Idealspacing const *i); Vector try_initial_solution() const; void calc_idealspacing(); + void set_fixed_cols(Mixed_qp&)const; Score_column* scol_l(int); void connect(int i,int j, Real,Real); + Line_of_cols error_pcol_l_arr()const; public: static Line_spacer *constructor(); - Array error_pcol_l_arr() const; - virtual Array solve() const; - virtual void add_column(PCol *, bool fixed=false, Real fixpos=0.0); + virtual void solve(Col_hpositions*) const; + virtual void lower_bound_solution(Col_hpositions*) const; + virtual void add_column(PCol *, bool fixed=false, Real fixpos=0.0); virtual Vector default_solution() const; - virtual bool check_constraints(Vector v) const; - virtual void OK() const; - virtual void print() const; - virtual void prepare(); + virtual bool check_constraints(Vector v) const; + virtual void OK() const; + virtual void print() const; + virtual void prepare(); virtual ~Spring_spacer(){} };