7 #if !defined(KRATOS_NODE_CONFIGURE_INCLUDED)
8 #define KRATOS_NODE_CONFIGURE_INCLUDED
24 template <std::
size_t TDimension>
59 static void SetDomain(
const double domain_min_x,
const double domain_min_y,
const double domain_min_z,
60 const double domain_max_x,
const double domain_max_y,
const double domain_max_z)
68 SetPeriods(domain_max_x - domain_min_x, domain_max_y - domain_min_y, domain_max_z - domain_min_z);
72 static void SetPeriods(
double domain_period_x,
double domain_period_y,
double domain_period_z)
113 for (
unsigned int i = 0;
i < 3; ++
i){
114 const double incr_i = target[
i] - base_coordinates[
i];
116 if (std::abs(incr_i) > 0.5 * periods[
i]){
117 base_coordinates[
i] += GetSign(incr_i) * periods[
i];
124 for (
unsigned int i = 0;
i < 3; ++
i){
125 const double incr_i = target[
i] - base_coordinates[
i];
127 if (std::abs(incr_i) > 0.5 * periods[
i]){
128 base_coordinates[
i] += GetSign(incr_i) * periods[
i];
133 static inline void GetBoxCenter(
double box_center[3],
const double min_point[3],
const double max_point[3])
135 for (
unsigned int i = 0;
i < 3; ++
i){
136 box_center[
i] = 0.5 * (min_point[
i] + max_point[
i]);
138 if (min_point[
i] > max_point[
i]){
141 box_center[
i] += 0.5 * (
max -
min);
142 if (box_center[
i] >
max){
151 noalias(rHighPoint) = *rObject;
157 for(std::size_t
i = 0;
i < 3; ++
i){
158 rLowPoint[
i] = (*rObject)[
i] - Radius;
159 rHighPoint[
i] = (*rObject)[
i] + Radius;
177 double distance_squared;
179 const bool intersect = floatle(distance_squared, std::pow(Radius, 2));
195 double expanded_box_min[3];
196 double expanded_box_max[3];
198 for (
unsigned int i = 0;
i < 3; ++
i){
199 expanded_box_min[
i] = rLowPoint[
i] - Radius;
200 expanded_box_max[
i] = rHighPoint[
i] + Radius;
203 double box_center[3];
204 GetBoxCenter(box_center, expanded_box_min, expanded_box_max);
206 double representative_center_of_particle[3] = {center_of_particle[0],
207 center_of_particle[1],
208 center_of_particle[2]};
211 for (
unsigned int i = 0;
i < 3; ++
i){
212 const bool is_broken = rLowPoint[
i] > rHighPoint[
i];
215 intersect = floatge(expanded_box_min[
i], representative_center_of_particle[
i])
216 && floatle(expanded_box_max[
i], representative_center_of_particle[
i]);
220 intersect = floatle(expanded_box_min[
i], representative_center_of_particle[
i])
221 && floatge(expanded_box_max[
i], representative_center_of_particle[
i]);
227 for (
unsigned int i = 0;
i < 3; ++
i){
228 intersect = floatle(rLowPoint[
i] - Radius, center_of_particle[
i])
229 && floatge(rHighPoint[
i] + Radius, center_of_particle[
i]);
239 distance = std::sqrt(distance);
244 double rObj_2_to_rObj_1[3];
246 const double coors_1[3] = {point_1[0], point_1[1], point_1[2]};
248 const double coors_2[3] = {point_2[0], point_2[1], point_2[2]};
250 PeriodicSubstract(coors_1, coors_2, rObj_2_to_rObj_1);
261 virtual std::string
Info()
const {
return " Spatial Containers Configure for Nodes"; }
275 static inline int GetSign(
const double value)
277 return (0.0 < value) - (value < 0.0);
280 static inline void PeriodicSubstract(
const double a[3],
const double b[3],
double c[3])
282 for (
unsigned int i = 0;
i < 3; ++
i){
287 for (
unsigned int i = 0;
i < 3; ++
i){
295 static inline bool floateq(
double a,
double b) {
296 return std::fabs(
a -
b) < std::numeric_limits<double>::epsilon();
299 static inline bool floatle(
double a,
double b) {
300 return a <
b || std::fabs(
a -
b) < std::numeric_limits<double>::epsilon();
303 static inline bool floatge(
double a,
double b) {
304 return a >
b || std::fabs(
a -
b) < std::numeric_limits<double>::epsilon();
339 template <std::
size_t TDimension>
340 inline std::istream&
operator >> (std::istream& rIStream, NodeConfigure<TDimension> & rThis){
345 template <std::
size_t TDimension>
346 inline std::ostream&
operator << (std::ostream& rOStream,
const NodeConfigure<TDimension>& rThis){
347 rThis.PrintInfo(rOStream);
348 rOStream << std::endl;
349 rThis.PrintData(rOStream);
356 template <std::
size_t TDimension>
358 template <std::
size_t TDimension>
360 template <std::
size_t TDimension>
362 template <std::
size_t TDimension>
#define DEM_INNER_PRODUCT_3(a, b)
Definition: DEM_application_variables.h:31
This class defines the node.
Definition: node.h:65
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
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
integer i
Definition: TensorModule.f:17