Templatized SPHSmooth. Reduced memory consumption of simple3DFilter
This commit is contained in:
parent
81f4b642e4
commit
d23f79cbaf
3 changed files with 84 additions and 64 deletions
|
@ -82,10 +82,14 @@ namespace CosmoTool
|
|||
return internal.currentCenter;
|
||||
}
|
||||
|
||||
template<typename FuncT>
|
||||
ComputePrecision computeSmoothedValue(const typename SPHTree::coords& c,
|
||||
computeParticleValue fun, SPHState *state = 0);
|
||||
FuncT fun, SPHState *state = 0);
|
||||
|
||||
template<typename FuncT>
|
||||
ComputePrecision computeInterpolatedValue(const typename SPHTree::coords& c,
|
||||
computeParticleValue fun, SPHState *state = 0);
|
||||
FuncT fun, SPHState *state = 0);
|
||||
|
||||
ComputePrecision getMaxDistance(const typename SPHTree::coords& c,
|
||||
SPHNode *node) const;
|
||||
|
||||
|
@ -101,7 +105,8 @@ namespace CosmoTool
|
|||
}
|
||||
// END
|
||||
|
||||
void runForEachNeighbour(runParticleValue fun, SPHState *state = 0);
|
||||
template<typename FuncT>
|
||||
void runForEachNeighbour(FuncT fun, SPHState *state = 0);
|
||||
void addGridSite(const typename SPHTree::coords& c);
|
||||
|
||||
bool hasNeighbours() const;
|
||||
|
@ -127,12 +132,15 @@ namespace CosmoTool
|
|||
uint32_t maxNgb;
|
||||
SPHTree *tree;
|
||||
|
||||
template<typename FuncT>
|
||||
ComputePrecision computeWValue(const typename SPHTree::coords & c,
|
||||
SPHCell& cell,
|
||||
CoordType d,
|
||||
computeParticleValue fun, SPHState *state);
|
||||
FuncT fun, SPHState *state);
|
||||
|
||||
template<typename FuncT>
|
||||
void runUnrollNode(SPHNode *node,
|
||||
runParticleValue fun);
|
||||
FuncT fun);
|
||||
};
|
||||
|
||||
template<class ValType1, class ValType2, int Ndims>
|
||||
|
|
|
@ -21,10 +21,11 @@ SPHSmooth<ValType,Ndims>::~SPHSmooth()
|
|||
}
|
||||
|
||||
template<typename ValType, int Ndims>
|
||||
template<typename FuncT>
|
||||
ComputePrecision SPHSmooth<ValType,Ndims>::computeWValue(const typename SPHTree::coords& c,
|
||||
SPHCell& cell,
|
||||
CoordType d,
|
||||
computeParticleValue fun, SPHState *state)
|
||||
FuncT fun, SPHState *state)
|
||||
{
|
||||
CoordType weight;
|
||||
|
||||
|
@ -117,9 +118,10 @@ SPHSmooth<ValType,Ndims>::fetchNeighboursOnVolume(const typename SPHTree::coords
|
|||
}
|
||||
|
||||
template<typename ValType, int Ndims>
|
||||
template<typename FuncT>
|
||||
ComputePrecision
|
||||
SPHSmooth<ValType,Ndims>::computeSmoothedValue(const typename SPHTree::coords& c,
|
||||
computeParticleValue fun, SPHState *state)
|
||||
FuncT fun, SPHState *state)
|
||||
{
|
||||
if (state == 0)
|
||||
state = &internal;
|
||||
|
@ -144,8 +146,9 @@ ComputePrecision interpolateOne(const ValType& t)
|
|||
|
||||
// WARNING ! Cell's weight must be 1 !!!
|
||||
template<typename ValType, int Ndims>
|
||||
template<typename FuncT>
|
||||
ComputePrecision SPHSmooth<ValType,Ndims>::computeInterpolatedValue(const typename SPHTree::coords& c,
|
||||
computeParticleValue fun, SPHState *state)
|
||||
FuncT fun, SPHState *state)
|
||||
{
|
||||
if (state == 0)
|
||||
state = &internal;
|
||||
|
@ -164,7 +167,8 @@ ComputePrecision SPHSmooth<ValType,Ndims>::computeInterpolatedValue(const typena
|
|||
}
|
||||
|
||||
template<typename ValType, int Ndims>
|
||||
void SPHSmooth<ValType,Ndims>::runForEachNeighbour(runParticleValue fun, SPHState *state)
|
||||
template<typename FuncT>
|
||||
void SPHSmooth<ValType,Ndims>::runForEachNeighbour(FuncT fun, SPHState *state)
|
||||
{
|
||||
if (state == 0)
|
||||
state = &internal;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue