FP2PGroupParticleContainer.hpp 2.47 KB
Newer Older
1 2 3

// Keep in private GIT
// @SCALFMM_PRIVATE
4 5 6 7 8
#ifndef FP2PGROUPPARTICLECONTAINER_HPP
#define FP2PGROUPPARTICLECONTAINER_HPP

#include "FGroupAttachedLeaf.hpp"

9 10
template<int NRHS = 1, int NLHS = 1, int NVALS = 1>
class FP2PGroupParticleContainer : public FGroupAttachedLeaf<NVALS*NRHS, NVALS*4*NLHS, FReal> {
11
    typedef FGroupAttachedLeaf<NVALS*NRHS, NVALS*4*NLHS, FReal> Parent;
12 13 14 15 16 17 18 19 20

public:
    FP2PGroupParticleContainer(){}
    FP2PGroupParticleContainer(const int inNbParticles, FReal* inPositionBuffer, const size_t inLeadingPosition,
                       FReal* inAttributesBuffer, const size_t inLeadingAttributes)
        : Parent(inNbParticles, inPositionBuffer, inLeadingPosition, inAttributesBuffer, inLeadingAttributes) {

    }

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    FReal* getPhysicalValues(const int idxVals = 0, const int idxRhs = 0){
      return Parent::getAttribute((0+idxRhs)*NVALS+idxVals);
    }

    const FReal* getPhysicalValues(const int idxVals = 0, const int idxRhs = 0) const {
        return Parent::getAttribute((0+idxRhs)*NVALS+idxVals);
    }

    FReal* getPotentials(const int idxVals = 0, const int idxLhs = 0){
        return Parent::getAttribute((NRHS+idxLhs)*NVALS+idxVals);
    }

    const FReal* getPotentials(const int idxVals = 0, const int idxLhs = 0) const {
        return Parent::getAttribute((NRHS+idxLhs)*NVALS+idxVals);
    }

    FReal* getForcesX(const int idxVals = 0, const int idxLhs = 0){
        return Parent::getAttribute((NRHS+NLHS+idxLhs)*NVALS+idxVals);
    }

    const FReal* getForcesX(const int idxVals = 0, const int idxLhs = 0) const {
        return Parent::getAttribute((NRHS+NLHS+idxLhs)*NVALS+idxVals);
43 44
    }

45 46
    FReal* getForcesY(const int idxVals = 0, const int idxLhs = 0){
        return Parent::getAttribute((NRHS+2*NLHS+idxLhs)*NVALS+idxVals);
47 48
    }

49 50
    const FReal* getForcesY(const int idxVals = 0, const int idxLhs = 0) const {
        return Parent::getAttribute((NRHS+2*NLHS+idxLhs)*NVALS+idxVals);
51 52
    }

53 54
    FReal* getForcesZ(const int idxVals = 0, const int idxLhs = 0){
        return Parent::getAttribute((NRHS+3*NLHS+idxLhs)*NVALS+idxVals);
55 56
    }

57 58
    const FReal* getForcesZ(const int idxVals = 0, const int idxLhs = 0) const {
        return Parent::getAttribute((NRHS+3*NLHS+idxLhs)*NVALS+idxVals);
59 60
    }

61 62 63 64 65 66 67 68 69 70
    void resetForcesAndPotential(){
        for(int idx = 0 ; idx < 4*NLHS*NVALS ; ++idx){
            Parent::resetToInitialState(idx + NRHS*NVALS);
        }
    }

    int getNVALS() const {
        return NVALS;
    }

71 72 73
};

#endif // FP2PGROUPPARTICLECONTAINER_HPP