SPHinXsys  alpha version
complex_body.h
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------*
2  * SPHinXsys *
3  * --------------------------------------------------------------------------*
4  * SPHinXsys (pronunciation: s'finksis) is an acronym from Smoothed Particle *
5  * Hydrodynamics for industrial compleX systems. It provides C++ APIs for *
6  * physical accurate simulation and aims to model coupled industrial dynamic *
7  * systems including fluid, solid, multi-body dynamics and beyond with SPH *
8  * (smoothed particle hydrodynamics), a meshless computational method using *
9  * particle discretization. *
10  * *
11  * SPHinXsys is partially funded by German Research Foundation *
12  * (Deutsche Forschungsgemeinschaft) DFG HU1527/6-1, HU1527/10-1 *
13  * and HU1527/12-1. *
14  * *
15  * Portions copyright (c) 2017-2020 Technical University of Munich and *
16  * the authors' affiliations. *
17  * *
18  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
19  * not use this file except in compliance with the License. You may obtain a *
20  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
21  * *
22  * --------------------------------------------------------------------------*/
32 #ifndef COMPLEX_BODY_H
33 #define COMPLEX_BODY_H
34 
35 #include "base_body.h"
36 #include "base_body_part.h"
37 #include "base_geometry.h"
38 
39 namespace SPH
40 {
48  {
49  public:
50  explicit SecondaryStructure(){};
51  virtual ~SecondaryStructure(){};
52 
53  virtual void buildParticleConfiguration(ParticleConfiguration &particle_configuration) = 0;
54  };
55 
61  class TreeBody : public SecondaryStructure, public RealBody
62  {
63  public:
64  class Branch;
65 
66  private:
67  UniquePtrKeepers<Branch> branches_ptr_keeper_;
68 
69  public:
70  StdVec<Branch *> branches_;
72  size_t last_branch_id_;
73  Branch *root_;
74 
75  explicit TreeBody(SPHSystem &sph_system, SharedPtr<Shape> shape_ptr);
76  virtual ~TreeBody(){};
77 
78  Branch *createANewBranch(size_t parent_id)
79  {
80  return branches_ptr_keeper_.createPtr<Branch>(parent_id, this);
81  };
82  size_t BranchLocation(size_t particle_idx);
83  Branch *LastBranch() { return branches_[last_branch_id_]; };
84 
85  virtual void buildParticleConfiguration(ParticleConfiguration &particle_configuration) override;
86  size_t ContainerSize() { return branches_.size(); };
87  };
88 
96  class TreeBody::Branch : public Edge<size_t, IndexVector>
97  {
98  public:
100  explicit Branch(TreeBody *tree);
102  Branch(size_t parent_id, TreeBody *tree);
103  virtual ~Branch(){};
104 
105  Vecd end_direction_;
111  };
112 
118  {
119  public:
120  TreeBody &tree_;
121 
122  explicit TreeTerminates(SPHBody &sph_body);
123  virtual ~TreeTerminates(){};
124  };
125 }
126 #endif // COMPLEX_BODY_H
template base class of linear structure only with topology information. Note that a edge is defined t...
Definition: base_geometry.h:146
StdVec< size_t > IndexVector
Definition: sph_data_containers.h:37
This is the base classes of body parts.
A body part with a collection of particles.
Definition: base_body_part.h:64
virtual void buildParticleConfiguration(ParticleConfiguration &particle_configuration) override
Definition: complex_body.cpp:23
Vecd end_direction_
Definition: complex_body.h:103
This is the base classes of SPH bodies. The real body is for that with cell linked list and the ficti...
StdLargeVec< Neighborhood > ParticleConfiguration
Definition: neighbor_relation.h:66
StdVec< Branch * > branches_
Definition: complex_body.h:70
The tree is composed of a root (the first branch) and other branch generated sequentially.
Definition: complex_body.h:61
Each branch (except the root) has a parent and several children, and geometric information. It is a realized edge and has multi inner particles. The first is the last particle from the parent or root, and the last is the first particle of all its child branches. Many connected branches compose a tree.
Definition: complex_body.h:96
IndexVector branch_locations_
Definition: complex_body.h:71
Abstract class as interface for all secondary structures. Currently, it provides interface on buildin...
Definition: complex_body.h:47
Shape is the base class for all geometries.
A wrapper to provide an ownership for a vector of base class pointers which point to derived objects...
Definition: ownership.h:127
IndexVector inner_particles_
Definition: complex_body.h:109
A body part with the collection of particles as the terminates of the tree.
Definition: complex_body.h:117
bool is_terminated_
Definition: complex_body.h:110
SPHBody is a base body with basic data and functions. Its derived class can be a real fluid body...
Definition: base_body.h:61
The SPH system managing objects in the system level.
Definition: sph_system.h:46
Derived body with inner particle configuration or inner interactions. After construction, the particle and material must be specified.
Definition: base_body.h:182
Branch(TreeBody *tree)
Definition: complex_body.cpp:226
DerivedType * createPtr(ConstructorArgs &&...args)
Definition: ownership.h:133
Definition: solid_body_supplementary.cpp:9