Scienza / Schroedinger

A Schroedinger Equation solver in C++, with flexible basis definition
GNU Lesser General Public License v2.1
31 stars 9 forks source link

States class #47

Closed GabrielePisciotta closed 5 years ago

AndreaIdini commented 5 years ago

In the future we would like to have a class "States" where to store (and retrieve) all the state's properties and relative routines, in the present version composed of:

                std::vector<double> getWavefunction();
                std::vector<double> getProbability();
      double getSolutionEnergy();

and

                 double solutionEnergy;
                 std::vector<double> wavefunction;
                 std::vector<double> tempWavefunction;
                 std::vector<double> probability;
                 void multiplyWavefunction();
                 double findEnergy(double, double, double, std::vector<double>&);
                 void normalize();
                 std::vector<double> findProbability();

and probably

                void printToFile();
          friend std::ostream& operator<< (std::ostream& stream, Numerov& solver);

That is, some public and all current private attributes in class Numerov, apart from bisection (which can go to a mathematical class).

In other words, what is currently the Numerov class imho should mainly be the States to form a "data structure", apart from the solve method and findWavefunction that is the actual Numerov algorithm(and eventually and temporarily bisection and trapezoidal rules). These two method and function should belong to a larger class, named Solver or something to that effect.

Again, this is for the future, but is one of the few things I would like to see before going MVP.

After doing this go to #49

GabrielePisciotta commented 5 years ago

Implemented