33#ifndef _CHOMP_MULTIWORK_MWSUBDIV_H_
34#define _CHOMP_MULTIWORK_MWSUBDIV_H_
102typedef int (*
fcompute) (
const double *left,
const double *right,
106template <
int dim,
class coord>
124template <
int dim,
class coord>
133template <
int dim,
class coord>
141 sout <<
"- " << current <<
".\n";
154 for (
int i = 0; i < dim; ++ i)
162 int dataEndMarker = 0;
163 data >> dataEndMarker;
164 if (dataEndMarker != 13)
167 sout <<
"! Incompatible data received. Rejecting it.\n";
172 int result = compute (left, full ? right : left, dim, level);
177 sout <<
"! Data no. " << current <<
178 " produced a negative result. Rejecting it.\n";
183 sout <<
"= " << current <<
" " << result <<
".\n";
201template <
class coord>
203 coord part, coord full)
211 else if (part == full)
216 while (!(part & 1) && !(full & 1))
223 double fraction =
static_cast<double> (part) / full;
224 return (left + (right - left) * fraction);
234template <
int dim,
class coord>
274template <
int dim,
class coord>
278 throw "Too low initial level. Should be at least 2.";
279 for (
int i = 0; i < dim; ++ i)
281 this -> left [i] = 1;
282 this -> right [i] = 1 << level;
285 this -> next =
this -> rect. get ();
289template <
int dim,
class coord>
295template <
int dim,
class coord>
302template <
int dim,
class coord>
308template <
int dim,
class coord>
312 this -> next =
this -> rect. get ();
316template <
int dim,
class coord>
319 return !!(
this -> next);
329template <
int dim,
class coord>
369template <
int dim,
class coord>
372 q. coord (
this -> left);
373 for (
int i = 0; i < dim; ++ i)
375 this -> right [i] = left [i] + 1;
376 -- (
this -> left [i]);
379 this -> next =
this -> rect. get ();
383template <
int dim,
class coord>
389template <
int dim,
class coord>
396template <
int dim,
class coord>
402template <
int dim,
class coord>
405 const coord *current =
this -> next;
406 this -> next =
this -> rect. get ();
410template <
int dim,
class coord>
413 return !!(
this -> next);
423template <
int dim,
class coord>
463template <
int dim,
class coord>
466 q. coord (
this -> left);
467 for (
int i = 0; i < dim; ++ i)
469 this -> right [i] = left [i] + 2;
472 this -> next =
this -> rect. get ();
476template <
int dim,
class coord>
482template <
int dim,
class coord>
489template <
int dim,
class coord>
495template <
int dim,
class coord>
498 const coord *current =
this -> next;
499 this -> next =
this -> rect. get ();
503template <
int dim,
class coord>
506 return !!(
this -> next);
517template <
int dim,
class coord>
526 int _level,
bool _full):
553template <
int dim,
class coord>
583 int _inilevel,
int _maxlevel,
bool _flushfile,
584 const double *_paramLeft,
const double *_paramRight);
638 int minlevel,
int maxlevel,
int &level,
744template <
int dim,
class coord>
749template <
int dim,
class coord>
755template <
int dim,
class coord>
757 int _inilevel,
int _maxlevel,
bool _flushfile,
758 const double *_paramLeft,
const double *_paramRight):
759 inilevel ((_inilevel < 2) ? 2 : _inilevel),
760 maxlevel ((_maxlevel <= inilevel) ? (inilevel + 1) : _maxlevel),
761 iniProbes (inilevel),
762 flushfile (_flushfile),
763 current (0), sentlen (0),
764 countNegative (0), countGood (0),
765 countFailed (0), countSuccessful (0)
768 if (!filename || !*filename)
769 sout <<
"WARNING: No results file name given. "
770 "Computation results will not be saved.\n";
775 sout <<
"WARNING: Max subdivision level decreased from " <<
783 if (filename && *filename)
785 std::ifstream in (filename);
787 sout <<
"Note: Could not open the results file. "
788 "Any previous results will be ignored.\n";
797 if (filename && *filename)
799 f. open (filename, std::ios::out | std::ios::app);
806 for (
int i = 0; i < dim; ++ i)
815template <
int dim,
class coord>
818 f <<
"; A total of " << (countNegative + countGood) <<
819 " probes and " << (countFailed + countSuccessful) <<
820 " boxes have been processed.\n";
821 f <<
"; The verification was negative for " << countNegative <<
822 " probes, and " << countGood <<
" probes were good.\n";
823 f <<
"; The verification failed for " << countFailed <<
824 " boxes, and was successful for " << countSuccessful <<
827 f <<
"; ---------------------------------------------------\n";
834template <
int dim,
class coord>
838 int minlevel,
int maxlevel,
841 for (
int l = minlevel; l < maxlevel; ++ l)
843 const ppCubes &theSet = tab [l];
844 const ppCubes &sentSet = sent [l];
845 int number = theSet. size ();
846 for (
int i = number - 1; i >= 0; -- i)
848 const ppCube &c = theSet [i];
849 if (!sentSet. check (c))
860template <
int dim,
class coord>
864 ppPack &pack = sent [sentlen];
868 bool iniProbe =
false;
869 while (iniProbes. available ())
871 pack =
ppPack (current, iniProbes. get (), inilevel,
false);
872 if (iniProcessed. check (pack. q))
874 iniProcessed. remove (pack. q);
890 bool foundT =
this -> FindMinCube (Test, CurProbes,
891 inilevel, maxlevel, levelT, cubeT);
896 bool foundW =
this -> FindMinCube (Waiting, CurBoxes,
897 inilevel, maxlevel, levelW, cubeW);
900 if (!foundT && !foundW)
904 if (foundT && (!foundW || (levelT <= levelW)))
906 pack =
ppPack (current, cubeT, levelT,
false);
907 CurProbes [levelT]. add (cubeT);
912 pack =
ppPack (current, cubeW, levelW,
true);
913 CurBoxes [levelW]. add (cubeW);
920 int fullSize = 1 << pack. level;
921 double left [ppMaxDim];
922 double right [ppMaxDim];
923 for (
int i = 0; i < dim; ++ i)
934 paramRight [i], c [i] + 1, fullSize);
939 if (left [i] == right [i])
942 f <<
"; The resolution of representable "
943 "numbers exceeded.\n; Decreasing "
944 "max level from " << maxlevel <<
945 " to " << pack. level <<
".\n";
950 sout <<
"WARNING: The resolution of "
951 "representable numbers exceeded.\n"
952 "Decreasing max level from " <<
953 maxlevel <<
" to " << pack. level <<
957 maxlevel = pack. level;
964 f <<
"+ " << pack. num;
965 for (
int i = 0; i < dim; ++ i)
967 f << (i ?
"x[" :
" [") << left [i];
969 f <<
"," << right [i];
986 for (
int i = 0; i < dim; ++ i)
994 const int dataEndMarker = 13;
995 data << dataEndMarker;
998 sout <<
"+ " << pack. num <<
".\n";
1009template <
int dim,
class coord>
1016 for (
int i = 0; i < dim; ++ i)
1021template <
int dim,
class coord>
1029 coord cCorner [dim];
1030 corner. coord (cCorner);
1031 for (
int i = 0; i < dim; ++ i)
1033 if (cBox [i] == cCorner [i])
1036 cBox [i] = (cBox [i] << 1) + 1;
1038 return ppCube (cBox, dim);
1041template <
int dim,
class coord>
1048 for (
int i = 0; i < dim; ++ i)
1053template <
int dim,
class coord>
1060 if (tab [level]. check (q))
1064 if (minlevel < inilevel)
1065 minlevel = inilevel;
1067 while (-- level > minlevel)
1069 box = DownLevel (box);
1070 if (tab [level]. check (box))
1077template <
int dim,
class coord>
1081 Negative [level]. add (q);
1082 sbug <<
"@ NegProbe [" << level <<
"]: " << q <<
"\n";
1087 while (boxes. available ())
1090 ppCube box = boxes. get ();
1094 if (Waiting [level]. check (box) &&
1095 !CurBoxes [level]. check (box))
1097 sbug <<
"# FailedBox [" << level <<
"]: " <<
1099 Waiting [level]. remove (box);
1100 FailedBox (box, level);
1107template <
int dim,
class coord>
1111 if (Good [level]. check (q))
1113 sbug <<
"@ GoodKnown [" << level <<
"]: " << q <<
"\n";
1118 Good [level]. add (q);
1119 sbug <<
"@ GoodProbe [" << level <<
"]: " << q <<
"\n";
1122 if (level + 1 == maxlevel)
1126 ppCube probe = UpLevel (q);
1127 Good [level + 1]. add (probe);
1128 sbug <<
"+ GoodProbe [" << (level + 1) <<
"]: " << probe <<
"\n";
1132 while (boxes. available ())
1136 ppCube box = boxes. get ();
1137 if (!Contained (box, level + 1, Successful, 0))
1140 Waiting [level + 1]. add (box);
1141 sbug <<
"+ Waiting [" << (level + 1) <<
"]: " <<
1149template <
int dim,
class coord>
1153 Failed [level]. add (q);
1154 sbug <<
"@ FailedBox [" << level <<
"]: " << q <<
"\n";
1157 if (level + 1 == maxlevel)
1162 while (corners. available ())
1165 ppCube c = corners. get ();
1168 if (Negative [level]. check (c))
1173 if (!Good [level]. check (c))
1175 Test [level]. add (c);
1176 sbug <<
"+ Test [" << level <<
"]: " << c <<
"\n";
1183 ppCube box = UpLevel (q, c);
1184 if (!Successful [level + 1]. check (box) &&
1185 !Failed [level + 1]. check (box))
1187 Waiting [level + 1]. add (box);
1188 sbug <<
"+ Waiting [" << (level + 1) <<
"]: " <<
1193 ppCube probe = UpLevel (c);
1194 Good [level + 1]. add (probe);
1195 sbug <<
"+ Good [" << (level + 1) <<
"]: " << probe <<
"\n";
1201template <
int dim,
class coord>
1205 if (Successful [level]. check (q))
1207 sbug <<
"@ SuccessKnown [" << level <<
"]: " << q <<
"\n";
1213 if (Contained (q, level, Successful, 0))
1215 sbug <<
"@ SuccessSubset [" << level <<
"]: " << q <<
"\n";
1220 Successful [level]. add (q);
1221 sbug <<
"@ SuccessBox [" << level <<
"]: " << q <<
"\n";
1225 while (corners. available ())
1228 ppCube c = corners. get ();
1231 if (Test [level]. check (c))
1233 Test [level]. remove (c);
1234 sbug <<
"- Test [" << level <<
"]: " << c <<
"\n";
1238 ppCube cornerBox = UpLevel (q, c);
1239 if (Waiting [level + 1]. check (cornerBox))
1241 Waiting [level + 1]. remove (cornerBox);
1242 sbug <<
"- Waiting [" << (level + 1) <<
"]: " <<
1252 if (Good [level]. check (c))
1256 Good [level]. add (c);
1257 sbug <<
"+ Good [" << level <<
"]: " << c <<
"\n";
1260 ppCube probe = UpLevel (c);
1261 Good [level + 1]. add (probe);
1262 sbug <<
"+ Good [" << (level + 1) <<
"]: " << probe <<
"\n";
1266 while (boxes. available ())
1269 ppCube box = boxes. get ();
1273 if (!Contained (box, level + 1, Successful, 0))
1275 Waiting [level + 1]. add (box);
1276 sbug <<
"+ Waiting [" << (level + 1) <<
1277 "]: " << box <<
"\n";
1285template <
int dim,
class coord>
1297 sout <<
"* " << n <<
" " << result <<
".\n";
1301 while ((pos < sentlen) && (sent [pos]. num != n))
1305 sout <<
"ERROR: Wrong data pack number received "
1309 const ppPack &pack = sent [pos];
1312 f << (pack. full ?
"* " :
"@ ") << n <<
" " << result <<
1313 " " << pack. level <<
" " << pack. q <<
".\n";
1318 const ppCube &q = pack. q;
1319 int level = pack. level;
1320 bool full = pack. full;
1325 CurBoxes [level]. remove (q);
1326 Waiting [level]. remove (q);
1330 SuccessfulBox (q, level);
1335 FailedBox (q, level);
1340 CurProbes [level]. remove (q);
1341 Test [level]. remove (q);
1345 GoodProbe (q, level);
1350 NegativeProbe (q, level);
1357 sent [pos] = sent [sentlen];
1362template <
int dim,
class coord>
1370 sout <<
"!!! Data no. " << n <<
" rejected.\n";
1377template <
int dim,
class coord>
1384 int ch = in. get ();
1387 if ((ch !=
'*') && (ch !=
'@'))
1395 if ((ch ==
'*') || (ch ==
'@'))
1405 if ((ch ==
'*') || (ch ==
'@'))
1423 if (in. peek () !=
'.')
1433 Waiting [level]. remove (q);
1435 SuccessfulBox (q, level);
1437 FailedBox (q, level);
1441 if (level == inilevel)
1442 iniProcessed. add (q);
1444 Test [level]. remove (q);
1446 GoodProbe (q, level);
1448 NegativeProbe (q, level);
1463template <
int dim,
class coord>
1465 const char *title,
const char *helpinfo,
1466 int defaultPortNumber,
int controlNumber,
1467 const double *paramLeft,
const double *paramRight,
1468 int minSubdivLevel,
fcompute compute)
1470 const char *arginfo =
"\
1471Command line arguments (at least '-w' or '-m N' must be specified):\n\
1472-w [port] - run as a worker (by default the program runs as a coordinator),\n\
1473-c [port] - run as a coordinator only (don't process any data locally),\n\
1474-p port - set the port number for the multi-work communication,\n\
1475-k - keep workers waiting after the computations have been completed,\n\
1476computer:port - use this connection at start-up (can be repeated),\n\
1477-s FILE - save the workers' list to this file (default: mwsubdiv.txt),\n\
1478-r FILE - retrieve the workers' list from this file (def: mwsubdiv.txt),\n\
1479-f filename - results file (new results will be appended); coord only!\n\
1480--flush - flush the results file very frequently (slows down the program),\n\
1481-i N - set the initial subdivision level (some minimum is enforced),\n\
1482-m N - set the maximal subdivision level (default: inilevel + 2),\n\
1483-q - quit all the workers who are waiting (provide addresses or use -r),\n\
1484--quiet - do not display any messages on the standard output,\n\
1485--log filename - save the console output to the given file,\n\
1486--help - show this brief help information and exit.\n\
1487For more information ask the author at http://www.PawelPilarczyk.com/.";
1490 char *retrieveworkers = 0;
1491 char *saveworkers = 0;
1492 const int maxaddr = 1024;
1493 char *addr [maxaddr];
1498 bool keepworkers =
false;
1499 bool quitworkers =
false;
1503 bool flushfile =
false;
1507 arg (a, 0, addr, naddr, maxaddr);
1508 arg (a,
"r", retrieveworkers,
"mwsubdiv.txt");
1509 arg (a,
"s", saveworkers,
"mwsubdiv.txt");
1510 arg (a,
"f", filename);
1511 arg (a,
"i", inilevel);
1512 arg (a,
"m", maxlevel);
1513 arg (a,
"w", workport, defaultPortNumber);
1514 arg (a,
"p", portnum);
1515 arg (a,
"c", coordport, defaultPortNumber);
1518 argswitch (a,
"-flush", flushfile,
true);
1522 int argresult = a. analyze (argc, argv);
1527 sout << title <<
'\n';
1532 sout <<
"Call with '--help' for help.\n";
1538 int port = defaultPortNumber;
1539 bool localwork = (coordport < 0);
1542 bool worker = (workport >= 0);
1549 if (!maxlevel && !worker && !quitworkers)
1555 sout << helpinfo <<
'\n' << arginfo <<
'\n';
1574 c. ControlNumber (controlNumber);
1577 if (retrieveworkers)
1578 c. Load (retrieveworkers);
1579 for (
int i = 0; i < naddr; ++ i)
1583 sout <<
"Quitting workers... ";
1596 w. ControlNumber (controlNumber);
1597 for (
int i = 0; i < naddr; ++ i)
1601 sout <<
"Running as a worker...\n";
1602 int result = w. Work ();
1604 sout <<
"Work completed successfully.\n";
1606 sout <<
"Could not work - probably "
1607 "an error occurred.\n";
1614 if (inilevel <= minSubdivLevel)
1615 inilevel = minSubdivLevel;
1616 if (maxlevel <= inilevel)
1617 maxlevel = inilevel + 2;
1622 maxlevel, flushfile, paramLeft, paramRight);
1625 c. KeepWorkers (keepworkers);
1627 c. ControlNumber (controlNumber);
1628 for (
int i = 0; i < naddr; ++ i)
1630 if (retrieveworkers)
1631 c. Load (retrieveworkers);
1634 sout <<
"Running as a coordinator...\n";
1635 int result = c. Coordinate (localwork ? &w : 0);
1637 sout <<
"The task completed successfully.\n";
1639 sout <<
"Could not coordinate - probably "
1640 "an error occurred.\n";
1644 c. SaveWorkers (saveworkers);
1653 catch (
const char *msg)
1655 sout <<
"ERROR: " << msg <<
'\n';
1658 catch (
const std::exception &e)
1660 sout <<
"ERROR: " << e. what () <<
'\n';
1665 sout <<
"ABORT: An unknown error occurred.\n";
This file contains the definition of a class which can be used to parse the command line of a program...
#define argstreamprepare(a)
This macrodefinition sets up command line arguments for the analysis of typical arguments related to ...
#define argstreamset()
This macrodefinition sets up the streams defined in the module "textfile.h", based on the analyzed co...
The objects of this class gather the expected command-line arguments and decode them.
This is a template for a set of objects of the given type.
A container for elements placed in a table (like a vector) that is actually built of many smaller tab...
This class defines a hypercube in R^n with edges parallel to the axes and with size 1 in each directi...
static const int MaxDim
The maximal dimension of a cube (unused).
This class can be used for iterating a rectangular set of points, given its left and right bound.
This is a helper class for iterating all the boxes which share a given vertex.
tRectangle< coord > rect
The actual box iterator.
bool available() const
Returns true iff there is at least one more box available.
coord left[dim]
The coordinates of the leftmost corner of the iterated area.
const coord * next
The next coordinates to return or 0 if none.
tCubeFix< dim, coord > get()
Returns the next available box or throws an error message if all the boxes have already been taken.
coord right[dim]
The coordinates of the rightmost corner of the iterated area.
mwBoxes< dim, coord > & operator=(const mwBoxes< dim, coord > &)
The assignment operator is not allowed.
mwBoxes(const tCubeFix< dim, coord > &q)
The only constructor allowed.
~mwBoxes()
The destructor.
This class defines a generic coordinator task object for the multi-work distributed computations fram...
This is a helper class for iterating all the corners of a given box.
tCubeFix< dim, coord > get()
Returns the next available corner or throws an error message if all the corners have already been tak...
mwCorners< dim, coord > & operator=(const mwCorners< dim, coord > &)
The assignment operator is not allowed.
bool available() const
Returns true iff there is at least one more box available.
coord left[dim]
The coordinates of the leftmost corner of the iterated area.
tRectangle< coord > rect
The actual corner iterator.
mwCorners(const tCubeFix< dim, coord > &q)
The only constructor allowed.
~mwCorners()
The destructor.
coord right[dim]
The coordinates of the rightmost corner of the iterated area.
const coord * next
The next coordinates to return or 0 if none.
This class is used to convert data structures into a single sequence of bytes and to retrieve this da...
This is a helper class for producing an initial set of probes to test the interior of the requested a...
const coord * next
The next coordinates to return or 0 if none.
mwIniProbes< dim, coord > & operator=(const mwIniProbes< dim, coord > &)
The assignment operator is not allowed.
mwIniProbes(int level=2)
The only constructor allowed.
coord right[dim]
The coordinates of the rightmost corner of the iterated area.
~mwIniProbes()
The destructor.
tRectangle< coord > rect
The actual probe iterator.
tCubeFix< dim, coord > get()
Returns the next available probe or throws an error message if all the probes have already been taken...
coord left[dim]
The coordinates of the leftmost corner of the iterated area.
bool available() const
Returns true iff there is at least one more probe available.
This class defines a coordinator for the multi-work subdivision framework.
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.
~mwSubCoordinator()
The destructor.
static const int ppMaxSubdiv
The maximal feasible subdivision level.
static const int ppMaxDim
The maximal dimension of cubes.
void NegativeProbe(const ppCube &q, int level)
A function for acquiring a negative probe.
bool flushfile
Should the results file be flushed after every write?
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,...
void GoodProbe(const ppCube &q, int level)
A function for acquiring a good probe.
void FailedBox(const ppCube &q, int level)
A function for acquiring a box for which the verification failed.
tCubeFix< dim, coord > ppCube
The maximal feasible subdivision level.
int inilevel
The level of subdivisions in the parameter space at which the actual computations begin.
ppCubes Failed[ppMaxSubdiv]
The set F: Boxes for which the verification failed.
mwIniProbes< dim, coord > iniProbes
An iterator of initial probes.
ppCubes CurBoxes[ppMaxSubdiv]
Part of the set C: Currently processed boxes.
int countFailed
The number of processed boxes for which the verification failed.
int countGood
The number of processed probes which turn out to be good.
std::ofstream f
A file to append the results to.
double paramRight[dim]
The right (maximal) vertices of the parameter cube.
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 minim...
ppCubes Negative[ppMaxSubdiv]
The set N: Probes for which the verification of the property was negative.
int sentlen
The number of data packs sent for processing.
ppCubes Good[ppMaxSubdiv]
The set G: Good probes, that is, probes for which the property was verified successfully.
ppCubes Test[ppMaxSubdiv]
The set T: Probes which have to be sent for testing.
int Prepare(mwData &data)
A function for preparing data by a coordinator.
double paramLeft[dim]
The left (minimal) vertices of the parameter cube.
int countNegative
The number of processed probes with negative result.
hashedset< ppCube > ppCubes
The type of a set of cubes in the parameter space.
void SuccessfulBox(const ppCube &q, int level)
A function for acquiring a successful box.
int current
The counter of data packs prepared by a coordinator.
ppCubes Successful[ppMaxSubdiv]
The set A: Boxes which are successfully verified to satisfy the given property and thus are contained...
mwSubDataPack< dim, coord > ppPack
The type of a sent data pack kept in an internal array.
int ReadResults(std::istream &in)
A procedure for reading the previously computed results.
ppCubes Waiting[ppMaxSubdiv]
The set W: Boxes waiting for verification.
mwSubCoordinator()
The constructor of an uninitialized coordinator.
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,...
ppCubes CurProbes[ppMaxSubdiv]
Part of the set C2: Currently processed probes.
multitable< ppPack > sent
The data packs sent for processing.
int maxlevel
The maximal allowed level of subdivision in the parameter space.
int Accept(mwData &data)
A function for accepting results by a coordinator.
int countSuccessful
The number of processed boxes for which the verification was successful.
ppCubes iniProcessed
A set of previously processed initial probes (used only if continuing the computations).
int Reject(mwData &data)
A function for taking rejected data by a coordinator.
tRectangle< coord > ppRect
The kind of rectangle used to iterate ranges of cubes.
This is a helper class which defines a single data pack used in the communication between coordinator...
mwSubDataPack(int _num, const tCubeFix< dim, coord > &_q, int _level, bool _full)
A nice constructor.
mwSubDataPack()
The default constructor.
int level
The subdivision level of the cube.
bool full
Is this a full cube (or just a probe)?
tCubeFix< dim, coord > q
The cube sent to a worker.
int num
The number of the data pack.
This class defines a worker for the multi-work subdivision framework.
mwSubWorker(fcompute _compute)
The constructor.
fcompute compute
The address of a function to use for the computations.
int Process(mwData &data)
A function for processing the data by a worker.
This class defines a generic worker task object for the multi-work distributed computations framework...
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
This file includes header files with various definitions of full cubes and defines the standard types...
This is the main header file in the MultiWork group which includes all the other header files.
void setstreams(const char *logfilename, char *seqfilename, bool quiet, bool debug)
Sets the parameters of the output streams depending on the file names acquired from the command line.
void argstreams(arguments &a, char *&logfilename, char *&seqfilename, bool &quiet, bool &debug)
Adds typical command line arguments for manipulating output streams.
void ignoreline(std::istream &in)
Ignores the input characters until the end of a line, including this end of the line.
outputstream sout
A replacement for standard output stream, with optional logging and other features provided by the cl...
std::string commandline(int argc, char *argv[])
Returns the entire command line as a single string.
void arg(arguments &a, const char *name, type &value)
Adds a command line argument.
outputstream sbug
An output stream for writing additional debug messages.
timeused program_time
The external variable which measures the time used by the program from its start.
const char * currenttime(void)
Retrieves the current time as a pointer to a C-style string.
void ignorecomments(std::istream &in)
Ignores white characters (spaces, tabulators, CRs and LFs), as well as comments from the input text f...
void argswitch(arguments &arg, const char *name, type &value, const type &defaultvalue)
Defines a command line argument which is a switch, that is, there is no value given for it in the com...
outputstream slog
The output stream to which one can send messages for logging only.
void arghelp(arguments &a)
Adds the typical arguments which should make the program display help information.
double mwSubdivPoint(const double &left, const double &right, coord part, coord full)
Returns a subdivision point corresponding to the given fraction of the provided interval.
@ mwNoData
There is no data to be sent to workers, for example, because everything has been already sent.
@ mwReject
The data has been rejected.
@ mwError
A serious error occurred.
@ mwOk
Everything is fine.
int(* fcompute)(const double *left, const double *right, int dim, int level)
The type of a function which computes a value of interest for the given product of intervals.
int mwSubdivMain(int argc, char *argv[], const char *title, const char *helpinfo, int defaultPortNumber, int controlNumber, const double *paramLeft, const double *paramRight, int minSubdivLevel, fcompute compute)
The main procedure for running the computations in the multiwork subdivision framework.
This namespace contains the entire CHomP library interface.
This file contains the definition of a set of n-dimensional points with integer coordinates and sever...
This file contains some useful functions related to the text input/output procedures.
This file defines a simple data structure which can be used to measure time used by the program (or s...