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
|
||||
|
||||
@ -39,30 +39,26 @@ 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;
|
||||
|
||||
typedef KDTree<Ndims,FullType> SPHTree;
|
||||
typedef KDTreeNode<Ndims,FullType> SPHNode;
|
||||
typedef KDCell<Ndims,FullType> SPHCell;
|
||||
typedef typename KDTree<Ndims,FullType>::CoordType CoordType;
|
||||
typedef KDTree<Ndims, FullType> SPHTree;
|
||||
typedef KDTreeNode<Ndims, FullType> SPHNode;
|
||||
typedef KDCell<Ndims, FullType> SPHCell;
|
||||
typedef typename KDTree<Ndims, FullType>::CoordType CoordType;
|
||||
|
||||
typedef ComputePrecision (*computeParticleValue)(const ValType& t);
|
||||
typedef void (*runParticleValue)(ValType& t);
|
||||
typedef ComputePrecision (*computeParticleValue)(const ValType &t);
|
||||
typedef void (*runParticleValue)(ValType &t);
|
||||
|
||||
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,46 +66,40 @@ 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 fetchNeighbours(const typename SPHTree::coords &c, uint32_t newNsph);
|
||||
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);
|
||||
template <typename FuncT>
|
||||
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);
|
||||
template <typename FuncT>
|
||||
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>
|
||||
template <typename FuncT>
|
||||
void runForEachNeighbour(FuncT fun, SPHState *state = 0);
|
||||
void addGridSite(const typename SPHTree::coords& c, SPHState *state);
|
||||
void addGridSite(const typename SPHTree::coords& c);
|
||||
void addGridSite(const typename SPHTree::coords &c, SPHState *state);
|
||||
void addGridSite(const typename SPHTree::coords &c);
|
||||
|
||||
bool hasNeighbours() const;
|
||||
|
||||
@ -134,21 +124,21 @@ namespace CosmoTool
|
||||
uint32_t maxNgb;
|
||||
SPHTree *tree;
|
||||
|
||||
template<typename FuncT>
|
||||
ComputePrecision computeWValue(const typename SPHTree::coords & c,
|
||||
SPHCell& cell,
|
||||
CoordType d,
|
||||
FuncT fun, SPHState *state);
|
||||
template <typename FuncT>
|
||||
ComputePrecision computeWValue(
|
||||
const typename SPHTree::coords &c, SPHCell &cell, CoordType d,
|
||||
FuncT fun, SPHState *state);
|
||||
|
||||
template<typename FuncT>
|
||||
void runUnrollNode(SPHNode *node,
|
||||
FuncT fun);
|
||||
template <typename FuncT>
|
||||
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);
|
||||
template <class ValType1, class ValType2, int Ndims>
|
||||
bool operator<(
|
||||
const SPHSmooth<ValType1, Ndims> &s1,
|
||||
const SPHSmooth<ValType2, Ndims> &s2);
|
||||
|
||||
};
|
||||
}; // namespace CosmoTool
|
||||
|
||||
#include "sphSmooth.tcc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user