This commit is contained in:
Guilhem Lavaux 2022-11-16 16:48:31 +01:00
parent b538d4974d
commit 4633f6edc9

View File

@ -1,5 +1,5 @@
/*+
This is CosmoTool (./src/sphSmooth.hpp) -- Copyright (C) Guilhem Lavaux (2007-2014)
This is CosmoTool (./src/sphSmooth.hpp) -- Copyright (C) Guilhem Lavaux (2007-2022)
guilhem.lavaux@gmail.com
@ -39,14 +39,11 @@ knowledge of the CeCILL license and that you accept its terms.
#include "config.hpp"
#include "mykdtree.hpp"
namespace CosmoTool
{
namespace CosmoTool {
template <typename ValType, int Ndims = NUMDIMS>
class SPHSmooth
{
class SPHSmooth {
public:
typedef struct
{
typedef struct {
ComputePrecision weight;
ValType pValue;
} FullType;
@ -61,8 +58,7 @@ namespace CosmoTool
public:
typedef SPHCell *P_SPHCell;
struct SPHState
{
struct SPHState {
boost::shared_ptr<P_SPHCell[]> ngb;
boost::shared_ptr<CoordType[]> distances;
typename SPHTree::coords currentCenter;
@ -70,40 +66,34 @@ namespace CosmoTool
ComputePrecision smoothRadius;
};
SPHSmooth(SPHTree *tree, uint32_t Nsph);
virtual ~SPHSmooth();
void fetchNeighbours(const typename SPHTree::coords& c, SPHState *state = 0);
void
fetchNeighbours(const typename SPHTree::coords &c, SPHState *state = 0);
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
{
void fetchNeighboursOnVolume(
const typename SPHTree::coords &c, ComputePrecision radius);
const typename SPHTree::coords &getCurrentCenter() const {
return internal.currentCenter;
}
template <typename FuncT>
ComputePrecision computeSmoothedValue(const typename SPHTree::coords& c,
FuncT fun, SPHState *state = 0);
ComputePrecision computeSmoothedValue(
const typename SPHTree::coords &c, FuncT fun, SPHState *state = 0);
template <typename FuncT>
ComputePrecision computeInterpolatedValue(const typename SPHTree::coords& c,
FuncT fun, SPHState *state = 0);
ComputePrecision computeInterpolatedValue(
const typename SPHTree::coords &c, FuncT fun, SPHState *state = 0);
ComputePrecision getMaxDistance(const typename SPHTree::coords& c,
SPHNode *node) const;
ComputePrecision
getMaxDistance(const typename SPHTree::coords &c, SPHNode *node) const;
ComputePrecision getSmoothingLen() const
{
return internal.smoothRadius;
}
ComputePrecision getSmoothingLen() const { return internal.smoothRadius; }
// TO USE WITH EXTREME CARE !
void setSmoothingLen(ComputePrecision len)
{
internal.smoothRadius = len;
}
void setSmoothingLen(ComputePrecision len) { internal.smoothRadius = len; }
// END
template <typename FuncT>
@ -135,20 +125,20 @@ namespace CosmoTool
SPHTree *tree;
template <typename FuncT>
ComputePrecision computeWValue(const typename SPHTree::coords & c,
SPHCell& cell,
CoordType d,
ComputePrecision computeWValue(
const typename SPHTree::coords &c, SPHCell &cell, CoordType d,
FuncT fun, SPHState *state);
template <typename FuncT>
void runUnrollNode(SPHNode *node,
FuncT fun);
void runUnrollNode(SPHNode *node, FuncT fun);
};
template <class ValType1, class ValType2, int Ndims>
bool operator<(const SPHSmooth<ValType1, Ndims>& s1, const SPHSmooth<ValType2, Ndims>& s2);
bool operator<(
const SPHSmooth<ValType1, Ndims> &s1,
const SPHSmooth<ValType2, Ndims> &s2);
};
}; // namespace CosmoTool
#include "sphSmooth.tcc"