47 #if !defined(KRATOS_DENSITY_FUNCTION_POLYNOMIAL)
48 #define KRATOS_DENSITY_FUNCTION_POLYNOMIAL
59 template<
unsigned int TDim>
67 mHeightOverR(shape_factor)
77 void ComputeWeights(std::vector<double> & distances, std::vector<double> & nodal_areas, std::vector<double> & weights)
79 double total_nodal_area_inv = 0.0;
81 for (
unsigned int i = 0;
i != distances.size(); ++
i){
82 total_nodal_area_inv += nodal_areas[
i];
85 total_nodal_area_inv = 1.0 / total_nodal_area_inv;
87 double sum_of_weights_inv = 0.0;
89 for (
unsigned int i = 0;
i != distances.size(); ++
i){
90 double radius_2 = distances[
i] * distances[
i];
91 double weight = nodal_areas[
i] * (m6 * std::pow(radius_2, 3) + m6 * m2 * radius_2 + m0);
93 sum_of_weights_inv += weight;
96 sum_of_weights_inv = 1.0 / sum_of_weights_inv;
99 for (
unsigned int i = 0;
i != distances.size(); ++
i){
100 weights[
i] *= sum_of_weights_inv;
104 void ComputeWeights(std::vector<double> & distances, std::vector<double> & nodal_areas,
const double max_nodal_area_inv, std::vector<double> & weights)
106 double total_nodal_area_inv = 0.0;
108 for (
unsigned int i = 0;
i != distances.size(); ++
i){
109 total_nodal_area_inv += nodal_areas[
i];
112 total_nodal_area_inv = 1.0 / total_nodal_area_inv;
114 double sum_of_weights_inv = 0.0;
116 for (
unsigned int i = 0;
i != distances.size(); ++
i){
117 double radius_2 = distances[
i] * distances[
i];
121 weight = nodal_areas[
i] * ((radius_2 > r * r) ? 0.0 : m6 * std::pow(radius_2, 3) + m6 * m2 * radius_2 + m0);
123 sum_of_weights_inv += weight;
126 if(std::abs(sum_of_weights_inv) < std::numeric_limits<double>::epsilon()) sum_of_weights_inv = 0.0;
127 else sum_of_weights_inv = 1.0 / sum_of_weights_inv;
131 for (
unsigned int i = 0;
i != distances.size(); ++
i){
132 weights[
i] *= sum_of_weights_inv;
147 return 7/(16*std::pow(mR, 7));
152 return -15*(std::pow(mR, 2) + 2)*std::exp(std::pow(mR, 2)/2)/(2*std::pow(mR, 4)*(2*std::pow(mR, 3)*std::exp(std::pow(mR, 2)/2) + 14*mR*std::exp(std::pow(mR, 2)/2) - 15*std::sqrt(2)*std::sqrt(
Globals::Pi)*std::exp(std::pow(mR, 2))*erf(std::sqrt(2)*mR/2)));
157 return -3*std::pow(mR, 4);
Definition: density_function.h:59
Definition: density_function_polynomial.h:61
DensityFunctionPolynomial(const double range, const double shape_factor)
Definition: density_function_polynomial.h:65
virtual ~DensityFunctionPolynomial()
Definition: density_function_polynomial.h:75
void ComputeWeights(std::vector< double > &distances, std::vector< double > &nodal_areas, const double max_nodal_area_inv, std::vector< double > &weights)
Definition: density_function_polynomial.h:104
void ComputeWeights(std::vector< double > &distances, std::vector< double > &nodal_areas, std::vector< double > &weights)
Definition: density_function_polynomial.h:77
KRATOS_CLASS_POINTER_DEFINITION(DensityFunctionPolynomial)
constexpr double Pi
Definition: global_variables.h:25
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
integer i
Definition: TensorModule.f:17