2 #ifndef ANALYTIC_FACE_WATCHER_H
3 #define ANALYTIC_FACE_WATCHER_H
5 #include <pybind11/pybind11.h>
43 return (T(0) <
x) - (
x < T(0));
58 void PushBackCrossings(
const int id1,
const int id2,
const double mass,
const double normal_vel,
const double tang_vel)
61 mNSignedCrossings +=
Sign(id2);
62 mMass += mass*
Sign(id2);
63 mRelVelNormalxMass += mass*normal_vel;
64 mRelVelTangentialxMass += mass*tang_vel;
65 mMasses.push_back(mass);
67 mId2.push_back(std::abs(id2));
68 mRelVelNormal.push_back(normal_vel);
69 mRelVelTangential.push_back(tang_vel);
74 return mNSignedCrossings;
89 return mRelVelNormalxMass;
94 return mRelVelTangentialxMass;
99 pybind11::list& neighbour_ids,
101 pybind11::list& normal_relative_vel,
102 pybind11::list& tangential_relative_vel)
105 neighbour_ids.attr(
"clear")();
107 normal_relative_vel.attr(
"clear")();
108 tangential_relative_vel.attr(
"clear")();
110 for (
int i = 0;
i < mNCrossings; ++
i){
113 neighbour_ids.append(mId2[
i]);
115 normal_relative_vel.append(mRelVelNormal[
i]);
116 tangential_relative_vel.append(mRelVelTangential[
i]);
123 int mNSignedCrossings;
126 std::vector<double> mMasses;
127 std::vector<int> mId1;
128 std::vector<int> mId2;
129 std::vector<double> mRelVelNormal;
130 std::vector<double> mRelVelTangential;
131 double mRelVelNormalxMass;
132 double mRelVelTangentialxMass;
144 void PushBackCrossings(
const double time,
const int id2,
const double mass,
const double normal_vel,
const double tang_vel)
147 mNSignedCrossings +=
Sign(id2);
148 mMass += mass *
Sign(normal_vel);
149 mTimes.push_back(
time);
150 mId2.push_back(std::abs(id2));
151 mMasses.push_back(mass *
Sign(normal_vel));
152 mRelVelNormal.push_back(normal_vel);
153 mRelVelTangential.push_back(tang_vel);
158 return mNSignedCrossings;
167 pybind11::list& neighbour_ids,
169 pybind11::list& normal_relative_vel,
170 pybind11::list& tangential_relative_vel)
173 times.attr(
"clear")();
174 neighbour_ids.attr(
"clear")();
176 normal_relative_vel.attr(
"clear")();
177 tangential_relative_vel.attr(
"clear")();
179 for (
int i = 0;
i < mNCrossings; ++
i){
182 neighbour_ids.append(mId2[
i]);
184 normal_relative_vel.append(mRelVelNormal[
i]);
185 tangential_relative_vel.append(mRelVelTangential[
i]);
192 int mNSignedCrossings;
195 std::vector<double> mTimes;
196 std::vector<double> mMasses;
197 std::vector<int> mId2;
198 std::vector<double> mRelVelNormal;
199 std::vector<double> mRelVelTangential;
205 pybind11::list
times,
206 pybind11::list neighbour_ids,
208 pybind11::list normal_relative_vel,
209 pybind11::list tangential_relative_vel);
212 pybind11::list&
times,
213 pybind11::list& neighbour_ids,
215 pybind11::list& normal_relative_vel,
216 pybind11::list& tangential_relative_vel);
219 pybind11::list& neighbour_ids,
221 pybind11::list& normal_relative_vel,
222 pybind11::list& tangential_relative_vel);
225 pybind11::list &n_particles,
226 pybind11::list &mass,
227 pybind11::list &normal_relative_vel,
228 pybind11::list &tangential_relative_vel);
235 virtual std::string
Info()
const;
238 virtual void PrintInfo(std::ostream& rOStream)
const;
241 virtual void PrintData(std::ostream& rOStream)
const;
247 std::set<int> mSetOfIds;
248 std::vector<CrossingsTimeStepDataBase> mVectorOfTimeStepDatabases;
249 std::map<int, FaceHistoryDatabase> mMapOfFaceHistoryDatabases;
Definition: analytic_face_watcher.h:47
void FillUpPythonLists(pybind11::list &ids, pybind11::list &neighbour_ids, pybind11::list &masses, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_face_watcher.h:98
double GetTotalMassThroughput()
Definition: analytic_face_watcher.h:77
double GetTime()
Definition: analytic_face_watcher.h:82
~CrossingsTimeStepDataBase()
Definition: analytic_face_watcher.h:51
double GetRelVelTangentialxMass()
Definition: analytic_face_watcher.h:92
int GetNumberOfCrossings()
Definition: analytic_face_watcher.h:53
void PushBackCrossings(const int id1, const int id2, const double mass, const double normal_vel, const double tang_vel)
Definition: analytic_face_watcher.h:58
double GetRelVelNormalxMass()
Definition: analytic_face_watcher.h:87
CrossingsTimeStepDataBase(const double time)
Definition: analytic_face_watcher.h:50
int GetTotalThroughput()
Definition: analytic_face_watcher.h:72
Definition: analytic_face_watcher.h:137
FaceHistoryDatabase()
Definition: analytic_face_watcher.h:140
double GetTotalMassThroughput()
Definition: analytic_face_watcher.h:161
FaceHistoryDatabase(const int id)
Definition: analytic_face_watcher.h:141
~FaceHistoryDatabase()
Definition: analytic_face_watcher.h:142
void FillUpPythonLists(pybind11::list ×, pybind11::list &neighbour_ids, pybind11::list &masses, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_face_watcher.h:166
int GetTotalThroughput()
Definition: analytic_face_watcher.h:156
void PushBackCrossings(const double time, const int id2, const double mass, const double normal_vel, const double tang_vel)
Definition: analytic_face_watcher.h:144
Definition: analytic_face_watcher.h:26
virtual void MakeMeasurements()
Definition: analytic_face_watcher.cpp:36
static int Sign(T x)
Definition: analytic_face_watcher.h:41
KRATOS_CLASS_POINTER_DEFINITION(AnalyticFaceWatcher)
void GetTimeStepsData(pybind11::list &ids, pybind11::list &neighbour_ids, pybind11::list &masses, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_face_watcher.cpp:105
virtual ~AnalyticFaceWatcher()
Destructor.
Definition: analytic_face_watcher.h:38
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: analytic_face_watcher.cpp:175
virtual FaceHistoryDatabase & GetFaceDataBase(int id)
Definition: analytic_face_watcher.cpp:159
void ClearData()
Definition: analytic_face_watcher.cpp:29
virtual std::string Info() const
Turn back information as a string.
Definition: analytic_face_watcher.cpp:170
void GetFaceData(int id, pybind11::list times, pybind11::list neighbour_ids, pybind11::list masses, pybind11::list normal_relative_vel, pybind11::list tangential_relative_vel)
Definition: analytic_face_watcher.cpp:61
AnalyticFaceWatcher(ModelPart &model_part)
Default constructor.
Definition: analytic_face_watcher.h:34
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: analytic_face_watcher.cpp:178
void GetAllFacesData(ModelPart &analytic_model_part, pybind11::list ×, pybind11::list &neighbour_ids, pybind11::list &masses, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_face_watcher.cpp:71
void GetTotalFlux(pybind11::list ×, pybind11::list &n_particles, pybind11::list &mass, pybind11::list &normal_relative_vel, pybind11::list &tangential_relative_vel)
Definition: analytic_face_watcher.cpp:142
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
time
Definition: face_heat.py:85
model_part
Definition: face_heat.py:14
x
Definition: sensitivityMatrix.py:49
times
Definition: sp_statistics.py:42
float masses
Definition: sp_statistics.py:89
integer i
Definition: TensorModule.f:17