new attractor
This commit is contained in:
parent
03771a159a
commit
70e4d283e0
3 changed files with 77 additions and 27 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "kernels/Polynomial.hpp"
|
||||
#include "kernels/PolynomialA3D.hpp"
|
||||
#include "kernels/Unravel3D.hpp"
|
||||
#include "kernels/Ikeda3D.hpp"
|
||||
|
||||
AttractorKernel* AttractorKernel::createAttractorKernel(stfu::node& attractor) {
|
||||
|
||||
|
@ -61,6 +62,13 @@ AttractorKernel* AttractorKernel::createAttractorKernel(stfu::node& attractor) {
|
|||
LogError("something wrong\n");
|
||||
exit(37);
|
||||
}
|
||||
} else if(attractorType == "ikeda") {
|
||||
if(dimension == 3) {
|
||||
myAttractor = new Ikeda3D();
|
||||
} else {
|
||||
LogError("something wrong\n");
|
||||
exit(37);
|
||||
}
|
||||
} else {
|
||||
LogError("'%s' not recognized\n", attractorType.c_str());
|
||||
exit(37);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/AwesomeAttractor" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option output="bin\Debug\AwesomeAttractor" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Debug\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
|
@ -20,8 +20,8 @@
|
|||
</Linker>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/AwesomeAttractor" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option output="bin\Release\AwesomeAttractor" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
|
@ -33,8 +33,8 @@
|
|||
</Linker>
|
||||
</Target>
|
||||
<Target title="UniRelease">
|
||||
<Option output="bin/UniRelease/AwesomeAttractor" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/UniRelease/" />
|
||||
<Option output="bin\UniRelease\AwesomeAttractor" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj\UniRelease\" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
|
@ -66,35 +66,36 @@
|
|||
<Unit filename="Projector.hpp">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="attractors/testAttractor.stf" />
|
||||
<Unit filename="attractors/testLorenz.stf" />
|
||||
<Unit filename="attractors/testPolynomial.stf" />
|
||||
<Unit filename="attractors/testUnravel.stf" />
|
||||
<Unit filename="canvae/PNG.cpp" />
|
||||
<Unit filename="canvae/PNG.hpp">
|
||||
<Unit filename="attractors\testAttractor.stf" />
|
||||
<Unit filename="attractors\testLorenz.stf" />
|
||||
<Unit filename="attractors\testPolynomial.stf" />
|
||||
<Unit filename="attractors\testUnravel.stf" />
|
||||
<Unit filename="canvae\PNG.cpp" />
|
||||
<Unit filename="canvae\PNG.hpp">
|
||||
<Option target="<{~None~}>" />
|
||||
</Unit>
|
||||
<Unit filename="canvae/Raw.cpp" />
|
||||
<Unit filename="canvae/Raw.hpp" />
|
||||
<Unit filename="canvae\Raw.cpp" />
|
||||
<Unit filename="canvae\Raw.hpp" />
|
||||
<Unit filename="defines.hpp" />
|
||||
<Unit filename="kernels/Logistic.hpp" />
|
||||
<Unit filename="kernels/Lorenz3D.hpp" />
|
||||
<Unit filename="kernels/Polynomial.hpp" />
|
||||
<Unit filename="kernels/PolynomialA3D.hpp" />
|
||||
<Unit filename="kernels/Unravel3D.hpp" />
|
||||
<Unit filename="kernels\Ikeda3D.hpp" />
|
||||
<Unit filename="kernels\Logistic.hpp" />
|
||||
<Unit filename="kernels\Lorenz3D.hpp" />
|
||||
<Unit filename="kernels\Polynomial.hpp" />
|
||||
<Unit filename="kernels\PolynomialA3D.hpp" />
|
||||
<Unit filename="kernels\Unravel3D.hpp" />
|
||||
<Unit filename="main.cpp" />
|
||||
<Unit filename="myMath.hpp" />
|
||||
<Unit filename="ostream_helpers.h" />
|
||||
<Unit filename="pngwriter/pngwriter.cc" />
|
||||
<Unit filename="pngwriter/pngwriter.h">
|
||||
<Unit filename="pngwriter\pngwriter.cc" />
|
||||
<Unit filename="pngwriter\pngwriter.h">
|
||||
<Option target="<{~None~}>" />
|
||||
</Unit>
|
||||
<Unit filename="projectors/Normalizer.cpp" />
|
||||
<Unit filename="projectors/Normalizer.hpp" />
|
||||
<Unit filename="projectors/Projection.cpp" />
|
||||
<Unit filename="projectors/Projection.hpp" />
|
||||
<Unit filename="stfu/stf.cpp" />
|
||||
<Unit filename="stfu/stf.hpp" />
|
||||
<Unit filename="projectors\Normalizer.cpp" />
|
||||
<Unit filename="projectors\Normalizer.hpp" />
|
||||
<Unit filename="projectors\Projection.cpp" />
|
||||
<Unit filename="projectors\Projection.hpp" />
|
||||
<Unit filename="stfu\stf.cpp" />
|
||||
<Unit filename="stfu\stf.hpp" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
|
|
41
kernels/Ikeda3D.hpp
Normal file
41
kernels/Ikeda3D.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef IKEDA3D_HPP
|
||||
#define IKEDA3D_HPP
|
||||
|
||||
#include "../AttractorKernel.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
class Ikeda3D : public AttractorKernel {
|
||||
private:
|
||||
void init() {
|
||||
// setting some starting values
|
||||
std::fill_n(vectorOld, dimension, 0.5);
|
||||
std::fill_n(vectorNew, dimension, 0.5);
|
||||
}
|
||||
|
||||
public:
|
||||
Ikeda3D():
|
||||
AttractorKernel(3, 1) {
|
||||
init();
|
||||
}
|
||||
|
||||
virtual std::string type() { return "ikeda"; };
|
||||
|
||||
virtual void generate_random_parameters() {
|
||||
parameters[0] = rand() / double(RAND_MAX) *2.0 - 0.5;
|
||||
init();
|
||||
}
|
||||
|
||||
virtual void operator()() {
|
||||
std::swap(vectorNew, vectorOld);
|
||||
|
||||
vectorOld[2] = 0.4 - 6.0/(1 + vectorOld[0]*vectorOld[0] + vectorOld[1]*vectorNew[1]);
|
||||
|
||||
vectorNew[0] = 1 + parameters[0] * (vectorOld[0]*cos(vectorOld[2]) - vectorOld[1]*sin(vectorOld[2]));
|
||||
vectorNew[0] = parameters[0] * (vectorOld[0]*sin(vectorOld[2]) + vectorOld[1]*cos(vectorOld[2]));
|
||||
}
|
||||
};
|
||||
|
||||
#endif // IKEDA3D_HPP
|
||||
|
Reference in a new issue