7 #if !defined(KRATOS_DISCRETE_PARTICLE__CONFIGURE_INCLUDED)
8 #define KRATOS_DISCRETE_PARTICLE__CONFIGURE_INCLUDED
44 template <std::
size_t TDimension>
81 static void SetDomain(
const double domain_min_x,
const double domain_min_y,
const double domain_min_z,
82 const double domain_max_x,
const double domain_max_y,
const double domain_max_z)
90 SetPeriods(domain_max_x - domain_min_x, domain_max_y - domain_min_y, domain_max_z - domain_min_z);
95 static void SetPeriods(
double domain_period_x,
double domain_period_y,
double domain_period_z)
136 for (
unsigned int i = 0;
i < 3; ++
i){
137 double incr_i = target[
i] - base_coordinates[
i];
139 if (fabs(incr_i) > 0.5 * periods[
i]){
140 base_coordinates[
i] += GetSign(incr_i) * periods[
i];
148 for (
unsigned int i = 0;
i < 3; ++
i){
149 double incr_i = target[
i] - base_coordinates[
i];
151 if (fabs(incr_i) > 0.5 * periods[
i]){
152 base_coordinates[
i] += GetSign(incr_i) * periods[
i];
158 static inline void GetBoxCenter(
double box_center[3],
const double min_point[3],
const double max_point[3])
160 for (
unsigned int i = 0;
i < 3; ++
i){
161 box_center[
i] = 0.5 * (min_point[
i] + max_point[
i]);
163 if (min_point[
i] > max_point[
i]){
166 box_center[
i] += 0.5 * (
max -
min);
167 if (box_center[
i] >
max){
182 noalias(rHighPoint) = rObject->GetGeometry()[0];
183 noalias(rLowPoint) = rObject->GetGeometry()[0];
188 for(std::size_t
i = 0;
i < 3; ++
i)
203 rCenter = rObject->GetGeometry()[0];
210 double rObj_2_to_rObj_1[3];
211 PointType& point_1 = rObj_1->GetGeometry()[0];
212 const double coors_1[3] = {point_1[0], point_1[1], point_1[2]};
213 PointType& point_2 = rObj_2->GetGeometry()[0];
214 const double coors_2[3] = {point_2[0], point_2[1], point_2[2]};
216 PeriodicSubstract(coors_1, coors_2, rObj_2_to_rObj_1);
223 const bool intersect = floatle(
distance_2, std::pow(radius_sum, 2));
244 double expanded_box_min[3];
245 double expanded_box_max[3];
247 for (
unsigned int i = 0;
i < 3; ++
i){
248 expanded_box_min[
i] = rLowPoint[
i] -
radius;
249 expanded_box_max[
i] = rHighPoint[
i] +
radius;
252 double box_center[3];
253 GetBoxCenter(box_center, expanded_box_min, expanded_box_max);
255 double representative_center_of_particle[3] = {center_of_particle[0],
256 center_of_particle[1],
257 center_of_particle[2]};
260 for (
unsigned int i = 0;
i < 3; ++
i){
261 const bool is_broken = rLowPoint[
i] > rHighPoint[
i];
264 intersect = floatge(expanded_box_min[
i], representative_center_of_particle[
i])
265 && floatle(expanded_box_max[
i], representative_center_of_particle[
i]);
269 intersect = floatle(expanded_box_min[
i], representative_center_of_particle[
i])
270 && floatge(expanded_box_max[
i], representative_center_of_particle[
i]);
276 for (
unsigned int i = 0;
i < 3; ++
i){
277 intersect = floatle(rLowPoint[
i] -
radius, center_of_particle[
i])
278 && floatge(rHighPoint[
i] +
radius, center_of_particle[
i]);
292 PointType& point_1 = rObj_1->GetGeometry()[0];
293 const double coors_1[3] = {point_1[0], point_1[1], point_1[2]};
294 PointType& point_2 = rObj_2->GetGeometry()[0];
295 const double coors_2[3] = {point_2[0], point_2[1], point_2[2]};
296 double rObj_2_to_rObj_1[3];
297 PeriodicSubstract(coors_1, coors_2, rObj_2_to_rObj_1);
318 virtual std::string
Info()
const {
return " Spatial Containers Configure for Discrete Particles"; }
378 static inline int GetSign(
const double value)
380 return (0.0 < value) - (value < 0.0);
383 static inline void PeriodicSubstract(
const double a[3],
const double b[3],
double c[3])
385 for (
unsigned int i = 0;
i < 3; ++
i){
390 for (
unsigned int i = 0;
i < 3; ++
i){
398 static inline bool floateq(
double a,
double b) {
399 return std::fabs(
a -
b) < std::numeric_limits<double>::epsilon();
402 static inline bool floatle(
double a,
double b) {
403 return a <
b || std::fabs(
a -
b) < std::numeric_limits<double>::epsilon();
406 static inline bool floatge(
double a,
double b) {
407 return a >
b || std::fabs(
a -
b) < std::numeric_limits<double>::epsilon();
442 template <std::
size_t TDimension>
448 template <std::
size_t TDimension>
451 rOStream << std::endl;
459 template <std::
size_t TDimension>
461 template <std::
size_t TDimension>
463 template <std::
size_t TDimension>
465 template <std::
size_t TDimension>
#define DEM_MODULUS_3(a)
Definition: DEM_application_variables.h:29
#define DEM_INNER_PRODUCT_3(a, b)
Definition: DEM_application_variables.h:31
Definition: discrete_particle_configure.h:46
ContainerType::iterator IteratorType
Definition: discrete_particle_configure.h:68
SearchType::PointType PointType
Definition: discrete_particle_configure.h:62
SearchType::NodesContainerType NodesContainerType
Definition: discrete_particle_configure.h:65
DiscreteParticleConfigure()
Definition: discrete_particle_configure.h:77
static void Distance(const PointerType &rObj_1, const PointerType &rObj_2, double &distance)
Definition: discrete_particle_configure.h:290
static void TransformToClosestPeriodicCoordinates(const double target[3], double base_coordinates[3], const double periods[3])
Definition: discrete_particle_configure.h:134
@ DIMENSION
Definition: discrete_particle_configure.h:52
@ MAX_LEVEL
Definition: discrete_particle_configure.h:53
@ MIN_LEVEL
Definition: discrete_particle_configure.h:54
@ Dimension
Definition: discrete_particle_configure.h:51
ResultContainerType::iterator ResultIteratorType
Definition: discrete_particle_configure.h:74
static double mDomainPeriods[3]
Definition: discrete_particle_configure.h:312
static double mDomainMax[3]
Definition: discrete_particle_configure.h:314
static void TransformToClosestPeriodicCoordinates(const array_1d< double, 3 > &target, array_1d< double, 3 > &base_coordinates)
Definition: discrete_particle_configure.h:129
static void GetBoxCenter(double box_center[3], const double min_point[3], const double max_point[3])
Definition: discrete_particle_configure.h:158
static void TransformToClosestPeriodicCoordinates(const array_1d< double, 3 > &target, array_1d< double, 3 > &base_coordinates, const double periods[3])
Definition: discrete_particle_configure.h:146
KRATOS_CLASS_POINTER_DEFINITION(DiscreteParticleConfigure)
Pointer definition of SpatialContainersConfigure.
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: discrete_particle_configure.h:321
ContainerType::value_type PointerType
Definition: discrete_particle_configure.h:67
static void CalculateBoundingBox(const PointerType &rObject, PointType &rLowPoint, PointType &rHighPoint)
Definition: discrete_particle_configure.h:180
static bool Intersection(const PointerType &rObj_1, const PointerType &rObj_2, const double &radius_1)
Definition: discrete_particle_configure.h:227
std::vector< double >::iterator DistanceIteratorType
Definition: discrete_particle_configure.h:75
static bool GetDomainPeriodicity()
Definition: discrete_particle_configure.h:119
ElementsContainerType::iterator ElementIteratorType
Definition: discrete_particle_configure.h:69
static void CalculateBoundingBox(const PointerType &rObject, PointType &rLowPoint, PointType &rHighPoint, const double &Radius)
Definition: discrete_particle_configure.h:195
static void GetPeriods(double periods[3])
Definition: discrete_particle_configure.h:112
static bool IntersectionBox(const PointerType &rObject, const PointType &rLowPoint, const PointType &rHighPoint, const double &Radius)
Definition: discrete_particle_configure.h:285
static void TransformToClosestPeriodicCoordinates(const double target[3], double base_coordinates[3])
Definition: discrete_particle_configure.h:124
static double GetObjectRadius(const PointerType &rObject, const double &Radius)
Definition: discrete_particle_configure.h:301
virtual ~DiscreteParticleConfigure()
Definition: discrete_particle_configure.h:78
SearchType::ElementsContainerType::ContainerType ContainerType
Definition: discrete_particle_configure.h:63
static bool IntersectionBox(const PointerType &rObject, const PointType &rLowPoint, const PointType &rHighPoint)
Definition: discrete_particle_configure.h:234
static double * GetMinPoint()
Definition: discrete_particle_configure.h:102
static void SetPeriods(double domain_period_x, double domain_period_y, double domain_period_z)
Definition: discrete_particle_configure.h:95
static double GetObjectRadius(const PointerType &rObject)
Definition: discrete_particle_configure.h:306
static bool mDomainIsPeriodic
Definition: discrete_particle_configure.h:315
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: discrete_particle_configure.h:324
static double mDomainMin[3]
Definition: discrete_particle_configure.h:313
SearchType::ElementsContainerType ElementsContainerType
Definition: discrete_particle_configure.h:64
static double * GetMaxPoint()
Definition: discrete_particle_configure.h:107
SpatialSearch SearchType
Definition: discrete_particle_configure.h:60
virtual std::string Info() const
Turn back information as a string.
Definition: discrete_particle_configure.h:318
SearchType::ElementsContainerType::ContainerType ResultContainerType
Definition: discrete_particle_configure.h:71
static bool Intersection(const PointerType &rObj_1, const PointerType &rObj_2)
Definition: discrete_particle_configure.h:208
static void SetDomain(const double domain_min_x, const double domain_min_y, const double domain_min_z, const double domain_max_x, const double domain_max_y, const double domain_max_z)
Definition: discrete_particle_configure.h:81
static void CalculateCenter(const PointerType &rObject, PointType &rCenter)
Definition: discrete_particle_configure.h:201
Point class.
Definition: point.h:59
This class is used to search for elements, conditions and nodes in a given model part.
Definition: spatial_search.h:50
ModelPart::NodesContainerType NodesContainerType
Nodes classes.
Definition: spatial_search.h:80
ModelPart::ElementsContainerType ElementsContainerType
Elements classes.
Definition: spatial_search.h:85
Definition: spheric_particle.h:31
virtual double GetSearchRadius()
Definition: spheric_particle.cpp:2201
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
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
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
float radius
Definition: mesh_to_mdpa_converter.py:18
distance_2
Definition: sp_statistics.py:71
integer i
Definition: TensorModule.f:17
Configure::ContainerType ContainerType
Definition: transfer_utility.h:247