Reformat
This commit is contained in:
parent
b538d4974d
commit
4633f6edc9
@ -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
|
guilhem.lavaux@gmail.com
|
||||||
|
|
||||||
@ -39,30 +39,26 @@ knowledge of the CeCILL license and that you accept its terms.
|
|||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "mykdtree.hpp"
|
#include "mykdtree.hpp"
|
||||||
|
|
||||||
namespace CosmoTool
|
namespace CosmoTool {
|
||||||
{
|
|
||||||
template <typename ValType, int Ndims = NUMDIMS>
|
template <typename ValType, int Ndims = NUMDIMS>
|
||||||
class SPHSmooth
|
class SPHSmooth {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
ComputePrecision weight;
|
ComputePrecision weight;
|
||||||
ValType pValue;
|
ValType pValue;
|
||||||
} FullType;
|
} FullType;
|
||||||
|
|
||||||
typedef KDTree<Ndims,FullType> SPHTree;
|
typedef KDTree<Ndims, FullType> SPHTree;
|
||||||
typedef KDTreeNode<Ndims,FullType> SPHNode;
|
typedef KDTreeNode<Ndims, FullType> SPHNode;
|
||||||
typedef KDCell<Ndims,FullType> SPHCell;
|
typedef KDCell<Ndims, FullType> SPHCell;
|
||||||
typedef typename KDTree<Ndims,FullType>::CoordType CoordType;
|
typedef typename KDTree<Ndims, FullType>::CoordType CoordType;
|
||||||
|
|
||||||
typedef ComputePrecision (*computeParticleValue)(const ValType& t);
|
typedef ComputePrecision (*computeParticleValue)(const ValType &t);
|
||||||
typedef void (*runParticleValue)(ValType& t);
|
typedef void (*runParticleValue)(ValType &t);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef SPHCell *P_SPHCell;
|
typedef SPHCell *P_SPHCell;
|
||||||
struct SPHState
|
struct SPHState {
|
||||||
{
|
|
||||||
boost::shared_ptr<P_SPHCell[]> ngb;
|
boost::shared_ptr<P_SPHCell[]> ngb;
|
||||||
boost::shared_ptr<CoordType[]> distances;
|
boost::shared_ptr<CoordType[]> distances;
|
||||||
typename SPHTree::coords currentCenter;
|
typename SPHTree::coords currentCenter;
|
||||||
@ -70,46 +66,40 @@ namespace CosmoTool
|
|||||||
ComputePrecision smoothRadius;
|
ComputePrecision smoothRadius;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SPHSmooth(SPHTree *tree, uint32_t Nsph);
|
SPHSmooth(SPHTree *tree, uint32_t Nsph);
|
||||||
virtual ~SPHSmooth();
|
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 fetchNeighbours(const typename SPHTree::coords &c, uint32_t newNsph);
|
||||||
void fetchNeighboursOnVolume(const typename SPHTree::coords& c, ComputePrecision radius);
|
void fetchNeighboursOnVolume(
|
||||||
const typename SPHTree::coords& getCurrentCenter() const
|
const typename SPHTree::coords &c, ComputePrecision radius);
|
||||||
{
|
const typename SPHTree::coords &getCurrentCenter() const {
|
||||||
return internal.currentCenter;
|
return internal.currentCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FuncT>
|
template <typename FuncT>
|
||||||
ComputePrecision computeSmoothedValue(const typename SPHTree::coords& c,
|
ComputePrecision computeSmoothedValue(
|
||||||
FuncT fun, SPHState *state = 0);
|
const typename SPHTree::coords &c, FuncT fun, SPHState *state = 0);
|
||||||
|
|
||||||
template<typename FuncT>
|
template <typename FuncT>
|
||||||
ComputePrecision computeInterpolatedValue(const typename SPHTree::coords& c,
|
ComputePrecision computeInterpolatedValue(
|
||||||
FuncT fun, SPHState *state = 0);
|
const typename SPHTree::coords &c, FuncT fun, SPHState *state = 0);
|
||||||
|
|
||||||
ComputePrecision getMaxDistance(const typename SPHTree::coords& c,
|
ComputePrecision
|
||||||
SPHNode *node) const;
|
getMaxDistance(const typename SPHTree::coords &c, SPHNode *node) const;
|
||||||
|
|
||||||
ComputePrecision getSmoothingLen() const
|
ComputePrecision getSmoothingLen() const { return internal.smoothRadius; }
|
||||||
{
|
|
||||||
return internal.smoothRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TO USE WITH EXTREME CARE !
|
// TO USE WITH EXTREME CARE !
|
||||||
void setSmoothingLen(ComputePrecision len)
|
void setSmoothingLen(ComputePrecision len) { internal.smoothRadius = len; }
|
||||||
{
|
|
||||||
internal.smoothRadius = len;
|
|
||||||
}
|
|
||||||
// END
|
// END
|
||||||
|
|
||||||
template<typename FuncT>
|
template <typename FuncT>
|
||||||
void runForEachNeighbour(FuncT fun, SPHState *state = 0);
|
void runForEachNeighbour(FuncT fun, SPHState *state = 0);
|
||||||
void addGridSite(const typename SPHTree::coords& c, SPHState *state);
|
void addGridSite(const typename SPHTree::coords &c, SPHState *state);
|
||||||
void addGridSite(const typename SPHTree::coords& c);
|
void addGridSite(const typename SPHTree::coords &c);
|
||||||
|
|
||||||
bool hasNeighbours() const;
|
bool hasNeighbours() const;
|
||||||
|
|
||||||
@ -134,21 +124,21 @@ namespace CosmoTool
|
|||||||
uint32_t maxNgb;
|
uint32_t maxNgb;
|
||||||
SPHTree *tree;
|
SPHTree *tree;
|
||||||
|
|
||||||
template<typename FuncT>
|
template <typename FuncT>
|
||||||
ComputePrecision computeWValue(const typename SPHTree::coords & c,
|
ComputePrecision computeWValue(
|
||||||
SPHCell& cell,
|
const typename SPHTree::coords &c, SPHCell &cell, CoordType d,
|
||||||
CoordType d,
|
FuncT fun, SPHState *state);
|
||||||
FuncT fun, SPHState *state);
|
|
||||||
|
|
||||||
template<typename FuncT>
|
template <typename FuncT>
|
||||||
void runUnrollNode(SPHNode *node,
|
void runUnrollNode(SPHNode *node, FuncT fun);
|
||||||
FuncT fun);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class ValType1, class ValType2, int Ndims>
|
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"
|
#include "sphSmooth.tcc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user