KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
line_3d_2.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Riccardo Rossi
11 // Janosch Stascheit
12 // Felix Nagel
13 // contributors: Hoang Giang Bui
14 // Josep Maria Carbonell
15 //
16 
17 #pragma once
18 
19 // System includes
20 
21 // External includes
22 
23 // Project includes
24 #include "geometries/geometry.h"
28 #include "utilities/geometry_utilities.h"
29 namespace Kratos
30 {
31 
34 
38 
42 
46 
50 
61 template<class TPointType>
62 
63 class Line3D2 : public Geometry<TPointType>
64 {
65 
66 public:
70 
74 
77 
80 
84 
89 
92  typedef TPointType PointType;
93 
98  typedef typename BaseType::IndexType IndexType;
99 
100 
105  typedef typename BaseType::SizeType SizeType;
106 
111 
117 
124 
130 
135 
140 
146 
152 
156 
161 
165 
166 // Line3D2( const PointType& FirstPoint, const PointType& SecondPoint )
167 // : BaseType( PointsArrayType(), &msGeometryData )
168 // {
169 // this->Points().push_back( typename PointType::Pointer( new PointType( FirstPoint ) ) );
170 // this->Points().push_back( typename PointType::Pointer( new PointType( SecondPoint ) ) );
171 // // BaseType::Points().push_back( typename PointType::Pointer( new PointType( FirstPoint ) ) );
172 // // BaseType::Points().push_back( typename PointType::Pointer( new PointType( SecondPoint ) ) );
173 // }
174 
175  Line3D2( typename PointType::Pointer pFirstPoint, typename PointType::Pointer pSecondPoint )
176  : BaseType( PointsArrayType(), &msGeometryData )
177  {
178  BaseType::Points().push_back( pFirstPoint );
179  BaseType::Points().push_back( pSecondPoint );
180  }
181 
182  explicit Line3D2( const PointsArrayType& ThisPoints )
183  : BaseType( ThisPoints, &msGeometryData )
184  {
185  if ( BaseType::PointsNumber() != 2 )
186  KRATOS_ERROR << "Invalid points number. Expected 2, given " << BaseType::PointsNumber() << std::endl;
187  }
188 
190  explicit Line3D2(
191  const IndexType GeometryId,
192  const PointsArrayType& ThisPoints
193  ) : BaseType(GeometryId, ThisPoints, &msGeometryData)
194  {
195  KRATOS_ERROR_IF( this->PointsNumber() != 2 ) << "Invalid points number. Expected 2, given " << this->PointsNumber() << std::endl;
196  }
197 
199  explicit Line3D2(
200  const std::string& rGeometryName,
201  const PointsArrayType& rThisPoints
202  ) : BaseType(rGeometryName, rThisPoints, &msGeometryData)
203  {
204  KRATOS_ERROR_IF(this->PointsNumber() != 2) << "Invalid points number. Expected 2, given " << this->PointsNumber() << std::endl;
205  }
206 
215  Line3D2( Line3D2 const& rOther )
216  : BaseType( rOther )
217  {
218  }
219 
220 
232  template<class TOtherPointType> explicit Line3D2( Line3D2<TOtherPointType> const& rOther )
233  : BaseType( rOther )
234  {
235  }
236 
238  ~Line3D2() override {}
239 
241  {
243  }
244 
246  {
248  }
249 
253 
264  Line3D2& operator=( const Line3D2& rOther )
265  {
266  BaseType::operator=( rOther );
267 
268  return *this;
269  }
270 
281  template<class TOtherPointType>
283  {
284  BaseType::operator=( rOther );
285 
286  return *this;
287  }
288 
292 
299  typename BaseType::Pointer Create(
300  const IndexType NewGeometryId,
301  PointsArrayType const& rThisPoints
302  ) const override
303  {
304  return typename BaseType::Pointer( new Line3D2( NewGeometryId, rThisPoints ) );
305  }
306 
313  typename BaseType::Pointer Create(
314  const IndexType NewGeometryId,
315  const BaseType& rGeometry
316  ) const override
317  {
318  auto p_geometry = typename BaseType::Pointer( new Line3D2( NewGeometryId, rGeometry.Points() ) );
319  p_geometry->SetData(rGeometry.GetData());
320  return p_geometry;
321  }
322 
332  Vector& rResult,
333  const typename BaseType::LumpingMethods LumpingMethod = BaseType::LumpingMethods::ROW_SUM
334  ) const override
335  {
336  if(rResult.size() != 2)
337  rResult.resize( 2, false );
338  rResult[0] = 0.5;
339  rResult[1] = 0.5;
340  return rResult;
341  }
342 
346 
359  double Length() const override
360  {
361  const TPointType& point0 = BaseType::GetPoint(0);
362  const TPointType& point1 = BaseType::GetPoint(1);
363  const double lx = point0.X() - point1.X();
364  const double ly = point0.Y() - point1.Y();
365  const double lz = point0.Z() - point1.Z();
366 
367  const double length = lx * lx + ly * ly + lz * lz;
368 
369  return std::sqrt( length );
370  }
371 
383  double Area() const override
384  {
385  return Length();
386  }
387 
388 
399  double DomainSize() const override
400  {
401  return Length();
402  }
403 
404 
408 
415  bool HasIntersection(const BaseType& rThisGeometry) const override
416  {
417  const BaseType& r_geom = *this;
418  if (rThisGeometry.LocalSpaceDimension() > r_geom.LocalSpaceDimension()) {
419  return rThisGeometry.HasIntersection(r_geom);
420  }
421  // Both objects are lines
422  Point intersection_point;
423  return IntersectionUtilities::ComputeLineLineIntersection(r_geom, rThisGeometry[0], rThisGeometry[1], intersection_point);
424  }
425 
429 
443  const CoordinatesArrayType& rPointGlobalCoordinates,
444  const double Tolerance = std::numeric_limits<double>::epsilon()
445  ) const override
446  {
447  const Point point(rPointGlobalCoordinates);
448  return GeometryUtils::PointDistanceToLineSegment3D(this->GetPoint(0), this->GetPoint(1), point);
449  }
450 
454 
469  JacobiansType& Jacobian( JacobiansType& rResult, IntegrationMethod ThisMethod ) const override
470  {
471  Matrix jacobian( 3, 1 );
472  jacobian( 0, 0 ) = ( this->GetPoint( 1 ).X() - this->GetPoint( 0 ).X() ) * 0.5; //on the Gauss points (J is constant at each element)
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;
475 
476  if ( rResult.size() != BaseType::IntegrationPointsNumber( ThisMethod ) )
477  {
478  // KLUDGE: While there is a bug in ublas vector resize, I have to put this beside resizing!!
480  rResult.swap( temp );
481  }
482 
483  std::fill( rResult.begin(), rResult.end(), jacobian );
484 
485  return rResult;
486  }
487 
505  JacobiansType& Jacobian( JacobiansType& rResult, IntegrationMethod ThisMethod, Matrix & DeltaPosition ) const override
506  {
507  Matrix jacobian( 3, 1 );
508  jacobian( 0, 0 ) = ( (this->GetPoint( 1 ).X() - DeltaPosition(1,0)) - (this->GetPoint( 0 ).X() - DeltaPosition(0,0)) ) * 0.5; //on the Gauss points (J is constant at each element)
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;
511 
512  if ( rResult.size() != BaseType::IntegrationPointsNumber( ThisMethod ) )
513  {
514  // KLUDGE: While there is a bug in ublas vector resize, I have to put this beside resizing!!
516  rResult.swap( temp );
517  }
518 
519  std::fill( rResult.begin(), rResult.end(), jacobian );
520 
521  return rResult;
522  }
523 
541  Matrix& Jacobian( Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const override
542  {
543  rResult.resize( 3, 1, false );
544  //on the Gauss points (J is constant at each element)
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;
548  return rResult;
549  }
550 
562  Matrix& Jacobian( Matrix& rResult, const CoordinatesArrayType& rPoint ) const override
563  {
564  rResult.resize( 3, 1, false );
565  //on the Gauss points (J is constant at each element)
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;
569  return rResult;
570  }
571 
583  Vector& DeterminantOfJacobian( Vector& rResult, IntegrationMethod ThisMethod ) const override
584  {
585  const unsigned int integration_points_number = msGeometryData.IntegrationPointsNumber( ThisMethod );
586  if(rResult.size() != integration_points_number)
587  {
588  rResult.resize(integration_points_number,false);
589  }
590 
591  const double detJ = 0.5*(this->Length());
592 
593  for ( unsigned int pnt = 0; pnt < integration_points_number; pnt++ )
594  {
595  rResult[pnt] = detJ;
596  }
597  return rResult;
598  }
599 
618  double DeterminantOfJacobian( IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const override
619  {
620  return 0.5*(this->Length());
621  }
622 
635  double DeterminantOfJacobian( const CoordinatesArrayType& rPoint ) const override
636  {
637  return 0.5*(this->Length());
638  }
639 
640 
655  JacobiansType& InverseOfJacobian( JacobiansType& rResult, IntegrationMethod ThisMethod ) const override
656  {
657  rResult[0] = ZeroMatrix( 1, 1 );
658  rResult[0]( 0, 0 ) = 2.0 * MathUtils<double>::Norm3(( this->GetPoint( 1 ) ) - ( this->GetPoint( 0 ) ) );
659  return rResult;
660  }
661 
679  Matrix& InverseOfJacobian( Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const override
680  {
681  rResult = ZeroMatrix( 1, 1 );
682  rResult( 0, 0 ) = 2.0 * MathUtils<double>::Norm3(( this->GetPoint( 1 ) ) - ( this->GetPoint( 0 ) ) );
683  return( rResult );
684  }
685 
697  Matrix& InverseOfJacobian( Matrix& rResult, const CoordinatesArrayType& rPoint ) const override
698  {
699  rResult = ZeroMatrix( 1, 1 );
700  rResult( 0, 0 ) = 2.0 * MathUtils<double>::Norm3(( this->GetPoint( 1 ) ) - ( this->GetPoint( 0 ) ) );
701  return( rResult );
702  }
703 
707 
719  SizeType EdgesNumber() const override
720  {
721  return 1;
722  }
723 
733  {
735  edges.push_back( Kratos::make_shared<EdgeType>( this->pGetPoint( 0 ), this->pGetPoint( 1 ) ) );
736  return edges;
737  }
738 
742 
750  SizeType FacesNumber() const override
751  {
752  return 0;
753  }
754 
758 
767  Vector& ShapeFunctionsValues (Vector &rResult, const CoordinatesArrayType& rCoordinates) const override
768  {
769  if(rResult.size() != 2) {
770  rResult.resize(2, false);
771  }
772 
773  rResult[0] = 0.5 * ( 1.0 - rCoordinates[0]);
774  rResult[1] = 0.5 * ( 1.0 + rCoordinates[0]);
775 
776  return rResult;
777  }
778 
788  double ShapeFunctionValue( IndexType ShapeFunctionIndex,
789  const CoordinatesArrayType& rPoint ) const override
790  {
791  switch ( ShapeFunctionIndex )
792  {
793  case 0:
794  return( 0.5*( 1.0 - rPoint[0] ) );
795 
796  case 1:
797  return( 0.5*( 1.0 + rPoint[0] ) );
798 
799  default:
800  KRATOS_ERROR << "Wrong index of shape function!" << *this << std::endl;
801  }
802 
803  return 0;
804  }
805 
807  const CoordinatesArrayType& rPoint ) const override
808  {
809  rResult = ZeroMatrix( 2, 1 );
810  rResult( 0, 0 ) = -0.5;
811  rResult( 1, 0 ) = 0.5;
812  return( rResult );
813  }
814 
819  array_1d<double, 3> Normal(const CoordinatesArrayType& rPointLocalCoordinates) const override
820  {
821  KRATOS_ERROR << "ERROR: Line3D2 can not define a normal. Please, define the normal in your implementation" << std::endl;
822  return ZeroVector(3);
823  }
824 
833  bool IsInside(
834  const CoordinatesArrayType& rPoint,
835  CoordinatesArrayType& rResult,
836  const double Tolerance = std::numeric_limits<double>::epsilon()
837  ) const override
838  {
839  PointLocalCoordinates( rResult, rPoint );
840 
841  if ( std::abs( rResult[0] ) <= (1.0 + Tolerance) ) {
842  return true;
843  }
844 
845  return false;
846  }
847 
856  bool HasIntersection(const Point& rLowPoint, const Point& rHighPoint) const override
857  {
859  rLowPoint, rHighPoint, this->GetPoint(0), this->GetPoint(1));
860  }
861 
868  CoordinatesArrayType& PointLocalCoordinates(
869  CoordinatesArrayType& rResult,
870  const CoordinatesArrayType& rPoint
871  ) const override
872  {
873  rResult.clear();
874 
875  const TPointType& r_first_point = BaseType::GetPoint(0);
876  const TPointType& r_second_point = BaseType::GetPoint(1);
877 
878  // Project point
879  const double tolerance = 1e-14; // Tolerance
880 
881  const double length = Length();
882 
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));
885 
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));
888 
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; // NOTE: The same value as before, but it will be > than 1
893  } else if (length_2 > (length + tolerance)) {
894  rResult[0] = 1.0 - 2.0 * length_2/(length + tolerance);
895  } else {
896  rResult[0] = 2.0; // Out of the line!!!
897  }
898 
899  return rResult ;
900  }
901 
905 
912  std::string Info() const override
913  {
914  return "1 dimensional line with 2 nodes in 3D space";
915  }
916 
923  void PrintInfo( std::ostream& rOStream ) const override
924  {
925  rOStream << "1 dimensional line with 2 nodes in 3D space";
926  }
927 
936  void PrintData( std::ostream& rOStream ) const override
937  {
938  // Base Geometry class PrintData call
939  BaseType::PrintData( rOStream );
940  std::cout << std::endl;
941 
942  // If the geometry has valid points, calculate and output its data
943  if (this->AllPointsAreValid()) {
944  Matrix jacobian;
945  this->Jacobian( jacobian, PointType() );
946  rOStream << " Jacobian\t : " << jacobian;
947  }
948  }
949 
953 
954 
956 
957 protected:
960 
961 
965 
966 
970 
971 
975 
976 
980 
981 
985 
986 
990 
991 
993 
994 private:
997 
998  static const GeometryData msGeometryData;
999 
1000  static const GeometryDimension msGeometryDimension;
1001 
1005 
1009 
1010  friend class Serializer;
1011 
1012  void save( Serializer& rSerializer ) const override
1013  {
1015  }
1016 
1017  void load( Serializer& rSerializer ) override
1018  {
1020  }
1021 
1022  Line3D2(): BaseType( PointsArrayType(), &msGeometryData ) {}
1023 
1024 
1028 
1029 
1033 
1034  static Matrix CalculateShapeFunctionsIntegrationPointsValues( typename BaseType::IntegrationMethod ThisMethod )
1035  {
1036  const IntegrationPointsContainerType& all_integration_points = AllIntegrationPoints();
1037  const IntegrationPointsArrayType& IntegrationPoints = all_integration_points[static_cast<int>(ThisMethod)];
1038  int integration_points_number = IntegrationPoints.size();
1039  Matrix N( integration_points_number, 2 );
1040 
1041  for ( int it_gp = 0; it_gp < integration_points_number; it_gp++ )
1042  {
1043  double e = IntegrationPoints[it_gp].X();
1044  N( it_gp, 0 ) = 0.5 * ( 1 - e );
1045  N( it_gp, 1 ) = 0.5 * ( 1 + e );
1046  }
1047 
1048  return N;
1049  }
1050 
1051  static ShapeFunctionsGradientsType CalculateShapeFunctionsIntegrationPointsLocalGradients( typename BaseType::IntegrationMethod ThisMethod )
1052  {
1053  const IntegrationPointsContainerType& all_integration_points = AllIntegrationPoints();
1054  const IntegrationPointsArrayType& IntegrationPoints = all_integration_points[static_cast<int>(ThisMethod)];
1056 
1057  for ( unsigned int it_gp = 0; it_gp < IntegrationPoints.size(); it_gp++ )
1058  {
1059  Matrix aux_mat = ZeroMatrix(2,1);
1060  aux_mat(0,0) = -0.5;
1061  aux_mat(1,0) = 0.5;
1062  DN_De[it_gp] = aux_mat;
1063  }
1064 
1065  return DN_De;
1066 
1067  }
1068 
1069  static const IntegrationPointsContainerType AllIntegrationPoints()
1070  {
1071  IntegrationPointsContainerType integration_points = {{
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()
1082  }
1083  };
1084  return integration_points;
1085  }
1086 
1087  static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
1088  {
1089  ShapeFunctionsValuesContainerType shape_functions_values = {{
1090  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_1 ),
1091  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_2 ),
1092  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_3 ),
1093  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4 ),
1094  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_5 ),
1095  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ),
1096  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ),
1097  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ),
1098  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ),
1099  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 )
1100  }
1101  };
1102  return shape_functions_values;
1103  }
1104 
1105  static const ShapeFunctionsLocalGradientsContainerType AllShapeFunctionsLocalGradients()
1106  {
1107  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients = {{
1108  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_1 ),
1109  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_2 ),
1110  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_3 ),
1111  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 ),
1112  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_5 ),
1113  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ),
1114  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ),
1115  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ),
1116  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ),
1117  Line3D2<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 )
1118 
1119  }
1120  };
1121  return shape_functions_local_gradients;
1122  }
1123 
1127 
1128 
1132 
1133 
1137 
1138  template<class TOtherPointType> friend class Line3D2;
1139 
1143 
1145 
1146 }; // Class Geometry
1147 
1149 
1152 
1153 
1157 
1158 
1160 template<class TPointType>
1161 inline std::istream& operator >> ( std::istream& rIStream,
1162  Line3D2<TPointType>& rThis );
1163 
1165 template<class TPointType>
1166 inline std::ostream& operator << ( std::ostream& rOStream,
1167  const Line3D2<TPointType>& rThis )
1168 {
1169  rThis.PrintInfo( rOStream );
1170  rOStream << std::endl;
1171  rThis.PrintData( rOStream );
1172 
1173  return rOStream;
1174 }
1175 
1177 
1178 
1179 template<class TPointType>
1180 const GeometryData Line3D2<TPointType>::msGeometryData(
1183  Line3D2<TPointType>::AllIntegrationPoints(),
1184  Line3D2<TPointType>::AllShapeFunctionsValues(),
1185  AllShapeFunctionsLocalGradients() );
1186 
1187 template<class TPointType>
1188 const GeometryDimension Line3D2<TPointType>::msGeometryDimension(3, 1);
1189 
1190 } // namespace Kratos.
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