Commit 73160667 authored by COULAUD Olivier's avatar COULAUD Olivier

new improvments

parent 2125bb43
......@@ -122,8 +122,8 @@ int main(int argc, char* argv[])
typedef FUnifKernel<FReal,CellClass,ContainerClass,MatrixKernelClass,ORDER> KernelClass;
//
#ifdef _OPENMP
// typedef FFmmAlgorithmThread<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
typedef FFmmAlgorithmSectionTask<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
//typedef FFmmAlgorithmThread<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
typedef FFmmAlgorithmSectionTask<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
#else
typedef FFmmAlgorithm<OctreeClass,CellClass,ContainerClass,KernelClass,LeafClass> FmmClass;
#endif
......
......@@ -259,23 +259,36 @@ FReal plummerDist(FSize& cpt, const FReal &R) {
*/
template <class FReal>
void unifRandomPlummer(const FSize N, const FReal R, FReal * points) {
constexpr const FReal rand_max = 0.8;
constexpr const FReal r_max = std::sqrt(1.0/(std::pow(rand_max, -2.0/3.0) - 1.0));
unifRandomPointsOnSphere<FReal>(N, 1, points);
FReal mc = 1.0/static_cast<FReal>(N);
for (FSize i = 0, j = 0 ; i< N ; ++i, j+=4) {
FReal m = getRandom<FReal>();
while(m > rand_max) {
m = getRandom<FReal>();
}
FReal r = FMath::Sqrt(1.0/(FMath::pow(m, -2.0/3.0) - 1.0)) / r_max * R;
FReal m = getRandom<FReal>();
FReal r = FMath::Sqrt( 1.0/(FMath::pow(m, -2.0/3.0) - 1.0)) ;
points[j] *= r;
points[j+1] *= r;
points[j+2] *= r;
points[j+3] = mc; // the mass
}
}
// template <class FReal>
// void unifRandomPlummer(const FSize N, const FReal R, FReal * points) {
// constexpr const FReal rand_max = 0.8;
// constexpr const FReal r_max = std::sqrt(1.0/(std::pow(rand_max, -2.0/3.0) - 1.0));
// unifRandomPointsOnSphere<FReal>(N, 1, points);
// FReal mc = 1.0/static_cast<FReal>(N);
// for (FSize i = 0, j = 0 ; i< N ; ++i, j+=4) {
// FReal m = getRandom<FReal>();
// while(m > rand_max) {
// m = getRandom<FReal>();
// }
// FReal r = FMath::Sqrt(1.0/(FMath::pow(m, -2.0/3.0) - 1.0)) / r_max * R;
// points[j] *= r;
// points[j+1] *= r;
// points[j+2] *= r;
// points[j+3] = mc; // the mass
// }
// }
/**
* \brief Build N points following the Plummer like distribution
*
......
......@@ -215,6 +215,7 @@ public:
if(ChildParentInterpolator[l][child] != nullptr)
delete [] ChildParentInterpolator[l][child];
delete [] ChildParentInterpolator[l];
}
delete [] ChildParentInterpolator;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment