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.
analytic_model_part_filler.h
Go to the documentation of this file.
1 //
2 // Author: Guillermo Casas (gcasas@cimne.upc.edu)
3 //
4 #ifndef ANALYTIC_MODEL_PART_FILLER_H
5 #define ANALYTIC_MODEL_PART_FILLER_H
6 
7 // System includes
8 
9 #include <limits>
10 #include <iostream>
11 #include <iomanip>
12 
13 // Project includes
14 #include "includes/define.h"
15 #include "includes/model_part.h"
18 
19 
20 /* External includes */
21 #ifdef _OPENMP
22 #include <omp.h>
23 #endif
24 
25 namespace Kratos
26 {
27 class KRATOS_API(DEM_APPLICATION) AnalyticModelPartFiller
28 {
29 
30 public:
31 
33 
35 typedef ModelPart::ElementsContainerType::iterator ElementsIteratorType;
36 
39 
42 
43 // This algorithm implements the Fisher–Yates shuffle to generate a random subset of elements of a vector class
44 template<class bidiiter>
45 bidiiter random_unique(bidiiter begin, bidiiter end, size_t num_random){
46  size_t left = std::distance(begin, end);
47  while (num_random--) {
48  bidiiter r = begin;
49  std::advance(r, rand()%left);
50  std::swap(*begin, *r);
51  ++begin;
52  --left;
53  }
54  return begin;
55 }
56 
57 void GetRandomSample(std::vector<int>& random_positions_vector_to_fill,
58  const int n_positions,
59  const int n_random_positions);
60 
61 void FillAnalyticModelPartGivenFractionOfParticlesToTransform(const double fraction_of_particles_to_convert,
62  ModelPart& spheres_model_part,
63  ParticleCreatorDestructor particle_creator_destructor,
64  std::string analytic_sub_model_part_name = "");
65 
66 
68 virtual std::string Info() const;
69 
71 virtual void PrintInfo(std::ostream& rOStream) const;
72 
74 virtual void PrintData(std::ostream& rOStream) const;
75 
76 
77 private:
78 
81 
82 }; // Class AnalyticModelPartFiller
83 
84 } // namespace Kratos.
85 
86 #endif // ANALYTIC_MODEL_PART_FILLER_H
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: analytic_model_part_filler.h:28
KRATOS_CLASS_POINTER_DEFINITION(AnalyticModelPartFiller)
bidiiter random_unique(bidiiter begin, bidiiter end, size_t num_random)
Definition: analytic_model_part_filler.h:45
virtual ~AnalyticModelPartFiller()
Destructor.
Definition: analytic_model_part_filler.h:41
AnalyticModelPartFiller()
Default constructor.
Definition: analytic_model_part_filler.h:38
ModelPart::ElementsContainerType ElementsArrayType
Definition: analytic_model_part_filler.h:34
ModelPart::ElementsContainerType::iterator ElementsIteratorType
Definition: analytic_model_part_filler.h:35
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
Definition: create_and_destroy.h:33
end
Definition: DEM_benchmarks.py:180
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
left
Definition: exact_hinsberg_test.py:140