1#ifndef __FIBER_BASEOP_POINTDISTRIBUTIONTENSOR_HPP
2#define __FIBER_BASEOP_POINTDISTRIBUTIONTENSOR_HPP
4#include "PointCloudIpol.hpp"
6#include "elementary/eagle/EigenVectors.hpp"
18inline Eagle::PhysicalSpace::tvector getWeightedVec(
const Eagle::PhysicalSpace::tvector& vec,
double radius )
24inline Eagle::PhysicalSpace::tvector getWeightedVec<LINEAR>(
const Eagle::PhysicalSpace::tvector& vec,
double radius )
26const double len =
norm(vec);
27 return vec * (1 - len/radius );
30inline Eagle::PhysicalSpace::tvector getWeightedVec<SQUARE>(
const Eagle::PhysicalSpace::tvector& vec,
double radius )
32const double len =
norm(vec);
36 return Eagle::PhysicalSpace::tvector(0,0,0);
39inline Eagle::PhysicalSpace::tvector getWeightedVec<SSQUARE>(
const Eagle::PhysicalSpace::tvector& vec,
double radius )
41const double len =
norm(vec);
45 return Eagle::PhysicalSpace::tvector(0,0,0);
48inline Eagle::PhysicalSpace::tvector getWeightedVec<SPHCUBIC>(
const Eagle::PhysicalSpace::tvector& vec,
double radius )
50const double len =
norm(vec);
51 return vec * PointCloud::sph_cubic( len / radius * 2.0 );
54inline Eagle::PhysicalSpace::tvector getWeightedVec<SPHQUARTIC>(
const Eagle::PhysicalSpace::tvector& vec,
double radius )
56const double len =
norm(vec);
57 return vec * PointCloud::sph_quartic( len / radius * 2.5 );
60inline Eagle::PhysicalSpace::tvector getWeightedVec<SPHQUINTIC>(
const Eagle::PhysicalSpace::tvector& vec,
double radius )
62const double len =
norm(vec);
63 return vec * PointCloud::sph_quintic( len / radius * 3.0 );
84template<
int N,
class C>
87 const MultiIndex<1>& mi,
89 const double& radius )
103 if(
std::fabs((*it).first < 1.0e-4) )
continue;
104 if( j ==
size )
break;
106 Eagle::PhysicalSpace::tvector vec = crds[ (*it).second ] - crds[ind];
108 vec = getWeightedVec<N>(vec, radius);
116 tmp *= 1.0 / double(j);
121template<
int N,
class C>
122Eagle::metric33 computePointDistributionTensor(
const C& crds,
123 const MultiIndex<1>& mi,
124 const unsigned&
size,
125 const double& radius)
135 for (
unsigned i = 0; i <
size; i++)
137 Eagle::PhysicalSpace::tvector vec = crds[ i ] - crds[ mi[0] ];
142 vec = getWeightedVec<N>(vec, radius);
147 tmp *= 1.0 / double(
size);
153template<
int N,
class C>
154Eagle::metric33 computePointDistributionTensor(
const C& crds,
156 const unsigned&
size,
157 const double& radius)
167 for (
unsigned i = 0; i <
size; i++)
169 Eagle::PhysicalSpace::tvector vec = crds[ i ] - p;
174 vec = getWeightedVec<N>(vec, radius);
179 tmp *= 1.0 / double(
size);
183template <
int N,
class value>
186double denominator = Evalues[0]+Evalues[1]+Evalues[2];
191 return 2*(Evalues[1] - Evalues[0]) / denominator;
194template <
int N,
class value>
197double denominator = Evalues[0]+Evalues[1]+Evalues[2];
202 return (Evalues[2] - Evalues[1]) / denominator;
205template <
int N,
class value>
208double denominator = Evalues[0]+Evalues[1]+Evalues[2];
213 return 3*(Evalues[0]) / denominator;
220 const double& radius);
226 const double& radius);
232 const double& radius);
valarray< size_t > size() const
_Tp fabs(const std::complex< _Tp > &__z)
const_iterator end() const noexcept
const_iterator begin() const noexcept
Metric dyadic(const vector &a, const vector &b)
double norm(const PhysicalSpace::bivector &v)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2