Skip to content

Commit 47e823e

Browse files
committed
Adjust PHLEX_REGISTER_ALGORITHMS examples to receive 'm' object
1 parent 3459266 commit 47e823e

7 files changed

Lines changed: 27 additions & 27 deletions

File tree

‎doc/ch_conceptual_design/hofs/filters.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The following example shows the complete registration for histogramming the filt
4646
{
4747
auto h_resource = m.resource<histogramming>();
4848

49-
observe(histogram_hits, concurrency::serial)
49+
m.observe(histogram_hits, concurrency::serial)
5050
.input_family("GoodHits"_in("APA"), h_resource->make<TH1F>(...))
5151
.when("high_energy"); // <= predicate expression within the when(...) call
5252
}

‎doc/ch_conceptual_design/hofs/partitioned_folds.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ The :mathfunc:`fold(sum_energies)` node in :numref:`workflow` would be represent
127127

128128
void sum_energy(double& total_hit_energy, hits const& hs) { ... }
129129

130-
PHLEX_REGISTER_ALGORITHMS(config)
130+
PHLEX_REGISTER_ALGORITHMS(m)
131131
{
132-
fold(
132+
m.fold(
133133
"sum_hit_energy", // <= Node name for framework
134134
sum_energy, // <= Fold operation
135135
0., // <= Initializer for each fold result

‎doc/ch_conceptual_design/hofs/partitioned_unfolds.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ The class is then registered with Phlex via:
131131

132132
.. code:: c++
133133

134-
PHLEX_REGISTER_ALGORITHMS(config)
134+
PHLEX_REGISTER_ALGORITHMS(m)
135135
{
136-
unfold<to_apas>(
136+
m.unfold<to_apas>(
137137
"to_apas", // <= Node name for framework
138138
&to_apas::keep_going, // <= Unfold predicate
139139
&to_apas::make_waveforms, // <= Unfold generator

‎doc/ch_conceptual_design/hofs/predicates.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ The registration for the predicate node in :numref:`workflow` would look like:
4444
class hits { ... };
4545
bool high_energy(hits const& hs) { ... }
4646

47-
PHLEX_REGISTER_ALGORITHMS(config)
47+
PHLEX_REGISTER_ALGORITHMS(m)
4848
{
49-
predicate("high_energy", high_energy, concurrency::unlimited)
49+
m.predicate("high_energy", high_energy, concurrency::unlimited)
5050
.input_family("GoodHits"_in("APA"));
5151
}

‎doc/ch_conceptual_design/hofs/transforms.rst‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ To illustrate the different ways a transform's algorithm can be registered with
5757

5858
.. code:: c++
5959

60-
PHLEX_REGISTER_ALGORITHMS(config)
60+
PHLEX_REGISTER_ALGORITHMS(m)
6161
{
62-
transform("hit_finder", find_hits, concurrency::unlimited)
62+
m.transform("hit_finder", find_hits, concurrency::unlimited)
6363
.input_family("Waveforms"_in("APA"));
6464
}
6565

@@ -69,9 +69,9 @@ To illustrate the different ways a transform's algorithm can be registered with
6969

7070
.. code:: c++
7171

72-
PHLEX_REGISTER_ALGORITHMS(config)
72+
PHLEX_REGISTER_ALGORITHMS(m)
7373
{
74-
transform("hit_finder", find_hits, concurrency::unlimited)
74+
m.transform("hit_finder", find_hits, concurrency::unlimited)
7575
.input_family("Waveforms"_in("APA"))
7676
.output_product_suffixes("GoodHits");
7777
}
@@ -82,9 +82,9 @@ To illustrate the different ways a transform's algorithm can be registered with
8282

8383
.. code:: c++
8484

85-
PHLEX_REGISTER_ALGORITHMS(config)
85+
PHLEX_REGISTER_ALGORITHMS(m)
8686
{
87-
transform("vertex_maker", make_vertices, concurrency::unlimited)
87+
m.transform("vertex_maker", make_vertices, concurrency::unlimited)
8888
.input_family("Geometry"_in("Job"), "GoodTracks"_in("APA"))
8989
.output_product_suffixes("Vertices");
9090
}
@@ -93,9 +93,9 @@ To illustrate the different ways a transform's algorithm can be registered with
9393

9494
.. code:: c++
9595

96-
PHLEX_REGISTER_ALGORITHMS(config)
96+
PHLEX_REGISTER_ALGORITHMS(m)
9797
{
98-
transform("hit_counter", count_good_hits, concurrency::unlimited)
98+
m.transform("hit_counter", count_good_hits, concurrency::unlimited)
9999
.input_family("GoodHits"_in("APA"))
100100
.output_product_suffixes("NumGoodHits", "NumAllHits"); // <= One name per tuple slot
101101
}

‎doc/ch_conceptual_design/hofs/windows.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ The :mathfunc:`window(make_tracks)` node in :numref:`workflow` would be represen
9696
tracks make_tracks(tracks const& ts, tracks const* next_ts) { ... }
9797
bool are_adjacent(id const& left, id const& right) { ... }
9898

99-
PHLEX_REGISTER_ALGORITHMS(config)
99+
PHLEX_REGISTER_ALGORITHMS(m)
100100
{
101-
window(
101+
m.window(
102102
"track_maker", // <= Node name for framework
103103
make_tracks, // <= Window algorithm (f)
104104
are_adjacent // <= Adjacency criterion

‎doc/ch_conceptual_design/registration.rst‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ The interface of the algorithm and its registration would look like:
109109
class pedestals { ... };
110110
hits find_hits_subtract_pedestals(waveforms const&, pedestals const&) {...}
111111

112-
PHLEX_REGISTER_ALGORITHMS(config)
112+
PHLEX_REGISTER_ALGORITHMS(m)
113113
{
114-
transform("find_hits", find_hits_subtract_pedestals, concurrency::unlimited)
114+
m.transform("find_hits", find_hits_subtract_pedestals, concurrency::unlimited)
115115
.input_family("Waveforms"_in("APA"), "Pedestals"_in("APA"));
116116
.output_product_suffixes("GoodHits");
117117
}
@@ -136,9 +136,9 @@ This would be expressed in C++ as:
136136

137137
vertices make_vertices(tracks const&, geometry const&) { ... }
138138

139-
PHLEX_REGISTER_ALGORITHMS(config)
139+
PHLEX_REGISTER_ALGORITHMS(m)
140140
{
141-
transform("vertex_maker", make_vertices, concurrency::unlimited)
141+
m.transform("vertex_maker", make_vertices, concurrency::unlimited)
142142
.input_family("GoodTracks"_in("APA"), "Geometry"_in("Job"));
143143
.output_product_suffixes("Vertices");
144144
}
@@ -167,11 +167,11 @@ To do this, an additional argument (e.g. :cpp:`config`) is passed to the registr
167167

168168
.. code:: c++
169169

170-
PHLEX_REGISTER_ALGORITHMS(config)
170+
PHLEX_REGISTER_ALGORITHMS(m, config)
171171
{
172172
auto selected_data_layer = config.get<std::string>("data_layer");
173173

174-
transform("hit_finder", find_hits, concurrency::unlimited)
174+
m.transform("hit_finder", find_hits, concurrency::unlimited)
175175
.input_family("Waveforms"_in(selected_data_layer));
176176
.output_product_suffixes("GoodHits");
177177
}
@@ -226,12 +226,12 @@ For example, the :cpp:`find_hits` algorithm author could have instead created a
226226
...
227227
};
228228

229-
PHLEX_REGISTER_ALGORITHMS(config)
229+
PHLEX_REGISTER_ALGORITHMS(m, config)
230230
{
231231
auto sigma_threshold = config.get<float>("sigma_threshold");
232232
auto selected_data_layer = config.get<std::string>("data_layer");
233233

234-
make<hit_finder>(sigma_threshold) // <= Make framework-owned instance of hit_finder
234+
m.make<hit_finder>(sigma_threshold) // <= Make framework-owned instance of hit_finder
235235
.transform("hit_finder", &hit_finder::find, concurrency::unlimited)
236236
.input_family("Waveforms"_in(selected_data_scope));
237237
.output_product_suffixes("GoodHits");
@@ -261,7 +261,7 @@ Instead, the code author can use the following [#f1]_:
261261

262262
.. code:: c++
263263

264-
transform(..., [](double x){ return std::sqrt(x); }, ...);
264+
m.transform(..., [](double x){ return std::sqrt(x); }, ...);
265265

266266
where the desired overload is selected based on the :cpp:`double` argument to the lambda expression.
267267

@@ -270,7 +270,7 @@ where the desired overload is selected based on the :cpp:`double` argument to th
270270
.. [#statement_ordering] In contrast to the equational form, the specification of the output products occurs *after* the specification of the input family, leading to more natural programming patterns.
271271
.. [#zip] The operation that forms the family :math:`\left[(\textit{Waveforms}_i, \textit{Pedestals}_i)\right]_{i \in \iset{\text{APA}}}` from the separate families :math:`\ifamily{\textit{Waveforms}}{\text{APA}}` and :math:`\ifamily{\textit{Pedestals}}{\text{APA}}` is called *zip*.
272272
.. [#job] As shown in :numref:`data-organization`, there is a `Job` data layer, to which job-level data products may belong.
273-
.. [#f1] Equivalently, one can use the obscure syntax :cpp:`transform(..., static_cast<double(*)(double)>(std::sqrt), ...)`, where :cpp:`std::sqrt` is cast to the desired overload.
273+
.. [#f1] Equivalently, one can use the obscure syntax :cpp:`m.transform(..., static_cast<double(*)(double)>(std::sqrt), ...)`, where :cpp:`std::sqrt` is cast to the desired overload.
274274
275275
.. only:: html
276276

0 commit comments

Comments
 (0)