7 #if !defined(KRATOS_RIGID_FACE_GEOMETRICAL_OBJECT_CONFIGURE_INCLUDED)
8 #define KRATOS_RIGID_FACE_GEOMETRICAL_OBJECT_CONFIGURE_INCLUDED
46 template <std::
size_t TDimension>
72 std::less<typename IndexedObject::result_type>,
73 std::equal_to<typename IndexedObject::result_type>,
74 typename GeometricalObject::Pointer,
75 std::vector< typename GeometricalObject::Pointer >
112 noalias(rHighPoint) = rObject->GetGeometry()[0];
113 noalias(rLowPoint) = rObject->GetGeometry()[0];
115 for(std::size_t
i = 0;
i < 3;
i++)
117 rLowPoint[
i] += -Radius;
118 rHighPoint[
i] += Radius;
130 double xyz_min[3] = { 1e20, 1e20, 1e20};
131 double xyz_max[3] = {-1e20, -1e20, -1e20};
133 for (std::size_t inode = 0; inode < rObject->GetGeometry().size(); inode++)
137 xyz_min[0] = (xyz_min[0] > Coord[0]) ? Coord[0] : xyz_min[0];
138 xyz_min[1] = (xyz_min[1] > Coord[1]) ? Coord[1] : xyz_min[1];
139 xyz_min[2] = (xyz_min[2] > Coord[2]) ? Coord[2] : xyz_min[2];
141 xyz_max[0] = (xyz_max[0] < Coord[0]) ? Coord[0] : xyz_max[0];
142 xyz_max[1] = (xyz_max[1] < Coord[1]) ? Coord[1] : xyz_max[1];
143 xyz_max[2] = (xyz_max[2] < Coord[2]) ? Coord[2] : xyz_max[2];
146 for(std::size_t
i = 0;
i < 3;
i++)
148 rLowPoint [
i] = xyz_min[
i];
149 rHighPoint[
i] = xyz_max[
i];
152 const double domain_size = rObject->GetGeometry().DomainSize();
154 for(std::size_t
i = 0;
i < 3;
i++)
168 double xyz_min[3] = { 1e20, 1e20, 1e20};
169 double xyz_max[3] = {-1e20, -1e20, -1e20};
171 for (std::size_t inode = 0; inode < rObject->GetGeometry().size(); inode++) {
173 xyz_min[0] = (xyz_min[0] > Coord[0]) ? Coord[0] : xyz_min[0];
174 xyz_min[1] = (xyz_min[1] > Coord[1]) ? Coord[1] : xyz_min[1];
175 xyz_min[2] = (xyz_min[2] > Coord[2]) ? Coord[2] : xyz_min[2];
177 xyz_max[0] = (xyz_max[0] < Coord[0]) ? Coord[0] : xyz_max[0];
178 xyz_max[1] = (xyz_max[1] < Coord[1]) ? Coord[1] : xyz_max[1];
179 xyz_max[2] = (xyz_max[2] < Coord[2]) ? Coord[2] : xyz_max[2];
182 bool intersect = (rLowPoint [0] <= xyz_max[0] && rLowPoint [1] <= xyz_max[1] && rLowPoint [2] <= xyz_max[2] &&
183 rHighPoint[0] >= xyz_min[0] && rHighPoint[1] >= xyz_min[1] && rHighPoint[2] >= xyz_min[2]);
194 floatle(rLowPoint[0] -
radius,center_of_particle[0]) &&
195 floatle(rLowPoint[1] -
radius,center_of_particle[1]) &&
196 floatle(rLowPoint[2] -
radius,center_of_particle[2]) &&
197 floatge(rHighPoint[0] +
radius,center_of_particle[0]) &&
198 floatge(rHighPoint[1] +
radius,center_of_particle[1]) &&
199 floatge(rHighPoint[2] +
radius,center_of_particle[2]));
208 std::vector< array_1d<double,3> > Coord(2);
210 for (
unsigned int i = 0;
i<2;
i++) {
211 for (
unsigned int j = 0;
j<3;
j++) {
212 Coord[
i][
j] = FE_Geom[
i].Coordinates()[
j];
222 bool ContactExists =
false;
224 unsigned int FE_size = FE_Geom.
size();
225 std::vector< array_1d<double,3> > Coord(FE_size);
228 for (
unsigned int i = 0;
i<FE_size;
i++) {
229 for (
unsigned int j = 0;
j<3;
j++) {
230 Coord[
i][
j] = FE_Geom[
i].Coordinates()[
j];
234 double distance_point_to_plane = 0.0;
235 unsigned int current_edge_index = 0;
239 if (ContactExists){
return true;}
244 else if (distance_point_to_plane < Radius) {
245 bool local_contact_exists =
false;
246 for (
unsigned int e = current_edge_index;
e < FE_size;
e++ ) {
248 if (local_contact_exists) {
return true;}
262 const int facet_size = FE_Geom.
size();
265 else if (facet_size==2) {
278 const int facet_size = FE_Geom.
size();
281 else if (facet_size==2) {
292 int facet_size = FE_Geom.
size();
295 else if (facet_size==2) {
310 distance = std::sqrt((center_of_particle1[0] - center_of_particle2[0]) * (center_of_particle1[0] - center_of_particle2[0]) +
311 (center_of_particle1[1] - center_of_particle2[1]) * (center_of_particle1[1] - center_of_particle2[1]) +
312 (center_of_particle1[2] - center_of_particle2[2]) * (center_of_particle1[2] - center_of_particle2[2]) );
318 const double LocalCoordSystem[3][3],
319 const double DistPToB,
320 std::vector<double> Weight,
322 std::vector< double > & Distance_Array,
325 std::vector<int> & Id_Array,
326 std::vector<int> & ContactTypes
330 int new_ID = rObj_2->
Id();
331 std::size_t i_current = Normal_Array.size();
332 std::size_t neighbor_size = Normal_Array.size();
334 bool substitute =
false;
335 int position = i_current;
337 for (std::size_t i_old_neigh = 0; i_old_neigh < neighbor_size; i_old_neigh++)
341 double Old_Normal_Vector[3] = {0.0};
342 Old_Normal_Vector[0] = Normal_Array[i_old_neigh][0];
343 Old_Normal_Vector[1] = Normal_Array[i_old_neigh][1];
344 Old_Normal_Vector[2] = Normal_Array[i_old_neigh][2];
346 double New_Dist = DistPToB;
347 double Old_dist = Distance_Array[i_old_neigh];
350 double New_projected_distance = New_projected_on_old * New_Dist;
351 double Old_projected_distance = New_projected_on_old * Old_dist;
353 if (New_projected_distance - Old_dist > -1.0e-6 * std::abs(Old_dist)) {
357 if (Old_projected_distance - New_Dist > -1.0e-6 * std::abs(New_Dist)) {
359 int old_ID = Id_Array[i_old_neigh];
360 if (new_ID == old_ID) {
361 position = i_old_neigh;
366 ContactTypes[i_old_neigh] = -1;
376 Distance_Array.resize(neighbor_size+1);
377 Weight_Array.resize(neighbor_size+1);
378 Normal_Array.resize(neighbor_size+1);
379 Id_Array.resize(neighbor_size+1);
380 ContactTypes.resize(neighbor_size+1);
382 neighbour_rigid_faces.push_back(rObj_2);
385 Normal_Array[position][0] = LocalCoordSystem[2][0];
386 Normal_Array[position][1] = LocalCoordSystem[2][1];
387 Normal_Array[position][2] = LocalCoordSystem[2][2];
388 Weight_Array[position][0] = Weight[0];
389 Weight_Array[position][1] = Weight[1];
390 Weight_Array[position][2] = Weight[2];
391 Weight_Array[position][3] = Weight[3];
392 Distance_Array[position] = DistPToB;
394 Id_Array[position] = new_ID;
395 ContactTypes[position] = ContactType;
404 std::vector< double > & Distance_Array,
407 std::vector< int >& Id_Array,
408 std::vector<int> & ContactType_Array
412 unsigned int FE_size = FE_Geom.
size();
417 else if (FE_size==2) {
428 std::vector< double > & Distance_Array,
431 std::vector< int >& Id_Array,
432 std::vector< int >& ContactType_Array
438 int ContactType = -1;
445 bool ContactExists =
false;
451 unsigned int FE_size = FE_Geom.
size();
453 double local_coord_system[3][3] = { {0.0},{0.0},{0.0} };
454 std::vector<double> Weight(4,0.0);
456 double distance_point_to_plane = 0.0;
457 unsigned int current_edge_index = 0;
460 distance_point_to_plane, Weight, current_edge_index, inside);
461 if (ContactExists ==
true) {
463 ContactExists =
DistanceHierarchy(rObj_1,rObj_2, local_coord_system, distance_point_to_plane, Weight, ContactType, Distance_Array, Normal_Array,Weight_Array, Id_Array, ContactType_Array);
471 if (!ContactExists) {
474 if (distance_point_to_plane < Radius) {
475 bool local_contact_exists =
false;
476 for (
unsigned int e = current_edge_index;
e < FE_size;
e++) {
478 double distance_point_to_edge = 2.0 * Radius;
481 distance_point_to_edge, eta);
482 if (local_contact_exists) {
486 Weight[(
e + 1) % FE_size] = eta;
487 if (FE_size > 4) {
KRATOS_WATCH(
"WEIGHTS ALONG EDGE CANT BE CALCULATED WITH SUKUMAR FORMULAE") }
488 ContactExists =
DistanceHierarchy(rObj_1, rObj_2, local_coord_system, distance_point_to_edge, Weight, ContactType, Distance_Array, Normal_Array, Weight_Array, Id_Array, ContactType_Array);
491 if ((local_contact_exists ==
false) && (distance_point_to_edge < Radius)) {
492 unsigned int vertex_to_check = -1;
493 if (eta < 0.0) { vertex_to_check =
e; }
494 else if (eta > 1.0) { vertex_to_check = (
e + 1) % FE_size; }
496 double distance_point_to_vertex = 0.0;
497 local_contact_exists =
GeometryFunctions::VertexCheck(FE_Geom[vertex_to_check], DE_Geom[0].Coordinates(), Radius, local_coord_system, distance_point_to_vertex);
499 if (local_contact_exists) {
501 Weight[vertex_to_check] = 1.0;
502 ContactExists =
DistanceHierarchy(rObj_1, rObj_2, local_coord_system, distance_point_to_vertex, Weight, ContactType, Distance_Array, Normal_Array, Weight_Array, Id_Array, ContactType_Array);
521 std::vector< double > & Distance_Array,
524 std::vector< int > & Id_Array,
525 std::vector< int > & ContactType_Array
529 int ContactType = -1;
534 bool ContactExists =
false;
542 double local_coord_system[3][3] = { {0.0},{0.0},{0.0} };
543 std::vector<double> Weight(4,0.0);
544 std::vector< array_1d<double,3> > Coord(2);
546 for (
unsigned int i = 0;
i<2;
i++) {
547 for (
unsigned int j = 0;
j<3;
j++) {
548 Coord[
i][
j] = FE_Geom[
i].Coordinates()[
j];
553 double distance_point_to_edge = 2*Radius;
556 distance_point_to_edge, eta);
562 ContactExists =
DistanceHierarchy(rObj_1,rObj_2, local_coord_system, distance_point_to_edge, Weight, ContactType, Distance_Array, Normal_Array, Weight_Array, Id_Array, ContactType_Array);
566 if (ContactExists ==
false) {
567 if (distance_point_to_edge < Radius) {
568 unsigned int vertex_to_check = -1;
569 if (eta < 0.0) { vertex_to_check = 0; }
570 else if (eta > 1.0) { vertex_to_check = 1; }
571 double distance_point_to_vertex = 0.0;
572 ContactExists =
GeometryFunctions::VertexCheck(Coord[vertex_to_check], DE_Geom[0].Coordinates(), Radius, local_coord_system, distance_point_to_vertex);
576 Weight[vertex_to_check] = 1.0;
577 ContactExists =
DistanceHierarchy(rObj_1, rObj_2, local_coord_system, distance_point_to_vertex, Weight, ContactType, Distance_Array, Normal_Array, Weight_Array, Id_Array, ContactType_Array);
582 if ((eta >= 0.0) && (eta <= 1.0))
592 std::vector< double > & Distance_Array,
595 std::vector< int > & Id_Array,
596 std::vector< int > & ContactType_Array
600 int ContactType = -1;
604 bool ContactExists =
false;
612 double local_coord_system[3][3] = { {0.0},{0.0},{0.0} };
613 std::vector<double> Weight(4,0.0);
615 double distance_point_to_vertex = 0.0;
617 DE_Geom[0].Coordinates(), Radius, local_coord_system,
618 distance_point_to_vertex);
624 distance_point_to_vertex, Weight, ContactType, Distance_Array,
625 Normal_Array, Weight_Array, Id_Array, ContactType_Array);
648 virtual std::string
Info()
const {
return " Spatial Containers Configure for RigidFace"; }
709 static inline bool floateq(
double a,
double b) {
710 return std::fabs(
a -
b) < std::numeric_limits<double>::epsilon();
713 static inline bool floatle(
double a,
double b) {
714 return std::fabs(
a -
b) < std::numeric_limits<double>::epsilon() ||
a <
b;
717 static inline bool floatge(
double a,
double b) {
718 return std::fabs(
a -
b) < std::numeric_limits<double>::epsilon() ||
a >
b;
753 template <std::
size_t TDimension>
759 template <std::
size_t TDimension>
762 rOStream << std::endl;
#define DEM_INNER_PRODUCT_3(a, b)
Definition: DEM_application_variables.h:31
Definition: dem_wall.h:29
This defines the geometrical object, base definition of the element and condition entities.
Definition: geometrical_object.h:58
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
This object defines an indexed object.
Definition: indexed_object.h:54
IndexType Id() const
Definition: indexed_object.h:107
Point class.
Definition: point.h:59
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
TContainerType ContainerType
Definition: pointer_vector_set.h:90
This class is used to search for elements, conditions and nodes in a given model part.
Definition: spatial_search.h:50
Definition: spheric_particle.h:31
std::vector< DEMWall * > mNeighbourNonContactRigidFaces
Definition: spheric_particle.h:252
virtual double GetInteractionRadius(const int radius_index=0)
Definition: spheric_particle.cpp:2199
virtual double GetSearchRadius()
Definition: spheric_particle.cpp:2201
std::vector< DEMWall * > mNeighbourRigidFaces
Definition: spheric_particle.h:251
#define KRATOS_WATCH(variable)
Definition: define.h:806
static bool FastFacetCheck(const std::vector< array_1d< double, 3 > > &Coord, const array_1d< double, 3 > &Particle_Coord, double rad, double &DistPToB, unsigned int ¤t_edge_index)
Definition: GeometryFunctions.h:1053
static bool FastVertexCheck(const array_1d< double, 3 > &Coord, const array_1d< double, 3 > &Particle_Coord, double Radius)
Definition: GeometryFunctions.h:1359
static bool EdgeCheck(const array_1d< double, 3 > &Coord1, const array_1d< double, 3 > &Coord2, const array_1d< double, 3 > &Particle_Coord, double Radius, double LocalCoordSystem[3][3], double &DistParticleToEdge, double &eta)
Definition: GeometryFunctions.h:1288
static bool FastEdgeVertexCheck(const array_1d< double, 3 > &Coord1, const array_1d< double, 3 > &Coord2, const array_1d< double, 3 > &Particle_Coord, double Radius)
Definition: GeometryFunctions.h:1215
static bool VertexCheck(const array_1d< double, 3 > &Coord, const array_1d< double, 3 > &Particle_Coord, double Radius, double LocalCoordSystem[3][3], double &DistParticleToVertex)
Definition: GeometryFunctions.h:1340
static bool FacetCheck(const GeometryType &Coord, const array_1d< double, 3 > &Particle_Coord, double rad, double LocalCoordSystem[3][3], double &DistPToB, std::vector< double > &Weight, unsigned int ¤t_edge_index, bool &inside)
Definition: GeometryFunctions.h:1118
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
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
int domain_size
Definition: face_heat.py:4
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
float radius
Definition: mesh_to_mdpa_converter.py:18
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31