28 #include "utilities/geometry_utilities.h"
61 template<
class TPo
intType>
175 Line3D2(
typename PointType::Pointer pFirstPoint,
typename PointType::Pointer pSecondPoint )
183 :
BaseType( ThisPoints, &msGeometryData )
193 ) :
BaseType(GeometryId, ThisPoints, &msGeometryData)
200 const std::string& rGeometryName,
202 ) :
BaseType(rGeometryName, rThisPoints, &msGeometryData)
281 template<
class TOtherPo
intType>
304 return typename BaseType::Pointer(
new Line3D2( NewGeometryId, rThisPoints ) );
318 auto p_geometry =
typename BaseType::Pointer(
new Line3D2( NewGeometryId, rGeometry.
Points() ) );
319 p_geometry->SetData(rGeometry.
GetData());
336 if(rResult.size() != 2)
337 rResult.
resize( 2,
false );
363 const double lx = point0.X() - point1.X();
364 const double ly = point0.Y() - point1.Y();
365 const double lz = point0.Z() - point1.Z();
367 const double length = lx * lx + ly * ly + lz * lz;
369 return std::sqrt( length );
422 Point intersection_point;
444 const double Tolerance = std::numeric_limits<double>::epsilon()
447 const Point point(rPointGlobalCoordinates);
472 jacobian( 0, 0 ) = ( this->
GetPoint( 1 ).X() - this->
GetPoint( 0 ).X() ) * 0.5;
473 jacobian( 1, 0 ) = ( this->
GetPoint( 1 ).Y() - this->
GetPoint( 0 ).Y() ) * 0.5;
474 jacobian( 2, 0 ) = ( this->
GetPoint( 1 ).Z() - this->
GetPoint( 0 ).Z() ) * 0.5;
483 std::fill( rResult.
begin(), rResult.
end(), jacobian );
508 jacobian( 0, 0 ) = ( (this->
GetPoint( 1 ).X() - DeltaPosition(1,0)) - (this->
GetPoint( 0 ).X() - DeltaPosition(0,0)) ) * 0.5;
509 jacobian( 1, 0 ) = ( (this->
GetPoint( 1 ).Y() - DeltaPosition(1,1)) - (this->
GetPoint( 0 ).Y() - DeltaPosition(0,1)) ) * 0.5;
510 jacobian( 2, 0 ) = ( (this->
GetPoint( 1 ).Z() - DeltaPosition(1,2)) - (this->
GetPoint( 0 ).Z() - DeltaPosition(0,2)) ) * 0.5;
519 std::fill( rResult.
begin(), rResult.
end(), jacobian );
543 rResult.
resize( 3, 1,
false );
545 rResult( 0, 0 ) = ( this->
GetPoint( 1 ).X() - this->
GetPoint( 0 ).X() ) * 0.5;
546 rResult( 1, 0 ) = ( this->
GetPoint( 1 ).Y() - this->
GetPoint( 0 ).Y() ) * 0.5;
547 rResult( 2, 0 ) = ( this->
GetPoint( 1 ).Z() - this->
GetPoint( 0 ).Z() ) * 0.5;
564 rResult.
resize( 3, 1,
false );
566 rResult( 0, 0 ) = ( this->
GetPoint( 1 ).X() - this->
GetPoint( 0 ).X() ) * 0.5;
567 rResult( 1, 0 ) = ( this->
GetPoint( 1 ).Y() - this->
GetPoint( 0 ).Y() ) * 0.5;
568 rResult( 2, 0 ) = ( this->
GetPoint( 1 ).Z() - this->
GetPoint( 0 ).Z() ) * 0.5;
586 if(rResult.size() != integration_points_number)
588 rResult.
resize(integration_points_number,
false);
591 const double detJ = 0.5*(this->
Length());
593 for (
unsigned int pnt = 0; pnt < integration_points_number; pnt++ )
620 return 0.5*(this->
Length());
637 return 0.5*(this->
Length());
769 if(rResult.size() != 2) {
773 rResult[0] = 0.5 * ( 1.0 - rCoordinates[0]);
774 rResult[1] = 0.5 * ( 1.0 + rCoordinates[0]);
791 switch ( ShapeFunctionIndex )
794 return( 0.5*( 1.0 - rPoint[0] ) );
797 return( 0.5*( 1.0 + rPoint[0] ) );
800 KRATOS_ERROR <<
"Wrong index of shape function!" << *
this << std::endl;
810 rResult( 0, 0 ) = -0.5;
811 rResult( 1, 0 ) = 0.5;
821 KRATOS_ERROR <<
"ERROR: Line3D2 can not define a normal. Please, define the normal in your implementation" << std::endl;
836 const double Tolerance = std::numeric_limits<double>::epsilon()
841 if ( std::abs( rResult[0] ) <= (1.0 + Tolerance) ) {
879 const double tolerance = 1
e-14;
881 const double length =
Length();
883 const double length_1 = std::sqrt( std::pow(rPoint[0] - r_first_point[0], 2)
884 + std::pow(rPoint[1] - r_first_point[1], 2) + std::pow(rPoint[2] - r_first_point[2], 2));
886 const double length_2 = std::sqrt( std::pow(rPoint[0] - r_second_point[0], 2)
887 + std::pow(rPoint[1] - r_second_point[1], 2) + std::pow(rPoint[2] - r_second_point[2], 2));
889 if (length_1 <= (length + tolerance) && length_2 <= (length + tolerance)) {
890 rResult[0] = 2.0 * length_1/(length + tolerance) - 1.0;
891 }
else if (length_1 > (length + tolerance)) {
892 rResult[0] = 2.0 * length_1/(length + tolerance) - 1.0;
893 }
else if (length_2 > (length + tolerance)) {
894 rResult[0] = 1.0 - 2.0 * length_2/(length + tolerance);
912 std::string
Info()
const override
914 return "1 dimensional line with 2 nodes in 3D space";
925 rOStream <<
"1 dimensional line with 2 nodes in 3D space";
940 std::cout << std::endl;
946 rOStream <<
" Jacobian\t : " << jacobian;
1012 void save(
Serializer& rSerializer )
const override
1039 Matrix N( integration_points_number, 2 );
1041 for (
int it_gp = 0; it_gp < integration_points_number; it_gp++ )
1044 N( it_gp, 0 ) = 0.5 * ( 1 -
e );
1045 N( it_gp, 1 ) = 0.5 * ( 1 +
e );
1060 aux_mat(0,0) = -0.5;
1062 DN_De[it_gp] = aux_mat;
1072 Quadrature<LineGaussLegendreIntegrationPoints1, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1073 Quadrature<LineGaussLegendreIntegrationPoints2, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1074 Quadrature<LineGaussLegendreIntegrationPoints3, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1075 Quadrature<LineGaussLegendreIntegrationPoints4, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1076 Quadrature<LineGaussLegendreIntegrationPoints5, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1077 Quadrature<LineCollocationIntegrationPoints1, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1078 Quadrature<LineCollocationIntegrationPoints2, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1079 Quadrature<LineCollocationIntegrationPoints3, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1080 Quadrature<LineCollocationIntegrationPoints4, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1081 Quadrature<LineCollocationIntegrationPoints5, 1, IntegrationPoint<3> >::GenerateIntegrationPoints()
1084 return integration_points;
1102 return shape_functions_values;
1121 return shape_functions_local_gradients;
1138 template<
class TOtherPo
intType>
friend class Line3D2;
1160 template<
class TPo
intType>
1165 template<
class TPo
intType>
1170 rOStream << std::endl;
1179 template<
class TPo
intType>
1180 const GeometryData Line3D2<TPointType>::msGeometryData(
1183 Line3D2<TPointType>::AllIntegrationPoints(),
1184 Line3D2<TPointType>::AllShapeFunctionsValues(),
1185 AllShapeFunctionsLocalGradients() );
1187 template<
class TPo
intType>
Definition: geometry_data.h:60
KratosGeometryType
Definition: geometry_data.h:110
SizeType IntegrationPointsNumber() const
Definition: geometry_data.h:430
IntegrationMethod
Definition: geometry_data.h:76
KratosGeometryFamily
Definition: geometry_data.h:91
Definition: geometry_dimension.h:42
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry.h:3834
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
SizeType LocalSpaceDimension() const
Definition: geometry.h:1300
virtual bool HasIntersection(const GeometryType &ThisGeometry) const
Definition: geometry.h:1453
std::size_t SizeType
Definition: geometry.h:144
const TPointType::Pointer pGetPoint(const int Index) const
Definition: geometry.h:1790
std::size_t IndexType
Definition: geometry.h:137
std::array< Matrix, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Definition: geometry.h:172
const PointsArrayType & Points() const
Definition: geometry.h:1768
bool AllPointsAreValid() const
Checks if the geometry points are valid Checks if the geometry points are valid from the pointer valu...
Definition: geometry.h:4093
std::array< IntegrationPointsArrayType, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry.h:167
LumpingMethods
This defines the different methods to compute the lumping methods.
Definition: geometry.h:109
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
SizeType IntegrationPointsNumber() const
Definition: geometry.h:2257
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
static double PointDistanceToLineSegment3D(const Point &rLinePoint1, const Point &rLinePoint2, const Point &rToPoint)
This function calculates the distance of a 3D point to a 3D line segment.
Definition: geometry_utilities.cpp:129
Short class definition.
Definition: integration_point.h:52
Definition: amatrix_interface.h:41
void swap(Matrix &Other)
Definition: amatrix_interface.h:289
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
iterator end()
Definition: amatrix_interface.h:243
iterator begin()
Definition: amatrix_interface.h:241
static int ComputeLineBoxIntersection(const array_1d< double, 3 > &rBoxPoint0, const array_1d< double, 3 > &rBoxPoint1, const array_1d< double, 3 > &rLinePoint0, const array_1d< double, 3 > &rLinePoint1)
Compute a segment box intersection Provided the minimum and maximum points of a box cell,...
Definition: intersection_utilities.h:765
static int ComputeLineLineIntersection(const TGeometryType &rLineGeometry, const array_1d< double, 3 > &rLinePoint0, const array_1d< double, 3 > &rLinePoint1, array_1d< double, 3 > &rIntersectionPoint, const double epsilon=1e-12)
Definition: intersection_utilities.h:626
An two node 3D line geometry with linear shape functions.
Definition: line_3d_2.h:64
Line3D2(Line3D2 const &rOther)
Definition: line_3d_2.h:215
void PrintInfo(std::ostream &rOStream) const override
Definition: line_3d_2.h:923
bool HasIntersection(const BaseType &rThisGeometry) const override
Test if this geometry intersects with other geometry.
Definition: line_3d_2.h:415
Matrix & InverseOfJacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_3d_2.h:697
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: line_3d_2.h:313
Line3D2(Line3D2< TOtherPointType > const &rOther)
Definition: line_3d_2.h:232
~Line3D2() override
Destructor. Do nothing!!!
Definition: line_3d_2.h:238
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_3d_2.h:806
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: line_3d_2.h:129
TPointType PointType
Definition: line_3d_2.h:92
GeometryData::IntegrationMethod IntegrationMethod
Definition: line_3d_2.h:83
BaseType::JacobiansType JacobiansType
Definition: line_3d_2.h:145
Vector & LumpingFactors(Vector &rResult, const typename BaseType::LumpingMethods LumpingMethod=BaseType::LumpingMethods::ROW_SUM) const override
Lumping factors for the calculation of the lumped mass matrix.
Definition: line_3d_2.h:331
SizeType EdgesNumber() const override
This method gives you number of all edges of this geometry.
Definition: line_3d_2.h:719
double Area() const override
Definition: line_3d_2.h:383
Line3D2 & operator=(const Line3D2 &rOther)
Definition: line_3d_2.h:264
BaseType::PointsArrayType PointsArrayType
Definition: line_3d_2.h:110
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: line_3d_2.h:123
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: line_3d_2.h:240
Line3D2< TPointType > EdgeType
Type of edge geometry.
Definition: line_3d_2.h:79
KRATOS_CLASS_POINTER_DEFINITION(Line3D2)
Pointer definition of Line3D2.
Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_3d_2.h:562
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: line_3d_2.h:160
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: line_3d_2.h:299
Line3D2(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: line_3d_2.h:199
Line3D2(const IndexType GeometryId, const PointsArrayType &ThisPoints)
Constructor with Geometry Id.
Definition: line_3d_2.h:190
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_3d_2.h:469
double CalculateDistance(const CoordinatesArrayType &rPointGlobalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Computes the distance between an point in global coordinates and the closest point of this geometry....
Definition: line_3d_2.h:442
bool HasIntersection(const Point &rLowPoint, const Point &rHighPoint) const override
Definition: line_3d_2.h:856
CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const override
Returns the local coordinates of a given arbitrary point.
Definition: line_3d_2.h:868
BaseType::IndexType IndexType
Definition: line_3d_2.h:98
BaseType::SizeType SizeType
Definition: line_3d_2.h:105
std::string Info() const override
Definition: line_3d_2.h:912
void PrintData(std::ostream &rOStream) const override
Definition: line_3d_2.h:936
double DomainSize() const override
Definition: line_3d_2.h:399
Line3D2(const PointsArrayType &ThisPoints)
Definition: line_3d_2.h:182
double Length() const override
Definition: line_3d_2.h:359
Vector & DeterminantOfJacobian(Vector &rResult, IntegrationMethod ThisMethod) const override
Definition: line_3d_2.h:583
Line3D2 & operator=(Line3D2< TOtherPointType > const &rOther)
Definition: line_3d_2.h:282
Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_3d_2.h:541
BaseType::IntegrationPointType IntegrationPointType
Definition: line_3d_2.h:116
bool IsInside(const CoordinatesArrayType &rPoint, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Returns whether given arbitrary point is inside the Geometry and the respective local point for the g...
Definition: line_3d_2.h:833
Line3D2(typename PointType::Pointer pFirstPoint, typename PointType::Pointer pSecondPoint)
Definition: line_3d_2.h:175
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod, Matrix &DeltaPosition) const override
Definition: line_3d_2.h:505
double DeterminantOfJacobian(const CoordinatesArrayType &rPoint) const override
Definition: line_3d_2.h:635
BaseType::NormalType NormalType
Definition: line_3d_2.h:155
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: line_3d_2.h:134
BaseType::GeometriesArrayType GeometriesArrayType
Definition: line_3d_2.h:88
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
This method gives value of given shape function evaluated in given point.
Definition: line_3d_2.h:788
array_1d< double, 3 > Normal(const CoordinatesArrayType &rPointLocalCoordinates) const override
Definition: line_3d_2.h:819
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: line_3d_2.h:139
Geometry< TPointType > BaseType
Geometry as base class.
Definition: line_3d_2.h:72
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
This method gives all non-zero shape functions values evaluated at the rCoordinates provided.
Definition: line_3d_2.h:767
Matrix & InverseOfJacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_3d_2.h:679
double DeterminantOfJacobian(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_3d_2.h:618
SizeType FacesNumber() const override
Returns the number of faces of the current geometry.
Definition: line_3d_2.h:750
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: line_3d_2.h:151
friend class Line3D2
Definition: line_3d_2.h:1138
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: line_3d_2.h:245
GeometriesArrayType GenerateEdges() const override
This method gives you all edges of this geometry.
Definition: line_3d_2.h:732
JacobiansType & InverseOfJacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_3d_2.h:655
Various mathematical utilitiy functions.
Definition: math_utils.h:62
static double Norm3(const TVectorType &a)
Calculates the norm of vector "a" which is assumed to be of size 3.
Definition: math_utils.h:691
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 push_back(const TPointerType &x)
Definition: pointer_vector.h:270
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Short class definition.
Definition: array_1d.h:61
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
const GeometryData Line3D2< TPointType >::msGeometryData & msGeometryDimension(), Line3D2< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
const GeometryData BrepCurve< TContainerPointType, TContainerPointEmbeddedType >::msGeometryData & msGeometryDimension
Definition: brep_curve.h:483
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307
float temp
Definition: rotating_cone.py:85
N
Definition: sensitivityMatrix.py:29
e
Definition: run_cpp_mpi_tests.py:31