SPHinXsys  alpha version
level_set_shape.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  * --------------------------------------------------------------------------*/
29 #ifndef LEVEL_SET_SHAPE_H
30 #define LEVEL_SET_SHAPE_H
31 
32 #include "base_geometry.h"
33 #include "level_set.h"
34 
35 #include <string>
36 
37 namespace SPH
38 {
39 
40  class SPHBody;
41 
46  class LevelSetShape : public Shape
47  {
48  private:
49  UniquePtrKeeper<BaseLevelSet> level_set_keeper_;
50 
51  public:
53  LevelSetShape(SPHBody *sph_body, Shape &shape, Real refinement_ratio = 1.0);
54  virtual ~LevelSetShape(){};
55 
56  virtual bool checkContain(const Vecd &input_pnt, bool BOUNDARY_INCLUDED = true) override;
57  virtual Vecd findClosestPoint(const Vecd &input_pnt) override;
58 
59  Vecd findLevelSetGradient(const Vecd &input_pnt);
60  Real computeKernelIntegral(const Vecd &input_pnt, Real h_ratio = 1.0);
61  Vecd computeKernelGradientIntegral(const Vecd &input_pnt, Real h_ratio = 1.0);
63  LevelSetShape *cleanLevelSet(Real small_shift_factor = 1.0);
64  void writeLevelSet(SPHBody &sph_body);
65 
66  protected:
69  virtual BoundingBox findBounds() override;
70  };
71 }
72 #endif // LEVEL_SET_SHAPE_H
Base class for all volumetric geometries Note that checkContain and findClosest point are basic funct...
Definition: base_geometry.h:64
LevelSetShape(SPHBody *sph_body, Shape &shape, Real refinement_ratio=1.0)
Definition: level_set_shape.cpp:15
A wrapper to provide an ownership for a new derived object which previous often generated by new a ra...
Definition: ownership.h:90
LevelSetShape * cleanLevelSet(Real small_shift_factor=1.0)
Definition: level_set_shape.cpp:31
BaseLevelSet * level_set_
Definition: level_set_shape.h:67
A shape using level set to define geometry.
Definition: level_set_shape.h:46
A abstract describes a level set field defined on a mesh.
Definition: level_set.h:83
Shape is the base class for all geometries.
SPHBody is a base body with basic data and functions. Its derived class can be a real fluid body...
Definition: base_body.h:61
Level set is a function which is defined as signed distance to a surface or interface.
Definition: solid_body_supplementary.cpp:9