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.
particle_erase_process.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Ilaria Iaconeta
11 //
12 
13 
14 #pragma once
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "processes/process.h"
22 #include "includes/model_part.h"
23 
24 namespace Kratos
25 {
26 
29 
31 
33  : public Process
34 {
35 public:
36 
39 
42 
46 
49  : mr_model_part(model_part)
50  {
51  }
52 
56 
57  void operator()()
58  {
59  Execute();
60  }
61 
65 
66  void Execute() override
67  {
68  KRATOS_TRY;
69 
70  const int initial_num_element = mr_model_part.NumberOfElements();
71  mr_model_part.RemoveElements( TO_ERASE );
72  const int num_removed_elements = initial_num_element - mr_model_part.NumberOfElements();
73 
74  KRATOS_WARNING_IF("ParticleEraseProcess", num_removed_elements > 0) << num_removed_elements << " particle elements have been erased.\n";
75 
76  const int initial_num_condition = mr_model_part.NumberOfConditions();
77  mr_model_part.RemoveConditions( TO_ERASE );
78  const int num_removed_condition = initial_num_condition - mr_model_part.NumberOfConditions();
79 
80  KRATOS_WARNING_IF("ParticleEraseProcess", num_removed_condition > 0) << num_removed_condition << " particle conditions have been erased.\n";
81 
82  KRATOS_CATCH("");
83  }
84 
88 
90  std::string Info() const override
91  {
92  return "ParticleEraseProcess";
93  }
94 
96  void PrintInfo(std::ostream& rOStream) const override
97  {
98  rOStream << "ParticleEraseProcess";
99  }
100 
102  void PrintData(std::ostream& rOStream) const override
103  {
104  }
105 
107 
108 private:
109 
112 
113  ModelPart& mr_model_part;
114 
116 
117 }; // Class NodeAndElementEraseProcess
118 
120 
123 
125 inline std::istream& operator >> (std::istream& rIStream,
126  ParticleEraseProcess& rThis);
127 
129 inline std::ostream& operator << (std::ostream& rOStream,
130  const ParticleEraseProcess& rThis)
131 {
132  rThis.PrintInfo(rOStream);
133  rOStream << std::endl;
134  rThis.PrintData(rOStream);
135 
136  return rOStream;
137 }
138 
140 
141 } // namespace Kratos.
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
void RemoveElements(Flags IdentifierFlag=TO_ERASE)
Definition: model_part.cpp:1127
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
void RemoveConditions(Flags IdentifierFlag=TO_ERASE)
Definition: model_part.cpp:1637
SizeType NumberOfConditions(IndexType ThisIndex=0) const
Definition: model_part.h:1218
Delete particle elements and conditions with flag TO_ERASE.
Definition: particle_erase_process.h:34
ParticleEraseProcess(ModelPart &model_part)
Default constructor.
Definition: particle_erase_process.h:48
void operator()()
Definition: particle_erase_process.h:57
KRATOS_CLASS_POINTER_DEFINITION(ParticleEraseProcess)
Pointer definition of NodeAndElementEraseProcess.
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: particle_erase_process.h:96
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: particle_erase_process.h:102
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: particle_erase_process.h:66
std::string Info() const override
Turn back information as a string.
Definition: particle_erase_process.h:90
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
model_part
Definition: face_heat.py:14