1 #ifndef ANALYTIC_PARTICLE_WATCHER_H
2 #define ANALYTIC_PARTICLE_WATCHER_H
5 #include <pybind11/pybind11.h>
50 void PushBackImpacts(
const int id1,
const int id2,
const double normal_vel,
const double tang_vel)
52 if (ImpactIsNew(id2)){
56 mRelVelNormal.push_back(normal_vel);
57 mRelVelTangential.push_back(tang_vel);
64 PushBackImpacts(other_list_of_impacts.mId1[
i], other_list_of_impacts.mId2[
i], other_list_of_impacts.mRelVelNormal[
i], other_list_of_impacts.mRelVelTangential[
i]);
69 pybind11::list& neighbour_ids,
70 pybind11::list& normal_relative_vel,
71 pybind11::list& tangential_relative_vel)
74 neighbour_ids.attr(
"clear")();
75 normal_relative_vel.attr(
"clear")();
76 tangential_relative_vel.attr(
"clear")();
78 for (
int i = 0;
i < mNImpacts; ++
i){
83 neighbour_ids.append(mId2[
i]);
84 normal_relative_vel.append(mRelVelNormal[
i]);
85 tangential_relative_vel.append(mRelVelTangential[
i]);
94 std::vector<int> mId1;
95 std::vector<int> mId2;
96 std::vector<double> mRelVelNormal;
97 std::vector<double> mRelVelTangential;
100 bool ImpactIsNew(
const int id_2)
102 return std::find(mId1.begin(), mId1.end(), id_2) == mId1.end();
114 void PushBackImpacts(
const double time,
const int id2,
const double normal_vel,
const double tang_vel,
const double linear_impulse)
117 mTimes.push_back(
time);
119 mRelVelNormal.push_back(normal_vel);
120 mRelVelTangential.push_back(tang_vel);
121 mLinearImpulse.push_back(linear_impulse);
125 pybind11::list& neighbour_ids,
126 pybind11::list& normal_relative_vel,
127 pybind11::list& tangential_relative_vel)
129 times.attr(
"clear")();
130 neighbour_ids.attr(
"clear")();
131 normal_relative_vel.attr(
"clear")();
132 tangential_relative_vel.attr(
"clear")();
134 for (
int i = 0;
i < mNImpacts; ++
i){
136 neighbour_ids.append(mId2[
i]);
137 normal_relative_vel.append(mRelVelNormal[
i]);
138 tangential_relative_vel.append(mRelVelTangential[
i]);
143 if(mRelVelNormal.size()){
144 for(
int i=0;
i<(
int)mRelVelNormal.size();
i++){
145 const double abs_normal_value = std::abs(mRelVelNormal[
i]);
146 db_normal_impact_velocity =
std::max(db_normal_impact_velocity, abs_normal_value);
147 const double abs_tg_value = std::abs(mRelVelTangential[
i]);
148 db_tangential_impact_velocity =
std::max(db_tangential_impact_velocity, abs_tg_value);
152 db_normal_impact_velocity = 0.0;
153 db_tangential_impact_velocity = 0.0;
158 if(mRelVelNormal.size()){
159 db_linear_impulse = std::abs(*(std::max_element(mLinearImpulse.begin(), mLinearImpulse.end())));
163 db_linear_impulse = 0.0;
173 std::vector<double> mTimes;
174 std::vector<int> mId2;
175 std::vector<double> mRelVelNormal;
176 std::vector<double> mRelVelTangential;
177 std::vector<double> mLinearImpulse;
198 void PushBackImpacts(
const int id1,
const int id2,
const double normal_vel,
const double tang_vel)
200 if (ImpactIsNew(id2)){
204 mRelVelNormal.push_back(normal_vel);
205 mRelVelTangential.push_back(tang_vel);
212 PushBackImpacts(other_list_of_impacts.mId1[
i], other_list_of_impacts.mId2[
i], other_list_of_impacts.mRelVelNormal[
i], other_list_of_impacts.mRelVelTangential[
i]);
217 pybind11::list& neighbour_ids,
218 pybind11::list& normal_relative_vel,
219 pybind11::list& tangential_relative_vel)
222 neighbour_ids.attr(
"clear")();
223 normal_relative_vel.attr(
"clear")();
224 tangential_relative_vel.attr(
"clear")();
226 for (
int i = 0;
i < mNImpacts; ++
i){
228 neighbour_ids.append(mId2[
i]);
229 normal_relative_vel.append(mRelVelNormal[
i]);
230 tangential_relative_vel.append(mRelVelTangential[
i]);
238 std::vector<int> mId1;
239 std::vector<int> mId2;
240 std::vector<double> mRelVelNormal;
241 std::vector<double> mRelVelTangential;
243 bool ImpactIsNew(
const int id_2)
245 return std::find(mId1.begin(), mId1.end(), id_2) == mId1.end();
260 mTimes.push_back(
time);
262 mRelVelNormal.push_back(normal_vel);
263 mRelVelTangential.push_back(tang_vel);
267 pybind11::list& neighbour_ids,
268 pybind11::list& normal_relative_vel,
269 pybind11::list& tangential_relative_vel)
271 times.attr(
"clear")();
272 neighbour_ids.attr(
"clear")();
273 normal_relative_vel.attr(
"clear")();
274 tangential_relative_vel.attr(
"clear")();
276 for (
int i = 0;
i < mNImpacts; ++
i){
278 neighbour_ids.append(mId2[
i]);
279 normal_relative_vel.append(mRelVelNormal[
i]);
280 tangential_relative_vel.append(mRelVelTangential[
i]);
285 if(mRelVelNormal.size()){
286 for(
int i=0;
i<(
int)mRelVelNormal.size();
i++){
287 const double abs_normal_value = std::abs(mRelVelNormal[
i]);
288 db_normal_impact_velocity =
std::max(db_normal_impact_velocity, abs_normal_value);
289 const double abs_tg_value = std::abs(mRelVelTangential[
i]);
290 db_tangential_impact_velocity =
std::max(db_tangential_impact_velocity, abs_tg_value);
294 db_normal_impact_velocity = 0.0;
295 db_tangential_impact_velocity = 0.0;
304 std::vector<double> mTimes;
305 std::vector<int> mId2;
306 std::vector<double> mRelVelNormal;
307 std::vector<double> mRelVelTangential;
313 pybind11::list
times,
314 pybind11::list neighbour_ids,
315 pybind11::list normal_relative_vel,
316 pybind11::list tangential_relative_vel);
319 pybind11::list&
times,
320 pybind11::list& neighbour_ids,
321 pybind11::list& normal_relative_vel,
322 pybind11::list& tangential_relative_vel);
325 pybind11::list& neighbour_ids,
326 pybind11::list& normal_relative_vel,
327 pybind11::list& tangential_relative_vel);
335 virtual InterParticleImpactDataOfAllTimeStepsSingleParticle&
GetParticleDataBase(
int id, std::map<int, InterParticleImpactDataOfAllTimeStepsSingleParticle>& data_base);
336 virtual FaceParticleImpactDataOfAllTimeStepsSingleParticle&
GetParticleFaceDataBase(
int id, std::map<int, FaceParticleImpactDataOfAllTimeStepsSingleParticle>& data_base);
339 virtual std::string
Info()
const;
342 virtual void PrintInfo(std::ostream& rOStream)
const;
345 virtual void PrintData(std::ostream& rOStream)
const;
350 std::set<int> mSetOfIds;
352 std::vector<InterParticleImpactDataOfAllParticlesSingleTimeStep> mInterParticleImpactDataOfAllParticles;
353 std::map<int, InterParticleImpactDataOfAllTimeStepsSingleParticle> mInterParticleImpactDataOfAllTimeSteps;
355 std::vector<FaceParticleImpactDataOfAllParticlesSingleTimeStep> mFaceParticleImpactDataOfAllParticles;
356 std::map<int, FaceParticleImpactDataOfAllTimeStepsSingleParticle> mFaceParticleImpactDataOfAllTimeSteps;
Definition: analytic_particle_watcher.h:187
void PushBackImpacts(FaceParticleImpactDataOfAllParticlesSingleTimeStep &other_list_of_impacts)
Definition: analytic_particle_watcher.h:209
FaceParticleImpactDataOfAllParticlesSingleTimeStep(const double time)
Definition: analytic_particle_watcher.h:190
void FillUpPythonLists(pybind11::list &ids, pybind11::list &neighbour_ids, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_particle_watcher.h:216
int GetNumberOfImpacts()
Definition: analytic_particle_watcher.h:193
void PushBackImpacts(const int id1, const int id2, const double normal_vel, const double tang_vel)
Definition: analytic_particle_watcher.h:198
~FaceParticleImpactDataOfAllParticlesSingleTimeStep()
Definition: analytic_particle_watcher.h:191
Definition: analytic_particle_watcher.h:250
FaceParticleImpactDataOfAllTimeStepsSingleParticle()
Definition: analytic_particle_watcher.h:253
FaceParticleImpactDataOfAllTimeStepsSingleParticle(const int id)
Definition: analytic_particle_watcher.h:254
void PushBackImpacts(const double time, const int id2, const double normal_vel, const double tang_vel)
Definition: analytic_particle_watcher.h:257
void FillUpPythonLists(pybind11::list ×, pybind11::list &neighbour_ids, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_particle_watcher.h:266
~FaceParticleImpactDataOfAllTimeStepsSingleParticle()
Definition: analytic_particle_watcher.h:255
void GetMaxCollidingSpeedFromDatabase(double &db_normal_impact_velocity, double &db_tangential_impact_velocity)
Definition: analytic_particle_watcher.h:284
Definition: analytic_particle_watcher.h:39
void PushBackImpacts(InterParticleImpactDataOfAllParticlesSingleTimeStep &other_list_of_impacts)
Definition: analytic_particle_watcher.h:61
InterParticleImpactDataOfAllParticlesSingleTimeStep(const double time)
Definition: analytic_particle_watcher.h:42
void PushBackImpacts(const int id1, const int id2, const double normal_vel, const double tang_vel)
Definition: analytic_particle_watcher.h:50
void FillUpPythonLists(pybind11::list &ids, pybind11::list &neighbour_ids, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_particle_watcher.h:68
~InterParticleImpactDataOfAllParticlesSingleTimeStep()
Definition: analytic_particle_watcher.h:43
int GetNumberOfImpacts()
Definition: analytic_particle_watcher.h:45
Definition: analytic_particle_watcher.h:107
void GetMaxLinearImpulseFromDatabase(double &db_linear_impulse)
Definition: analytic_particle_watcher.h:157
InterParticleImpactDataOfAllTimeStepsSingleParticle(const int id)
Definition: analytic_particle_watcher.h:111
InterParticleImpactDataOfAllTimeStepsSingleParticle()
Definition: analytic_particle_watcher.h:110
void FillUpPythonLists(pybind11::list ×, pybind11::list &neighbour_ids, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_particle_watcher.h:124
void GetMaxCollidingSpeedFromDatabase(double &db_normal_impact_velocity, double &db_tangential_impact_velocity)
Definition: analytic_particle_watcher.h:142
void PushBackImpacts(const double time, const int id2, const double normal_vel, const double tang_vel, const double linear_impulse)
Definition: analytic_particle_watcher.h:114
~InterParticleImpactDataOfAllTimeStepsSingleParticle()
Definition: analytic_particle_watcher.h:112
Definition: analytic_particle_watcher.h:23
virtual FaceParticleImpactDataOfAllTimeStepsSingleParticle & GetParticleFaceDataBase(int id, std::map< int, FaceParticleImpactDataOfAllTimeStepsSingleParticle > &data_base)
Definition: analytic_particle_watcher.cpp:245
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: analytic_particle_watcher.cpp:269
virtual void SetNodalMaxImpactVelocities(ModelPart &analytic_model_part)
Definition: analytic_particle_watcher.cpp:100
virtual std::string Info() const
Turn back information as a string.
Definition: analytic_particle_watcher.cpp:261
void GetParticleData(int id, pybind11::list times, pybind11::list neighbour_ids, pybind11::list normal_relative_vel, pybind11::list tangential_relative_vel)
Definition: analytic_particle_watcher.cpp:159
void GetAllParticlesData(ModelPart &analytic_model_part, pybind11::list ×, pybind11::list &neighbour_ids, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_particle_watcher.cpp:168
virtual InterParticleImpactDataOfAllTimeStepsSingleParticle & GetParticleDataBase(int id, std::map< int, InterParticleImpactDataOfAllTimeStepsSingleParticle > &data_base)
Definition: analytic_particle_watcher.cpp:230
virtual void SetNodalMaxLinearImpulse(ModelPart &analytic_model_part)
Definition: analytic_particle_watcher.cpp:142
KRATOS_CLASS_POINTER_DEFINITION(AnalyticParticleWatcher)
virtual void SetNodalMaxFaceImpactVelocities(ModelPart &analytic_model_part)
Definition: analytic_particle_watcher.cpp:121
virtual ~AnalyticParticleWatcher()
Destructor.
Definition: analytic_particle_watcher.h:35
AnalyticParticleWatcher()
Default constructor.
Definition: analytic_particle_watcher.h:31
void GetTimeStepsData(pybind11::list &ids, pybind11::list &neighbour_ids, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_particle_watcher.cpp:198
virtual void MakeMeasurements(ModelPart &analytic_model_part)
Definition: analytic_particle_watcher.cpp:26
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: analytic_particle_watcher.cpp:266
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
static double max(double a, double b)
Definition: GeometryFunctions.h:79
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
time
Definition: face_heat.py:85
times
Definition: sp_statistics.py:42
integer i
Definition: TensorModule.f:17