KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
mapper_vertex_morphing_adaptive_radius.h
Go to the documentation of this file.
1 // ==============================================================================
2 // KratosShapeOptimizationApplication
3 //
4 // License: BSD License
5 // license: ShapeOptimizationApplication/license.txt
6 //
7 // Main authors: David Schmölz
8 // Suneth Warnakulasuriya
9 //
10 // ==============================================================================
11 
12 #ifndef MAPPER_VERTEX_MORPHING_ADAPTIVE_RADIUS_H
13 #define MAPPER_VERTEX_MORPHING_ADAPTIVE_RADIUS_H
14 
15 // ------------------------------------------------------------------------------
16 // System includes
17 // ------------------------------------------------------------------------------
18 #include <string>
19 
20 // ------------------------------------------------------------------------------
21 // Project includes
22 // ------------------------------------------------------------------------------
23 #include "includes/define.h"
24 #include "includes/model_part.h"
26 
27 // ==============================================================================
28 
29 namespace Kratos
30 {
31 
34 
36 
40 template<class TBaseVertexMorphingMapper>
41 class KRATOS_API(SHAPE_OPTIMIZATION_APPLICATION) MapperVertexMorphingAdaptiveRadius : public TBaseVertexMorphingMapper
42 {
43 public:
46 
47  using BaseType = TBaseVertexMorphingMapper;
48 
49  // Type definitions for better reading later
50  using NodeType = Node;
51 
53 
55 
56  using IndexType = std::size_t;
57 
58  using NodeTypePointer = NodeType::Pointer;
59 
60  using NodeVector = std::vector<NodeTypePointer>;
61 
62  using DoubleVectorIterator = std::vector<double>::iterator ;
63 
64  using NodeIterator = std::vector<NodeType::Pointer>::iterator;
65 
68 
69  // Type definitions for tree-search
72 
75 
79 
82  ModelPart& rOriginModelPart,
83  ModelPart& rDestinationModelPart,
84  Parameters MapperSettings);
85 
88 
92 
93  void Initialize() override;
94 
95  void Update() override;
96 
100 
102  virtual std::string Info() const override;
103 
105  virtual void PrintInfo(std::ostream& rOStream) const override;
106 
108  virtual void PrintData(std::ostream& rOStream) const override;
109 
111 
112 private:
115 
116  // Initialized by class constructor
117  ModelPart& mrOriginModelPart;
118  ModelPart& mrDestinationModelPart;
119  std::string mRadiusFunctionType;
120  double mRadiusFunctionParameter;
121  double mMinimumFilterRadius;
122  double mCurvatureLimit;
123  IndexType mNumberOfSmoothingIterations;
124  IndexType mMaxNumberOfNeighbors;
125 
126  IndexType mBucketSize = 100;
127  Kratos::unique_ptr<KDTree> mpSearchTree;
128  NodeVector mListOfNodesInOriginModelPart;
129 
133 
134  double CurvatureFunction(const double& rCurvature, const double& rElementSize);
135 
136  void CalculateCurvatureBasedFilterRadius();
137 
138  void SmoothenCurvatureBasedFilterRadius();
139 
140  void CalculateAdaptiveVertexMorphingRadius();
141 
142  double GetVertexMorphingRadius(const NodeType& rNode) const override;
143 
144  void CreateSearchTreeWithAllNodesInOriginModelPart();
145 
146  void CreateListOfNodesInOriginModelPart();
147 
148  virtual void ComputeWeightForAllNeighbors(
149  const ModelPart::NodeType& destination_node,
150  const NodeVector& neighbor_nodes,
151  const unsigned int number_of_neighbors,
152  std::vector<double>& list_of_weights,
153  double& sum_of_weights) override;
154 
155  void AssignMappingIds();
156 
158 
159 }; // Class MapperVertexMorphingAdaptiveRadius
160 
162 
165 
166 
170 
172 
173 
174 } // namespace Kratos.
175 
176 #endif // MAPPER_VERTEX_MORPHING_ADAPTIVE_RADIUS_H
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Short class definition.
Definition: bucket.h:57
Base class for all Elements.
Definition: element.h:60
Short class definition.
Definition: mapper_vertex_morphing_adaptive_radius.h:42
std::vector< double >::iterator DoubleVectorIterator
Definition: mapper_vertex_morphing_adaptive_radius.h:62
UblasSpace< double, CompressedMatrix, Vector > SparseSpaceType
Definition: mapper_vertex_morphing_adaptive_radius.h:66
KRATOS_CLASS_POINTER_DEFINITION(MapperVertexMorphingAdaptiveRadius)
Pointer definition of MapperVertexMorphingAdaptiveRadius.
SparseSpaceType::MatrixType SparseMatrixType
Definition: mapper_vertex_morphing_adaptive_radius.h:67
std::vector< NodeType::Pointer >::iterator NodeIterator
Definition: mapper_vertex_morphing_adaptive_radius.h:64
NodeType::Pointer NodeTypePointer
Definition: mapper_vertex_morphing_adaptive_radius.h:58
virtual ~MapperVertexMorphingAdaptiveRadius()=default
Destructor.
std::vector< NodeTypePointer > NodeVector
Definition: mapper_vertex_morphing_adaptive_radius.h:60
std::size_t IndexType
Definition: mapper_vertex_morphing_adaptive_radius.h:56
TBaseVertexMorphingMapper BaseType
Definition: mapper_vertex_morphing_adaptive_radius.h:47
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
A generic tree data structure for spatial partitioning.
Definition: tree.h:190
A class template for handling data types, matrices, and vectors in a Ublas space.
Definition: ublas_space.h:121
TMatrixType MatrixType
The matrix type considered.
Definition: ublas_space.h:133
void ComputeWeightForAllNeighbors(double &rSumOfWeights, std::vector< double > &rListOfWeights, const FilterFunction &rFilterFunction, const DampingFunction &rDampingFunction, const double Radius, const EntityPoint< TEntityType > &rDesignPoint, const std::vector< typename EntityPoint< TEntityType >::Pointer > &rNeighbourNodes, const std::vector< typename EntityPoint< TEntityType >::Pointer > &rDampingNeighbourNodes, const IndexType NumberOfNeighbours, Expression const *const pExpression)
Definition: explicit_filter.cpp:125
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33