10 #if !defined(KRATOS_TUBE_BOUNDING_BOX_H_INCLUDED )
11 #define KRATOS_TUBE_BOUNDING_BOX_H_INCLUDED
97 std::cout<<
"Calling Tube BBX empty constructor" <<std::endl;
117 "velocity": [0.0, 0.0, 0.0]
125 if(CustomParameters[
"parameters_list"].IsArray() ==
true && CustomParameters[
"parameters_list"].size() != 1)
132 Parameters BoxParameters = CustomParameters[
"parameters_list"][0];
231 bool is_inside =
false;
258 bool is_inside =
false;
281 unsigned int NodeId = 0;
287 unsigned int InitialNodeId = NodeId;
290 std::vector<std::string> BoundaryModelPartsName;
298 if( i_mp->Is(BOUNDARY) || i_mp->Is(ACTIVE) ){
299 for(ModelPart::NodesContainerType::iterator i_node = i_mp->NodesBegin() ; i_node != i_mp->NodesEnd() ; ++i_node)
301 if( i_node->Id() == rModelPart.
Nodes().front().Id() ){
302 BoundaryModelPartsName.push_back(i_mp->Name());
314 int number_of_segments = linear_partitions;
396 number_of_segments = 1;
398 for(
int j=0;
j<number_of_segments;
j++)
401 PointId =
j/
double(linear_partitions);
411 for(
int k=0;
k<angular_partitions;
k++)
413 alpha = (2.0 * 3.14159262 *
k)/(
double)angular_partitions;
416 RotationAxis = DirectionX *
alpha;
419 RotatedDirectionY = DirectionY;
432 NodeType::Pointer pNode = this->
CreateNode(rModelPart, BasePoint, NodeId);
434 pNode->Set(RIGID,
true);
438 for(
unsigned int j=0;
j<BoundaryModelPartsName.size();
j++)
439 (pMainModelPart->
GetSubModelPart(BoundaryModelPartsName[
j])).AddNode( pNode );
470 std::string
Info()
const override
472 return "TubeBoundingBox";
534 if( ie->GetGeometry().size() > 1){
536 GeneratrixPoint = Kratos::make_intrusive<NodeType>(
id, ie->GetGeometry()[0].X(), ie->GetGeometry()[0].Y(), ie->GetGeometry()[0].Z());
537 GeneratrixPoints.push_back( GeneratrixPoint );
546 ElementsContainerType::iterator LastElement = rModelPart.
ElementsEnd()-1;
547 int num_nodes = LastElement->GetGeometry().size()-1;
549 GeneratrixPoint = Kratos::make_intrusive<NodeType>(
id,LastElement->GetGeometry()[num_nodes].X(),LastElement->GetGeometry()[num_nodes].Y(),LastElement->GetGeometry()[num_nodes].Z());
550 GeneratrixPoints.push_back( GeneratrixPoint );
552 std::cout<<
" [DEFINED BY:"<<GeneratrixPoints.size()<<
" control points]"<<std::endl;
555 int SegmentsNumber = 250;
561 std::cout<<
" [REDEFINED WITH: "<<
mKnotsList.size()<<
" knots]"<<std::endl;
579 unsigned int bucket_size = 20;
583 unsigned int knots_begin = 1;
584 unsigned int knots_end = 3;
607 double GapNormal =
norm_2(rPoint-Projection)-rRadius;
644 rNormal = rPoint-Projection;
647 rNormal /=
norm_2(rNormal);
682 if( i_mp->Is(ACTIVE) )
688 if( i_mp->Is(ACTIVE) )
694 unsigned int ElementId = 0;
701 unsigned int NodeId = 0;
709 GeometryType::Pointer pFace;
710 ElementType::Pointer pElement;
714 Properties::Pointer pProperties = Kratos::make_shared<Properties>(number_of_properties);
716 unsigned int local_counter = 1;
718 unsigned int Id = rInitialNodeId;
727 if( local_counter < angular_partitions ){
729 FaceNodesIds[0] = rInitialNodeId +
counter ;
730 FaceNodesIds[1] = rInitialNodeId +
counter + 1;
731 FaceNodesIds[2] = rInitialNodeId +
counter + angular_partitions + 1;
732 FaceNodesIds[3] = rInitialNodeId +
counter + angular_partitions;
743 for(
unsigned int j=0;
j<4;
j++)
746 pFace = Kratos::make_shared<Quadrilateral3D4<NodeType> >(FaceNodes);
747 pElement = Kratos::make_intrusive<Element>(ElementId, pFace, pProperties);
750 pElement->Set(ACTIVE,
false);
751 pComputingModelPart->AddElement(pElement);
756 else if( local_counter == angular_partitions ){
758 FaceNodesIds[0] = rInitialNodeId +
counter ;
759 FaceNodesIds[1] = rInitialNodeId +
counter + 1 - angular_partitions;
760 FaceNodesIds[2] = rInitialNodeId +
counter + 1;
761 FaceNodesIds[3] = rInitialNodeId +
counter + angular_partitions;
768 for(
unsigned int j=0;
j<4;
j++)
771 pFace = Kratos::make_shared<Quadrilateral3D4<NodeType> >(FaceNodes);
772 pElement = Kratos::make_intrusive<Element>(ElementId, pFace, pProperties);
775 pElement->Set(ACTIVE,
false);
776 pComputingModelPart->AddElement(pElement);
781 Id = rInitialNodeId +
counter + angular_partitions;
Short class definition.
Definition: bucket.h:57
Base class for all Elements.
Definition: element.h:60
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
SubModelPartIterator SubModelPartsEnd()
Definition: model_part.h:1708
SubModelPartIterator SubModelPartsBegin()
Definition: model_part.h:1698
void AddNode(NodeType::Pointer pNewNode, IndexType ThisIndex=0)
Definition: model_part.cpp:211
SizeType NumberOfProperties(IndexType ThisIndex=0) const
Returns the number of properties of the mesh.
Definition: model_part.cpp:575
bool IsSubModelPart() const
Definition: model_part.h:1893
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
SubModelPartsContainerType::iterator SubModelPartIterator
Iterator over the sub model parts of this model part.
Definition: model_part.h:258
NodeType::Pointer pGetNode(IndexType NodeId, IndexType ThisIndex=0)
Definition: model_part.h:421
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
void AddElement(ElementType::Pointer pNewElement, IndexType ThisIndex=0)
Definition: model_part.cpp:917
ModelPart & GetParentModelPart()
Definition: model_part.cpp:2124
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
const std::string PrettyPrintJsonString() const
This method returns a string with the corresponding text to the equivalent *.json file (this version ...
Definition: kratos_parameters.cpp:415
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
Point class.
Definition: point.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void reserve(size_type dim)
Definition: pointer_vector.h:319
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
void RotateVector3(const TVector3_A &a, TVector3_B &b) const
Definition: quaternion.h:325
static Quaternion FromRotationVector(double rx, double ry, double rz)
Definition: quaternion.h:427
Short class definition.
Definition: spatial_bounding_box.hpp:48
bool mRigidBodyCenterSupplied
Definition: spatial_bounding_box.hpp:1150
void CalculateOrthonormalBase(PointType &rDirectionVectorX, PointType &rDirectionVectorY, PointType &rDirectionVectorZ)
Definition: spatial_bounding_box.hpp:1408
void ComputeContactTangent(BoundingBoxParameters &rValues, const ProcessInfo &rCurrentProcessInfo)
Definition: spatial_bounding_box.hpp:1274
NodeType::Pointer CreateNode(ModelPart &rModelPart, PointType &rPoint, const unsigned int &rNodeId)
Definition: spatial_bounding_box.hpp:1357
static unsigned int GetMaxNodeId(ModelPart &rModelPart)
Definition: spatial_bounding_box.hpp:1314
static unsigned int GetMaxElementId(ModelPart &rModelPart)
Definition: spatial_bounding_box.hpp:1334
BoundingBoxVariables mBox
Definition: spatial_bounding_box.hpp:1152
virtual SpatialBoundingBox & operator=(SpatialBoundingBox const &rOther)
Assignment operator.
Definition: spatial_bounding_box.hpp:540
Short class definition.
Definition: spline_curve_utilities.hpp:44
PointType PointOnCurveFirstDerivative(const SplineType &rSpline, double &t, double s=0.5)
Definition: spline_curve_utilities.hpp:1006
void SetSpline(SplineType &rOutputSpline, const SplineType &rInputSpline)
Definition: spline_curve_utilities.hpp:509
PointType & CalculatePointProjection(const PointType &rPoint, KdtreeType &rKnotsKdtree, const NodePointerTypeVector &rKnotsList, PointType &rPointProjection)
Definition: spline_curve_utilities.hpp:567
PointType & PointOnCurve(PointType &rPoint, const SplineType &rSpline, double &t, double s=0.5)
Definition: spline_curve_utilities.hpp:987
void CreateParametrizedCurve(NodePointerTypeVector &rGeneratrixPoints, NodePointerTypeVector &rKnotsList, int m)
Definition: spline_curve_utilities.hpp:101
A generic tree data structure for spatial partitioning.
Definition: tree.h:190
Short class definition.
Definition: tube_bounding_box.hpp:57
bool ContactSearch(BoundingBoxParameters &rValues, const ProcessInfo &rCurrentProcessInfo)
Definition: tube_bounding_box.hpp:626
bool IsInside(const PointType &rPoint, double &rCurrentTime, double Radius=0) override
Definition: tube_bounding_box.hpp:226
bool ContactSearch(const PointType &rPoint, const double &rRadius)
Definition: tube_bounding_box.hpp:597
array_1d< double, 3 > PointType
Definition: tube_bounding_box.hpp:66
TubeBoundingBox(TubeBoundingBox const &rOther)
Copy constructor.
Definition: tube_bounding_box.hpp:198
std::string Info() const override
Turn back information as a string.
Definition: tube_bounding_box.hpp:470
KRATOS_CLASS_POINTER_DEFINITION(TubeBoundingBox)
Pointer definition of TubeBoundingBox.
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: tube_bounding_box.hpp:476
virtual ~TubeBoundingBox()
Destructor.
Definition: tube_bounding_box.hpp:210
std::vector< NodeType > NodeTypeVector
Definition: tube_bounding_box.hpp:78
ModelPart::ElementType ElementType
Definition: tube_bounding_box.hpp:72
Node NodeType
Definition: tube_bounding_box.hpp:67
TubeBoundingBox & operator=(TubeBoundingBox const &rOther)
Assignment operator.
Definition: tube_bounding_box.hpp:180
TubeBoundingBox(ModelPart &rModelPart, Parameters CustomParameters)
Definition: tube_bounding_box.hpp:106
std::vector< NodeType::Pointer > mKnotsList
Definition: tube_bounding_box.hpp:498
Bucket< 3, NodeType, NodePointerTypeVector, NodePointerType, NodePointerIterator, DistanceIterator > BucketType
Definition: tube_bounding_box.hpp:82
Tree< KDTreePartition< BucketType > > KdtreeType
Definition: tube_bounding_box.hpp:83
ElementType::GeometryType GeometryType
Definition: tube_bounding_box.hpp:73
std::vector< double > DistanceVector
Definition: tube_bounding_box.hpp:80
NodePointerTypeVector::iterator NodePointerIterator
Definition: tube_bounding_box.hpp:79
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: tube_bounding_box.hpp:482
KdtreeType * mpKnotsKdtree
Definition: tube_bounding_box.hpp:500
ModelPart::NodesContainerType NodesContainerType
Definition: tube_bounding_box.hpp:68
std::vector< NodePointerType > NodePointerTypeVector
Definition: tube_bounding_box.hpp:77
NodesContainerType::Pointer NodesContainerTypePointer
Definition: tube_bounding_box.hpp:69
TubeBoundingBox()
Default constructor.
Definition: tube_bounding_box.hpp:93
void CreateKnotsKdtree()
Definition: tube_bounding_box.hpp:573
NodeType::Pointer NodePointerType
Definition: tube_bounding_box.hpp:76
ModelPart::ElementsContainerType ElementsContainerType
Definition: tube_bounding_box.hpp:70
void CreateQuadrilateralBoundaryMesh(ModelPart &rModelPart, const unsigned int &rInitialNodeId, const unsigned int &angular_partitions)
Definition: tube_bounding_box.hpp:670
std::vector< double >::iterator DistanceIterator
Definition: tube_bounding_box.hpp:81
Quaternion< double > QuaternionType
Definition: tube_bounding_box.hpp:71
TubeBoundingBox(ModelPart &rModelPart, double Radius, int Convexity)
Definition: tube_bounding_box.hpp:155
void CreateBoundingBoxBoundaryMesh(ModelPart &rModelPart, int linear_partitions=4, int angular_partitions=4) override
Definition: tube_bounding_box.hpp:275
void CreateKnotsList(ModelPart &rModelPart)
Definition: tube_bounding_box.hpp:521
SplineCurveUtilities mSplineCurveUtilities
Definition: tube_bounding_box.hpp:502
bool IsInside(BoundingBoxParameters &rValues, const ProcessInfo &rCurrentProcessInfo) override
Definition: tube_bounding_box.hpp:254
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int counter
Definition: script_THERMAL_CORRECT.py:218
integer i
Definition: TensorModule.f:17
Definition: spatial_bounding_box.hpp:61
void SetContactFace(int ContactFace)
Definition: spatial_bounding_box.hpp:178
PointType & GetTangent()
Definition: spatial_bounding_box.hpp:189
double & GetGapNormal()
Definition: spatial_bounding_box.hpp:193
const PointType & GetPoint()
Definition: spatial_bounding_box.hpp:181
PointType & GetNormal()
Definition: spatial_bounding_box.hpp:188
int Convexity
Definition: spatial_bounding_box.hpp:210
PointType Velocity
Definition: spatial_bounding_box.hpp:221
PointType LowerPoint
Definition: spatial_bounding_box.hpp:218
double Radius
Definition: spatial_bounding_box.hpp:211
void Initialize()
Definition: spatial_bounding_box.hpp:229
PointType UpperPoint
Definition: spatial_bounding_box.hpp:217
void SetInitialValues()
Definition: spatial_bounding_box.hpp:253
Definition: spline_curve_utilities.hpp:66