|
|
@ -16,7 +16,7 @@ |
|
|
|
|
|
|
|
AttractorKernel::AttractorKernel(const unsigned int dimension, const unsigned int numberOfParameters) : |
|
|
|
numberOfParameters(numberOfParameters), dimension(dimension){ |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
allocate(); |
|
|
|
} |
|
|
@ -24,7 +24,7 @@ numberOfParameters(numberOfParameters), dimension(dimension){ |
|
|
|
std::cout << "Couldn't construct AttractorKernel: " << e.what() << std::endl; |
|
|
|
dealloc(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::fill_n(parameters, numberOfParameters, 0.0); |
|
|
|
std::fill_n(vectorNew, dimension, 0.0); |
|
|
|
std::fill_n(vectorOld, dimension, 0.0); |
|
|
@ -93,22 +93,22 @@ unsigned int AttractorKernel::getDimension() const{ |
|
|
|
#include "kernels/Unravel3D.hpp" |
|
|
|
|
|
|
|
AttractorKernel * AttractorKernel::createAttractorKernel(stfu::node& attractor){ |
|
|
|
|
|
|
|
|
|
|
|
AttractorKernel * myAttractor = NULL; |
|
|
|
|
|
|
|
|
|
|
|
// reading basic stuff
|
|
|
|
const std::string attractorType = attractor.getValue("type"); |
|
|
|
const std::string attractorDimension = attractor.getValue("dimensions"); |
|
|
|
|
|
|
|
|
|
|
|
// for ( unsigned int i = 0; attractorType[i] != '\0'; i++ ) {
|
|
|
|
// attractorType[i] = tolower(attractorType[i]);
|
|
|
|
// }
|
|
|
|
const unsigned int dimension = atoi(attractorDimension.c_str()); |
|
|
|
|
|
|
|
|
|
|
|
std::cout << " Formula: " << attractorType << std::endl; |
|
|
|
std::cout << " Dimensions: " << dimension << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// depending on type, make the formula object
|
|
|
|
if ( attractorType == "lorenz" ){ |
|
|
|
if ( dimension == 3 ) { |
|
|
@ -122,7 +122,7 @@ AttractorKernel * AttractorKernel::createAttractorKernel(stfu::node& attractor){ |
|
|
|
const unsigned int orde = atoi(attractorOrde.c_str()); |
|
|
|
std::cout << " Orde: " << orde << std::endl; |
|
|
|
myAttractor = new Polynomial(dimension, orde); |
|
|
|
|
|
|
|
|
|
|
|
} else if ( attractorType == "polynomial a" ) { |
|
|
|
if ( dimension == 3 ) { |
|
|
|
myAttractor = new PolynomialA3D(); |
|
|
@ -143,19 +143,19 @@ AttractorKernel * AttractorKernel::createAttractorKernel(stfu::node& attractor){ |
|
|
|
std::cout << "'" << attractorType << "' not recognized" << std::endl; |
|
|
|
exit(3); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// read parameters
|
|
|
|
const unsigned int numberOfParameters = myAttractor->getNumberOfParameters(); |
|
|
|
|
|
|
|
|
|
|
|
for ( unsigned int i = 0; i < numberOfParameters; i++ ) { |
|
|
|
stfu::node attractorParameters = attractor.getChild("parameters"); |
|
|
|
(*myAttractor)[i] = atof(attractorParameters.getValue(i).c_str()); |
|
|
|
std::cout << " Parameter " << i << " set to " << (*myAttractor)[i] << ", "; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::cout << std::endl << " Reading file complete" << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
return myAttractor; |
|
|
|
} |
|
|
|
|
|
|
|