2010-06-28 16:05:03 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef USEFUL_H
|
|
|
|
#define USEFUL_H
|
|
|
|
|
2010-10-05 15:24:36 +00:00
|
|
|
#include <vector>
|
2012-02-02 10:40:42 +00:00
|
|
|
#include <string>
|
2010-10-05 15:24:36 +00:00
|
|
|
|
2010-06-28 16:05:03 +00:00
|
|
|
//! Calc the nyquist number of timesteps for a given frequency and timestep
|
|
|
|
unsigned int CalcNyquistNum(double fmax, double dT);
|
|
|
|
|
2011-11-08 10:49:14 +00:00
|
|
|
//! Calc the highest frequency allowed for a given nyquist number of timesteps and timestep
|
|
|
|
double CalcNyquistFrequency(unsigned int nyquist, double dT);
|
|
|
|
|
2010-10-05 15:24:36 +00:00
|
|
|
//! Calculate an optimal job distribution to a given number of threads. Will return a vector with the jobs for each thread.
|
|
|
|
std::vector<unsigned int> AssignJobs2Threads(unsigned int jobs, unsigned int nrThreads, bool RemoveEmpty=false);
|
|
|
|
|
2012-02-02 10:40:42 +00:00
|
|
|
std::vector<float> SplitString2Float(std::string str, std::string delimiter=",");
|
2012-09-17 09:51:19 +00:00
|
|
|
std::vector<double> SplitString2Double(std::string str, std::string delimiter=",");
|
2012-02-02 10:40:42 +00:00
|
|
|
|
2013-06-10 14:19:01 +00:00
|
|
|
bool CrossProd(const double* v1, const double* v2, double* out);
|
|
|
|
double ScalarProd(const double* v1, const double* v2);
|
2013-06-05 09:44:51 +00:00
|
|
|
|
2013-06-10 14:19:01 +00:00
|
|
|
double Determinant(const double* mat);
|
|
|
|
double* Invert(const double* in, double* out);
|
|
|
|
|
|
|
|
int LinePlaneIntersection(const double *p0, const double* p1, const double* p2, const double* l_start, const double* l_stop, double* is_point, double &dist);
|
2013-06-05 09:44:51 +00:00
|
|
|
|
2019-12-30 16:12:51 +00:00
|
|
|
#ifndef __GNUC__
|
|
|
|
int gettimeofday(struct timeval* tp, struct timezone* tzp);
|
|
|
|
#endif // _WIN32
|
|
|
|
|
2010-06-28 16:05:03 +00:00
|
|
|
#endif // USEFUL_H
|