This class defines a worker for the multi-work subdivision framework. More...
#include <mwsubdiv.h>
Public Member Functions | |
mwSubWorker (fcompute _compute) | |
The constructor. | |
Private Member Functions | |
int | Process (mwData &data) |
A function for processing the data by a worker. | |
Private Attributes | |
fcompute | compute |
The address of a function to use for the computations. |
This class defines a worker for the multi-work subdivision framework.
Definition at line 108 of file mwsubdiv.h.
chomp::multiwork::mwSubWorker< dim, coord >::mwSubWorker | ( | fcompute | _compute | ) | [inline] |
The constructor.
Definition at line 126 of file mwsubdiv.h.
: compute (_compute) { return; } /* mwSubWorker<dim,coord>::mwSubWorker */
int chomp::multiwork::mwSubWorker< dim, coord >::Process | ( | mwData & | data | ) | [private, virtual] |
A function for processing the data by a worker.
Reimplemented from chomp::multiwork::mwWorker.
Definition at line 135 of file mwsubdiv.h.
References chomp::multiwork::mwSubWorker< dim, coord >::compute, and chomp::homology::sout.
{ // decode the number of the data pack to process int current = 0; data >> current; // say which data pack is being processed sout << "- " << current << ".\n"; // decode the subdivision level int level = 0; data >> level; // decode the information on whether this is a full box or a probe bool full = false; data >> full; // the intervals double left [dim]; double right [dim]; for (int i = 0; i < dim; ++ i) { data >> left [i]; if (full) data >> right [i]; } // the marker of the end of data int dataEndMarker = 0; data >> dataEndMarker; if (dataEndMarker != 13) { data. Reset (); sout << "! Incompatible data received. Rejecting it.\n"; return mwReject; } // rune one set of computations int result = compute (left, full ? right : left, dim, level); // if the result is wrong then reject this piece of data if (result < 0) { sout << "! Data no. " << current << " produced a negative result. Rejecting it.\n"; return mwReject; } // say what has been computed sout << "= " << current << " " << result << ".\n"; // send back the data containing the result of the processing data. Reset (); data << current; data << result; return mwOk; } /* mwSubWorker<dim,coord>::Process */
fcompute chomp::multiwork::mwSubWorker< dim, coord >::compute [private] |
The address of a function to use for the computations.
Definition at line 119 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubWorker< dim, coord >::Process().