|
|
@ -1,3 +1,4 @@ |
|
|
|
#include "Logger.hpp" |
|
|
|
#include <iostream> |
|
|
|
#include <ctime> |
|
|
|
#include <valarray> |
|
|
@ -9,10 +10,25 @@ |
|
|
|
|
|
|
|
#include "defines.hpp" |
|
|
|
|
|
|
|
int main(int argc, char *argv[]) { |
|
|
|
|
|
|
|
int verbose; |
|
|
|
|
|
|
|
void showHelpText(){ |
|
|
|
std::cout << "Awesome Attractor, version " << __DATE__ << std::endl; |
|
|
|
std::cout << "Usage: AwesomeAttractor [OPTION]... FILE" << std::endl << std::endl; |
|
|
|
std::cout << "Optons:" << std::endl; |
|
|
|
std::cout << " --help Shows this help" << std::endl; |
|
|
|
std::cout << " -q quiet mode" << std::endl; |
|
|
|
std::cout << " -v verbose mode" << std::endl; |
|
|
|
std::cout << " -V loud mode" << std::endl; |
|
|
|
std::cout << " -w N Sets width of output image to N" << std::endl; |
|
|
|
std::cout << " -h N Sets height of output image to N" << std::endl; |
|
|
|
std::cout << " -i N Sets number of iterations to N" << std::endl; |
|
|
|
exit(0); |
|
|
|
} |
|
|
|
|
|
|
|
bool verbose = false; |
|
|
|
int main(int argc, char *argv[]) { |
|
|
|
verbose = 0; |
|
|
|
std::string attractorFile = DEFAULT_ATTRACTOR_FILE; |
|
|
|
unsigned int iterations = DEFAULT_ITERATIONS; |
|
|
|
unsigned int width = DEFAULT_WIDTH; |
|
|
@ -20,7 +36,13 @@ int main(int argc, char *argv[]) { |
|
|
|
|
|
|
|
for ( int i = 1; i < argc; ++i ) { |
|
|
|
if ( strcmp(argv[i], "-v") == 0 ) { |
|
|
|
verbose = true; |
|
|
|
verbose = 1; |
|
|
|
} else if ( strcmp(argv[i], "-q") == 0 ) { |
|
|
|
verbose = -1; |
|
|
|
} else if ( strcmp(argv[i], "--help") == 0 ) { |
|
|
|
showHelpText(); |
|
|
|
} else if ( strcmp(argv[i], "-V") == 0 ) { |
|
|
|
verbose = 3; |
|
|
|
} else if ( strcmp(argv[i], "-w") == 0 ) { |
|
|
|
width = atoi(argv[++i]); |
|
|
|
} else if ( strcmp(argv[i], "-h") == 0 ) { |
|
|
@ -32,6 +54,8 @@ int main(int argc, char *argv[]) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
LogInfo("Awesome Attractor, version %s\n", __DATE__); |
|
|
|
|
|
|
|
// initialising stuff
|
|
|
|
Attractor myAttractor(attractorFile); |
|
|
|
|
|
|
@ -44,6 +68,8 @@ int main(int argc, char *argv[]) { |
|
|
|
|
|
|
|
projection.output(); |
|
|
|
|
|
|
|
LogInfo("\nRendering\n"); |
|
|
|
|
|
|
|
clock_t start, end; |
|
|
|
start = clock(); |
|
|
|
for ( unsigned int j = 1; j <= 100; ++j ) { |
|
|
@ -51,14 +77,16 @@ int main(int argc, char *argv[]) { |
|
|
|
myAttractor.iterate(); |
|
|
|
myAttractor.plot(); |
|
|
|
} |
|
|
|
if ( verbose >= 0 ) { |
|
|
|
std::cout << "\r" << j << "% done" << std::flush; |
|
|
|
} |
|
|
|
} |
|
|
|
end = clock(); |
|
|
|
|
|
|
|
double totalIterations = 100.0*iterations; |
|
|
|
double totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); |
|
|
|
std::cout << std::endl << "total clock time: " << totalTime << std::endl; |
|
|
|
std::cout << "average iterations per second: " << totalIterations/totalTime << std::endl << std::endl; |
|
|
|
LogInfo("\nTotal clock time: %f\n", totalTime); |
|
|
|
LogMoreInfo("Average iterations per second: %f\n\n", totalIterations/totalTime); |
|
|
|
|
|
|
|
// saving output
|
|
|
|
start = clock(); |
|
|
@ -67,7 +95,7 @@ int main(int argc, char *argv[]) { |
|
|
|
|
|
|
|
totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); |
|
|
|
|
|
|
|
std::cout << "total clock time for writing png: " << totalTime << std::endl; |
|
|
|
LogInfo("Total clock time for writing png: %f\n", totalTime); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|