File: NodeParticleSplitting.h

package info (click to toggle)
stopt 5.12%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 8,860 kB
  • sloc: cpp: 70,456; python: 5,950; makefile: 72; sh: 57
file content (63 lines) | stat: -rw-r--r-- 2,681 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (C) 2016 EDF
// All Rights Reserved
// This code is published under the GNU Lesser General Public License (GNU LGPL)
#ifndef NODEPARTICLESPLITTING_H
#define NODEPARTICLESPLITTING_H
#include <memory>
#include <array>
#include <Eigen/Dense>
#include "StOpt/core/utils/Node.h"

/** \file NodeParticleSplitting.h
 *    \brief Give some N dimensional particles, permits to create some domain with the same number of particles
 *     \author Xavier Warin
 */
namespace StOpt
{

/// \class NodeParticleSplitting NodeParticleSplitting.h
/// Permits to split a Cartesian mesh  with the same number of particles inside each mesh. The new mesh is not conform
class NodeParticleSplitting
{
private :

    std::unique_ptr<Node> m_root; ///< root node for tree
    const std::unique_ptr< Eigen::ArrayXXd > &m_particles ;  ///< particles to spread towards meshes
    Eigen::ArrayXi  m_nbMeshPerDim ; ///< number of meshes per dimension

    /// \brief function use recursively to build the tree
    /// \param p_node  current node
    /// \param p_iPart  list of the particles number to tree
    void BuildTree(const std::unique_ptr< Node >   &p_node,  const Eigen::ArrayXi &p_iPart);

    /// \brief  to each point, give its mesh number after sorting (recursive version)
    //// \param p_node    Current node
    ///  \param  p_ipCell  Current cell number
    ///  \param p_ipDim    Current dimension
    /// \param  p_iProdMesh Utilitarian to increment mesh number
    /// \param p_iDecMesh Offset for mesh
    /// \param p_nCell   Array simulation mesh number
    /// \param m_meshCoord  for each mesh give it min and max coordinates
    void simToCellRecursive(std::unique_ptr<Node> &p_node,
                            int &p_ipCell, int p_ipDim,
                            int p_iProdMesh,
                            int p_iDecMesh,
                            Eigen::ArrayXi &p_nCell,
                            Eigen::Array<  std::array<double, 2 >, Eigen::Dynamic, Eigen::Dynamic >   &m_meshCoord);
public :

    /// \brief Tree creation
    /// \param p_particles    N dimensional particles to treat
    /// \param p_nbMeshPerDim  number of mesh per direction
    NodeParticleSplitting(const std::unique_ptr<Eigen::ArrayXXd > &p_particles, const Eigen::ArrayXi &p_nbMeshPerDim);


    /// \brief to each point, give its mesh number after sorting
    /// \param p_nCell   Array simulation mesh number
    /// \param p_meshCoord  for each mesh give it min and max coordinates
    void simToCell(Eigen::ArrayXi &p_nCell,
                   Eigen::Array<  std::array<double, 2 >, Eigen::Dynamic, Eigen::Dynamic >   &p_meshCoord);

};
}
#endif /* NODEPARTICLESPLITTING_H */