Skip to content
Snippets Groups Projects
Commit ad55a66f authored by Van Dung Nguyen's avatar Van Dung Nguyen
Browse files

change

parent c869eabd
No related branches found
No related tags found
No related merge requests found
...@@ -184,28 +184,28 @@ bool eigenSolver::solve(int numEigenValues, std::string which) ...@@ -184,28 +184,28 @@ bool eigenSolver::solve(int numEigenValues, std::string which)
} }
void eigenSolver::normalize_mode(){ void eigenSolver::normalize_mode(double scale){
Msg::Info("Normalize all eigenvectors"); Msg::Info("Normalize all eigenvectors");
for (unsigned int i=0; i<_eigenVectors.size(); i++){ for (unsigned int i=0; i<_eigenVectors.size(); i++){
double norm = 0.; double norm = 0.;
for (unsigned int j=0; j<_eigenVectors[i].size(); j++){ for (unsigned int j=0; j<_eigenVectors[i].size(); j++){
std::complex<double> val = _eigenVectors[i][j]; std::complex<double> val = _eigenVectors[i][j];
double normval = std::abs(val); double normval = std::abs(val);
if (normval >norm) if (normval >norm)
norm = normval; norm = normval;
}; };
if (norm == 0) { if (norm == 0) {
Msg::Error("zero eigenvector"); Msg::Error("zero eigenvector");
return; return;
}; };
for (unsigned int j=0; j<_eigenVectors[i].size(); j++){ for (unsigned int j=0; j<_eigenVectors[i].size(); j++){
_eigenVectors[i][j] /= norm; _eigenVectors[i][j] *= (scale/norm);
}; };
}; };
}; };
#endif #endif
...@@ -42,7 +42,7 @@ class eigenSolver{ ...@@ -42,7 +42,7 @@ class eigenSolver{
return _eigenVectors[num][com]; return _eigenVectors[num][com];
}; };
int getNumberEigenvectors() {return _eigenVectors.size();}; int getNumberEigenvectors() {return _eigenVectors.size();};
void normalize_mode(); void normalize_mode(double scale=1.);
}; };
#else #else
...@@ -68,7 +68,7 @@ class eigenSolver{ ...@@ -68,7 +68,7 @@ class eigenSolver{
void clear(){} void clear(){}
std::complex<double> getEigenVectorComp(int num, int com) { return 0.; } std::complex<double> getEigenVectorComp(int num, int com) { return 0.; }
int getNumberEigenvectors() {return 0;}; int getNumberEigenvectors() {return 0;};
void normalize_mode() {}; void normalize_mode(double scale=1.) {};
}; };
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment