gctl/lib/algorithm/algorithm_func.h

139 lines
5.9 KiB
C
Raw Normal View History

2024-09-10 15:45:07 +08:00
/********************************************************
*
*
*
*
*
*
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2023 Yi Zhang (yizhang-geo@zju.edu.cn)
*
* GCTL is distributed under a dual licensing scheme. You can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 2
* of the License, or (at your option) any later version. You should have
* received a copy of the GNU Lesser General Public License along with this
* program. If not, see <http://www.gnu.org/licenses/>.
*
* If the terms and conditions of the LGPL v.2. would prevent you from using
* the GCTL, please consider the option to obtain a commercial license for a
* fee. These licenses are offered by the GCTL's original author. As a rule,
* licenses are provided "as-is", unlimited in time for a one time fee. Please
* send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget
* to include some description of your company and the realm of its activities.
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#ifndef _GCTL_ALGORITHM_FUNC_H
#define _GCTL_ALGORITHM_FUNC_H
#include "../core/array.h"
#include "../core/matrix.h"
2024-09-13 10:08:41 +08:00
#include "../maths/mathfunc.h"
2024-09-10 15:45:07 +08:00
namespace gctl
{
/**
* @brief
*
* @param dis_vec
* @param val_vec
* @param[in] order 1
*
* @return
*/
double dist_inverse_weight(std::vector<double> *dis_vec, std::vector<double> *val_vec, int order = 1);
/**
* @brief
*
* @param[in] in_array
* @param[in] array_size
* @param[in] in_val
* @param index
*
* @return 0-1
*/
int find_index(const double *in_array, int array_size, double in_val, int &index);
/**
* @brief
*
* @param in_array
* @param[in] in_val
* @param index
*
* @return 0-1
*/
int find_index(array<double> *in_array, double in_val, int &index);
/**
* @brief
*
* @param out_arr
* @param[in] l_val
* @param[in] r_val
* @param[in] maxi_range
* @param[in] smoothness
*/
void fractal_model_1d(array<double> &out_arr, int out_size, double l_val,
double r_val, double maxi_range, double smoothness);
/**
* @brief
*
* @param out_arr
* @param[in] dl_val
* @param[in] dr_val
* @param[in] ul_val
* @param[in] ur_val
* @param[in] maxi_range
* @param[in] smoothness
*/
void fractal_model_2d(_2d_matrix &out_arr, int r_size, int c_size, double dl_val,
double dr_val, double ul_val, double ur_val, double maxi_range, double smoothness, unsigned int seed = 0);
/**
* @brief 使
*
*
*
* @param[in] in
* @param diff
* @param[in] spacing
* @param[in] order 14使
*/
void difference_1d(const array<double> &in, array<double> &diff, double spacing, int order = 1);
/**
* @brief 使
*
*
*
* @param[in] in
* @param diff
* @param[in] spacing
* @param[in] d_type
* @param[in] order 14使
*/
void difference_2d(const _2d_matrix &in, _2d_matrix &diff, double spacing, gradient_type_e d_type, int order = 1);
/**
* @brief 使
*
*
*
* @param[in] in
* @param diff
* @param[in] row_size
* @param[in] col_size
* @param[in] spacing
* @param[in] d_type
* @param[in] order 14使
*/
void difference_2d(const array<double> &in, array<double> &diff, int row_size, int col_size,
double spacing, gradient_type_e d_type, int order = 1);
}
#endif // _GCTL_ALGORITHM_FUNC_H