Merge branch 'master' of file:///home/guilhem/Dropbox/gitRoot/CosmoToolbox
This commit is contained in:
commit
1d7ecf051c
@ -29,6 +29,7 @@ namespace CosmoTool
|
||||
virtual ~SPHSmooth();
|
||||
|
||||
void fetchNeighbours(const typename SPHTree::coords& c);
|
||||
void fetchNeighbours(const typename SPHTree::coords& c, uint32_t newNsph);
|
||||
void fetchNeighboursOnVolume(const typename SPHTree::coords& c, ComputePrecision radius);
|
||||
const typename SPHTree::coords& getCurrentCenter() const
|
||||
{
|
||||
|
@ -38,6 +38,38 @@ ComputePrecision SPHSmooth<ValType,Ndims>::computeWValue(const typename SPHTree:
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename ValType, int Ndims>
|
||||
void
|
||||
SPHSmooth<ValType,Ndims>::fetchNeighbours(const typename SPHTree::coords& c, uint32_t newNngb)
|
||||
{
|
||||
ComputePrecision d2, max_dist = 0;
|
||||
uint32_t requested = newNngb;
|
||||
|
||||
if (requested > maxNgb)
|
||||
{
|
||||
delete[] ngb;
|
||||
delete[] distances;
|
||||
|
||||
maxNgb = requested;
|
||||
ngb = new SPHCell *[maxNgb];
|
||||
distances = new CoordType[maxNgb];
|
||||
}
|
||||
|
||||
memcpy(currentCenter, c, sizeof(c));
|
||||
tree->getNearestNeighbours(c, requested, ngb, distances);
|
||||
|
||||
currentNgb = 0;
|
||||
for (uint32_t i = 0; i < requested && ngb[i] != 0; i++,currentNgb++)
|
||||
{
|
||||
distances[i] = sqrt(distances[i]);
|
||||
d2 = distances[i];
|
||||
if (d2 > max_dist)
|
||||
max_dist = d2;
|
||||
}
|
||||
|
||||
smoothRadius = max_dist / 2;
|
||||
}
|
||||
|
||||
template<typename ValType, int Ndims>
|
||||
void
|
||||
SPHSmooth<ValType,Ndims>::fetchNeighbours(const typename SPHTree::coords& c)
|
||||
@ -46,10 +78,10 @@ SPHSmooth<ValType,Ndims>::fetchNeighbours(const typename SPHTree::coords& c)
|
||||
uint32_t requested = Nsph;
|
||||
|
||||
memcpy(currentCenter, c, sizeof(c));
|
||||
tree->getNearestNeighbours(c, maxNgb, ngb, distances);
|
||||
tree->getNearestNeighbours(c, requested, ngb, distances);
|
||||
|
||||
currentNgb = 0;
|
||||
for (uint32_t i = 0; i < maxNgb && ngb[i] != 0; i++,currentNgb++)
|
||||
for (uint32_t i = 0; i < requested && ngb[i] != 0; i++,currentNgb++)
|
||||
{
|
||||
distances[i] = sqrt(distances[i]);
|
||||
d2 = distances[i];
|
||||
|
Loading…
Reference in New Issue
Block a user