The Original CHomP Software
|
This class defines a coordinator for the multi-work subdivision framework. More...
#include <mwsubdiv.h>
Public Member Functions | |
mwSubCoordinator () | |
The constructor of an uninitialized coordinator. More... | |
mwSubCoordinator (const char *filename, int _inilevel, int _maxlevel, bool _flushfile, const double *_paramLeft, const double *_paramRight) | |
The complete constructor of a coordinator object. More... | |
~mwSubCoordinator () | |
The destructor. More... | |
![]() | |
mwCoordinator () | |
The default constructor. More... | |
virtual | ~mwCoordinator () |
The virtual destructor. More... | |
void | KeepWorkers (bool keep=true) |
Makes workers keep running after the coordinator's completion. More... | |
int | SaveWorkers (const char *filename) |
Saves addresses of workers to the given file in the form of address:port. More... | |
void | Init (mwData &data) |
Defines a portion of initialization data which will be sent to every newly connected worker. More... | |
int | Coordinate (mwWorker *w=NULL) |
Run the coordinator until all the work has been completed. More... | |
![]() | |
mwTask () | |
The default constructor. More... | |
virtual | ~mwTask () |
The destructor. More... | |
void | Port (int number) |
Sets the port number for the communication or 0 to use none. More... | |
int | Port () const |
Returns the current port number. More... | |
void | ControlNumber (unsigned int number) |
Sets the control number for identification. More... | |
unsigned int | ControlNumber () const |
Returns the currently set identification control number. More... | |
void | TimeOut (int seconds) |
Sets the network connection time-out interval in seconds. More... | |
int | TimeOut () const |
Returns the currently set network connection time-out interval. More... | |
int | LogFile (const char *filename) |
Begins logging detailed communication debug information to the given file. More... | |
void | LogFile (const mwTask &other) |
Uses another task's log file to log this task's information. More... | |
void | LogClose () |
Closes the log file and adds a line with the time information unless this log file was borrowed from another task. More... | |
int | Add (const char *name, int port=-1) |
Adds an address to the list of computers to connect to at the beginning of working or coordinating. More... | |
int | Load (const char *filename) |
Loads computer addresses from the given file. More... | |
int | QuitWorkers () |
Quits all the workers whose addresses were added with the 'Add' and 'Load' functions. More... | |
Private Types | |
typedef tCubeFix< dim, coord > | ppCube |
The maximal feasible subdivision level. More... | |
typedef hashedset< ppCube > | ppCubes |
The type of a set of cubes in the parameter space. More... | |
typedef tRectangle< coord > | ppRect |
The kind of rectangle used to iterate ranges of cubes. More... | |
typedef mwSubDataPack< dim, coord > | ppPack |
The type of a sent data pack kept in an internal array. More... | |
Private Member Functions | |
int | Prepare (mwData &data) |
A function for preparing data by a coordinator. More... | |
int | Accept (mwData &data) |
A function for accepting results by a coordinator. More... | |
int | Reject (mwData &data) |
A function for taking rejected data by a coordinator. More... | |
bool | FindMinCube (const typename mwSubCoordinator< dim, coord >::ppCubes tab[], const typename mwSubCoordinator< dim, coord >::ppCubes sent[], int minlevel, int maxlevel, int &level, typename mwSubCoordinator< dim, coord >::ppCube &q) |
Finds a cube at the lowest level (>= min, < max) of the given set of cubes that was not sent, yet. More... | |
int | Contained (const typename mwSubCoordinator< dim, coord >::ppCube &q, int level, const typename mwSubCoordinator< dim, coord >::ppCubes tab[], int minlevel) const |
Verifies if the given box is contained in a box at any level greater than or equal to the given minimum in the given family of boxes. More... | |
void | NegativeProbe (const ppCube &q, int level) |
A function for acquiring a negative probe. More... | |
void | GoodProbe (const ppCube &q, int level) |
A function for acquiring a good probe. More... | |
void | FailedBox (const ppCube &q, int level) |
A function for acquiring a box for which the verification failed. More... | |
void | SuccessfulBox (const ppCube &q, int level) |
A function for acquiring a successful box. More... | |
int | ReadResults (std::istream &in) |
A procedure for reading the previously computed results. More... | |
Static Private Member Functions | |
static mwSubCoordinator< dim, coord >::ppCube | UpLevel (const typename mwSubCoordinator< dim, coord >::ppCube &q) |
Returns a probe with respect to a higher level grid, that is, multiplies all the coordinates by 2. More... | |
static mwSubCoordinator< dim, coord >::ppCube | UpLevel (const typename mwSubCoordinator< dim, coord >::ppCube &box, const typename mwSubCoordinator< dim, coord >::ppCube &corner) |
Returns a box with respect to a higher level grid which is contained in the given box and contains the given corner. More... | |
static mwSubCoordinator< dim, coord >::ppCube | DownLevel (const typename mwSubCoordinator< dim, coord >::ppCube &q) |
Returns a box with respect to a higher level grid which contains the given box, that is, divides all the coordinates by 2. More... | |
Private Attributes | |
ppCubes | Negative [ppMaxSubdiv] |
The set N: Probes for which the verification of the property was negative. More... | |
ppCubes | Good [ppMaxSubdiv] |
The set G: Good probes, that is, probes for which the property was verified successfully. More... | |
ppCubes | Test [ppMaxSubdiv] |
The set T: Probes which have to be sent for testing. More... | |
ppCubes | CurProbes [ppMaxSubdiv] |
Part of the set C2: Currently processed probes. More... | |
ppCubes | Failed [ppMaxSubdiv] |
The set F: Boxes for which the verification failed. More... | |
ppCubes | Successful [ppMaxSubdiv] |
The set A: Boxes which are successfully verified to satisfy the given property and thus are contained in the set A. More... | |
ppCubes | Waiting [ppMaxSubdiv] |
The set W: Boxes waiting for verification. More... | |
ppCubes | CurBoxes [ppMaxSubdiv] |
Part of the set C: Currently processed boxes. More... | |
double | paramLeft [dim] |
The left (minimal) vertices of the parameter cube. More... | |
double | paramRight [dim] |
The right (maximal) vertices of the parameter cube. More... | |
int | inilevel |
The level of subdivisions in the parameter space at which the actual computations begin. More... | |
int | maxlevel |
The maximal allowed level of subdivision in the parameter space. More... | |
mwIniProbes< dim, coord > | iniProbes |
An iterator of initial probes. More... | |
ppCubes | iniProcessed |
A set of previously processed initial probes (used only if continuing the computations). More... | |
std::ofstream | f |
A file to append the results to. More... | |
bool | flushfile |
Should the results file be flushed after every write? More... | |
int | current |
The counter of data packs prepared by a coordinator. More... | |
multitable< ppPack > | sent |
The data packs sent for processing. More... | |
int | sentlen |
The number of data packs sent for processing. More... | |
int | countNegative |
The number of processed probes with negative result. More... | |
int | countGood |
The number of processed probes which turn out to be good. More... | |
int | countFailed |
The number of processed boxes for which the verification failed. More... | |
int | countSuccessful |
The number of processed boxes for which the verification was successful. More... | |
Static Private Attributes | |
static const int | ppMaxSubdiv = 8 * sizeof (coord) - 2 |
The maximal feasible subdivision level. More... | |
static const int | ppMaxDim = ppCube::MaxDim |
The maximal dimension of cubes. More... | |
Additional Inherited Members | |
![]() | |
static int | SendMessage (int fd, unsigned int ctrl, unsigned int code, const mwData &x) |
Sends a message with data to the given socket. More... | |
static int | RecvMessage (int fd, unsigned int &ctrl, unsigned int &code, mwData &x) |
Receives a message with data from the given socket. More... | |
![]() | |
std::ofstream * | logFile |
The debug log file stream. More... | |
std::vector< std::string > | computers |
A list of workers or coordinators to connect to at start-up. More... | |
std::vector< int > | ports |
A list of port numbers of workers to connect to at start-up. More... | |
This class defines a coordinator for the multi-work subdivision framework.
Definition at line 554 of file mwsubdiv.h.
|
private |
The maximal feasible subdivision level.
The type of a cube of parameters.
Definition at line 563 of file mwsubdiv.h.
|
private |
The type of a set of cubes in the parameter space.
Definition at line 569 of file mwsubdiv.h.
|
private |
The type of a sent data pack kept in an internal array.
Definition at line 575 of file mwsubdiv.h.
|
private |
The kind of rectangle used to iterate ranges of cubes.
Definition at line 572 of file mwsubdiv.h.
|
inline |
The constructor of an uninitialized coordinator.
Definition at line 750 of file mwsubdiv.h.
chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator | ( | const char * | filename, |
int | _inilevel, | ||
int | _maxlevel, | ||
bool | _flushfile, | ||
const double * | _paramLeft, | ||
const double * | _paramRight | ||
) |
The complete constructor of a coordinator object.
Definition at line 756 of file mwsubdiv.h.
References chomp::homology::currenttime(), chomp::multiwork::mwSubCoordinator< dim, coord >::f, chomp::multiwork::mwSubCoordinator< dim, coord >::flushfile, chomp::multiwork::mwSubCoordinator< dim, coord >::inilevel, chomp::multiwork::mwSubCoordinator< dim, coord >::maxlevel, chomp::multiwork::mwSubCoordinator< dim, coord >::paramLeft, chomp::multiwork::mwSubCoordinator< dim, coord >::paramRight, chomp::multiwork::mwSubCoordinator< dim, coord >::ppMaxSubdiv, chomp::multiwork::mwSubCoordinator< dim, coord >::ReadResults(), and chomp::homology::sout.
|
inline |
The destructor.
Definition at line 816 of file mwsubdiv.h.
References chomp::homology::currenttime().
|
privatevirtual |
A function for accepting results by a coordinator.
Reimplemented from chomp::multiwork::mwCoordinator.
Definition at line 1286 of file mwsubdiv.h.
References chomp::multiwork::mwError, chomp::multiwork::mwOk, and chomp::homology::sout.
|
private |
Verifies if the given box is contained in a box at any level greater than or equal to the given minimum in the given family of boxes.
Returns the level of a box which is found or 0 if none.
Definition at line 1054 of file mwsubdiv.h.
|
staticprivate |
Returns a box with respect to a higher level grid which contains the given box, that is, divides all the coordinates by 2.
Definition at line 1043 of file mwsubdiv.h.
|
private |
A function for acquiring a box for which the verification failed.
Definition at line 1150 of file mwsubdiv.h.
References chomp::homology::sbug.
|
inlineprivate |
Finds a cube at the lowest level (>= min, < max) of the given set of cubes that was not sent, yet.
Modifies 'level' and 'q'. Returns true if found, false if not found.
Definition at line 835 of file mwsubdiv.h.
|
private |
A function for acquiring a good probe.
Definition at line 1108 of file mwsubdiv.h.
References chomp::homology::sbug.
|
private |
A function for acquiring a negative probe.
Definition at line 1078 of file mwsubdiv.h.
References chomp::homology::sbug.
|
privatevirtual |
A function for preparing data by a coordinator.
Reimplemented from chomp::multiwork::mwCoordinator.
Definition at line 861 of file mwsubdiv.h.
References chomp::multiwork::mwNoData, chomp::multiwork::mwOk, chomp::multiwork::mwSubdivPoint(), and chomp::homology::sout.
|
private |
A procedure for reading the previously computed results.
Definition at line 1378 of file mwsubdiv.h.
References chomp::homology::ignorecomments(), and chomp::homology::ignoreline().
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
privatevirtual |
A function for taking rejected data by a coordinator.
Reimplemented from chomp::multiwork::mwCoordinator.
Definition at line 1363 of file mwsubdiv.h.
References chomp::multiwork::mwError, and chomp::homology::sout.
|
private |
A function for acquiring a successful box.
Definition at line 1202 of file mwsubdiv.h.
References chomp::homology::sbug.
|
staticprivate |
Returns a box with respect to a higher level grid which is contained in the given box and contains the given corner.
Definition at line 1023 of file mwsubdiv.h.
|
staticprivate |
Returns a probe with respect to a higher level grid, that is, multiplies all the coordinates by 2.
Definition at line 1011 of file mwsubdiv.h.
|
private |
The number of processed boxes for which the verification failed.
Definition at line 734 of file mwsubdiv.h.
|
private |
The number of processed probes which turn out to be good.
Definition at line 731 of file mwsubdiv.h.
|
private |
The number of processed probes with negative result.
Definition at line 728 of file mwsubdiv.h.
|
private |
The number of processed boxes for which the verification was successful.
Definition at line 738 of file mwsubdiv.h.
|
private |
Part of the set C: Currently processed boxes.
Definition at line 628 of file mwsubdiv.h.
|
private |
Part of the set C2: Currently processed probes.
Definition at line 615 of file mwsubdiv.h.
|
private |
The counter of data packs prepared by a coordinator.
Definition at line 717 of file mwsubdiv.h.
|
private |
A file to append the results to.
Definition at line 706 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
private |
The set F: Boxes for which the verification failed.
Definition at line 618 of file mwsubdiv.h.
|
private |
Should the results file be flushed after every write?
Definition at line 709 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
private |
The set G: Good probes, that is, probes for which the property was verified successfully.
Definition at line 609 of file mwsubdiv.h.
|
private |
The level of subdivisions in the parameter space at which the actual computations begin.
Definition at line 691 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
private |
An iterator of initial probes.
Definition at line 697 of file mwsubdiv.h.
|
private |
A set of previously processed initial probes (used only if continuing the computations).
Definition at line 701 of file mwsubdiv.h.
|
private |
The maximal allowed level of subdivision in the parameter space.
Definition at line 694 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
private |
The set N: Probes for which the verification of the property was negative.
Definition at line 605 of file mwsubdiv.h.
|
private |
The left (minimal) vertices of the parameter cube.
Definition at line 684 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
private |
The right (maximal) vertices of the parameter cube.
Definition at line 687 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
staticprivate |
The maximal dimension of cubes.
Definition at line 566 of file mwsubdiv.h.
|
staticprivate |
The maximal feasible subdivision level.
Definition at line 557 of file mwsubdiv.h.
Referenced by chomp::multiwork::mwSubCoordinator< dim, coord >::mwSubCoordinator().
|
private |
The data packs sent for processing.
Definition at line 720 of file mwsubdiv.h.
|
private |
The number of data packs sent for processing.
Definition at line 723 of file mwsubdiv.h.
|
private |
The set A: Boxes which are successfully verified to satisfy the given property and thus are contained in the set A.
Definition at line 622 of file mwsubdiv.h.
|
private |
The set T: Probes which have to be sent for testing.
Definition at line 612 of file mwsubdiv.h.
|
private |
The set W: Boxes waiting for verification.
Definition at line 625 of file mwsubdiv.h.