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_2d_3.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"
27 
28 namespace Kratos
29 {
30 
33 
37 
41 
45 
49 
60 template<class TPointType>
61 class Line2D3
62  : public Geometry<TPointType>
63 {
64 public:
68 
71 
74 
78 
83 
86  typedef TPointType PointType;
87 
92  typedef typename BaseType::IndexType IndexType;
93 
94 
99  typedef typename BaseType::SizeType SizeType;
100 
105 
111 
118 
124 
129 
134 
140 
146 
150 
155 
159 
160  Line2D3( const PointType& FirstPoint,
161  const PointType& SecondPoint,
162  const PointType& ThirdPoint )
163  : BaseType( PointsArrayType(), &msGeometryData )
164  {
165  BaseType::Points().push_back( typename PointType::Pointer( new PointType( FirstPoint ) ) );
166  BaseType::Points().push_back( typename PointType::Pointer( new PointType( SecondPoint ) ) );
167  BaseType::Points().push_back( typename PointType::Pointer( new PointType( ThirdPoint ) ) );
168  }
169 
170  Line2D3( typename PointType::Pointer pFirstPoint,
171  typename PointType::Pointer pSecondPoint,
172  typename PointType::Pointer pThirdPoint )
173  : BaseType( PointsArrayType(), &msGeometryData )
174  {
175  BaseType::Points().push_back( pFirstPoint );
176  BaseType::Points().push_back( pSecondPoint );
177  BaseType::Points().push_back( pThirdPoint );
178  }
179 
180  explicit Line2D3( const PointsArrayType& rThisPoints )
181  : BaseType( rThisPoints, &msGeometryData )
182  {
183  KRATOS_ERROR_IF( BaseType::PointsNumber() != 3 ) << "Invalid points number. Expected 3, given " << BaseType::PointsNumber() << std::endl;
184  }
185 
187  explicit Line2D3(
188  const IndexType GeometryId,
189  const PointsArrayType& rThisPoints
190  ) : BaseType( GeometryId, rThisPoints, &msGeometryData )
191  {
192  KRATOS_ERROR_IF( this->PointsNumber() != 3 ) << "Invalid points number. Expected 3, given " << this->PointsNumber() << std::endl;
193  }
194 
196  explicit Line2D3(
197  const std::string& rGeometryName,
198  const PointsArrayType& rThisPoints
199  ) : BaseType(rGeometryName, rThisPoints, &msGeometryData)
200  {
201  KRATOS_ERROR_IF(this->PointsNumber() != 3) << "Invalid points number. Expected 3, given " << this->PointsNumber() << std::endl;
202  }
203 
211  Line2D3( Line2D3 const& rOther )
212  : BaseType( rOther )
213  {
214  }
215 
226  template<class TOtherPointType> explicit Line2D3( Line2D3<TOtherPointType> const& rOther )
227  : BaseType( rOther )
228  {
229  }
230 
232  ~Line2D3() override {}
233 
235  {
237  }
238 
240  {
242  }
243 
247 
258  Line2D3& operator=( const Line2D3& rOther )
259  {
260  BaseType::operator=( rOther );
261  return *this;
262  }
263 
272  template<class TOtherPointType>
274  {
275  BaseType::operator=( rOther );
276  return *this;
277  }
278 
282 
289  typename BaseType::Pointer Create(
290  const IndexType NewGeometryId,
291  PointsArrayType const& rThisPoints
292  ) const override
293  {
294  return typename BaseType::Pointer( new Line2D3( NewGeometryId, rThisPoints ) );
295  }
296 
303  typename BaseType::Pointer Create(
304  const IndexType NewGeometryId,
305  const BaseType& rGeometry
306  ) const override
307  {
308  auto p_geometry = typename BaseType::Pointer( new Line2D3( NewGeometryId, rGeometry.Points() ) );
309  p_geometry->SetData(rGeometry.GetData());
310  return p_geometry;
311  }
312 
322  Vector& rResult,
323  const typename BaseType::LumpingMethods LumpingMethod = BaseType::LumpingMethods::ROW_SUM
324  ) const override
325  {
326  if(rResult.size() != 3)
327  rResult.resize( 3, false );
328  rResult[0] = 0.25;
329  rResult[2] = 0.5;
330  rResult[1] = 0.25;
331  return rResult;
332  }
333 
337 
350  double Length() const override
351  {
353  return IntegrationUtilities::ComputeDomainSize(*this, integration_method);
354  }
355 
367  double Area() const override
368  {
369  return Length();
370  }
371 
372 
383  double DomainSize() const override
384  {
385  return Length();
386  }
387 
396  bool IsInside(
397  const CoordinatesArrayType& rPoint,
398  CoordinatesArrayType& rResult,
399  const double Tolerance = std::numeric_limits<double>::epsilon()
400  ) const override
401  {
402  PointLocalCoordinates( rResult, rPoint );
403 
404  if ( std::abs( rResult[0] ) <= (1.0 + Tolerance) ) {
405  return true;
406  }
407 
408  return false;
409  }
410 
418  CoordinatesArrayType& rResult,
419  const CoordinatesArrayType& rPoint
420  ) const override
421  {
424  for(IndexType i=0; i<this->size(); ++i) {
425  const auto& r_node = this->GetPoint(i);
426  X(0, i) = r_node.X();
427  X(1, i) = r_node.Y();
428  X(2, i) = r_node.Z();
429  }
430 
431  static constexpr double MaxNormPointLocalCoordinates = 300.0;
432  static constexpr std::size_t MaxIteratioNumberPointLocalCoordinates = 500;
433  static constexpr double MaxTolerancePointLocalCoordinates = 1.0e-8;
434 
435  Matrix J = ZeroMatrix( 1, 1 );
436  Matrix invJ = ZeroMatrix( 1, 1 );
437 
438  // Starting with xi = 0
439  if (rResult.size() != 3)
440  rResult.resize(3, false);
441  rResult = ZeroVector( 3 );
442  double delta_xi = 0.0;
443  const array_1d<double, 3> zero_array = ZeroVector(3);
444  array_1d<double, 3> current_global_coords;
445 
446  //Newton iteration:
447  for ( IndexType k = 0; k < MaxIteratioNumberPointLocalCoordinates; k++ ) {
448  noalias(current_global_coords) = zero_array;
449  this->GlobalCoordinates( current_global_coords, rResult );
450 
451  noalias( current_global_coords ) = rPoint - current_global_coords;
452 
453  // Derivatives of shape functions
454  Matrix shape_functions_gradients;
455  shape_functions_gradients = ShapeFunctionsLocalGradients(shape_functions_gradients, rResult );
456  noalias(DN) = prod(X, shape_functions_gradients);
457 
458  noalias(J) = prod(trans(DN), DN);
459  const array_1d<double, 1> res = prod(trans(DN), current_global_coords);
460 
461  // The inverted jacobian matrix
462  invJ(0, 0) = 1.0/J( 0, 0 );
463 
464  delta_xi = invJ(0, 0) * res[0];
465 
466  rResult[0] += delta_xi;
467 
468  if ( delta_xi > MaxNormPointLocalCoordinates ) {
469  KRATOS_WARNING_IF("Line2D3", k > 0) << "detJ =\t" << J( 0, 0 ) << " DeltaX =\t" << delta_xi << " stopping calculation. Iteration:\t" << k << std::endl;
470  break;
471  }
472 
473  if ( delta_xi < MaxTolerancePointLocalCoordinates )
474  break;
475  }
476 
477  return rResult;
478  }
479 
483 
499  JacobiansType& Jacobian( JacobiansType& rResult, IntegrationMethod ThisMethod ) const override
500  {
501  // Getting derivatives of shape functions
502  const ShapeFunctionsGradientsType shape_functions_gradients = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
503 
504  const std::size_t number_of_integration_points = this->IntegrationPointsNumber( ThisMethod );
505  if (rResult.size() != number_of_integration_points) {
506  JacobiansType temp( number_of_integration_points );
507  rResult.swap( temp );
508  }
509 
510  // Loop over all integration points
511  for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt) {
512  // Initializing jacobian matrix
513  noalias(rResult[pnt]) = ZeroMatrix( 2, 1 );
514 
515  // Loop over all nodes
516  for (std::size_t i = 0; i < this->PointsNumber(); ++i) {
517  const auto& r_node = this->GetPoint(i);
518  rResult[pnt](0, 0) += r_node.X() * shape_functions_gradients[pnt](i, 0);
519  rResult[pnt](1, 0) += r_node.Y() * shape_functions_gradients[pnt](i, 0);
520  }
521  } // End of loop over all integration points
522 
523  return rResult;
524  }
525 
544  JacobiansType& Jacobian( JacobiansType& rResult, IntegrationMethod ThisMethod, Matrix& rDeltaPosition ) const override
545  {
546  // Getting derivatives of shape functions
547  ShapeFunctionsGradientsType shape_functions_gradients = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
548  const std::size_t number_of_integration_points = this->IntegrationPointsNumber( ThisMethod );
549 
550  // Getting values of shape functions
551  Matrix shape_functions_values = CalculateShapeFunctionsIntegrationPointsValues( ThisMethod );
552 
553  if ( rResult.size() != number_of_integration_points ) {
554  JacobiansType temp( number_of_integration_points );
555  rResult.swap( temp );
556  }
557 
558  // Loop over all integration points
559  for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt ) {
560  // Initializing jacobian matrix
561  noalias(rResult[pnt]) = ZeroMatrix( 2, 1 );
562 
563  // Loop over all nodes
564  for (std::size_t i = 0; i < this->PointsNumber(); ++i ) {
565  const auto& r_node = this->GetPoint(i);
566  rResult[pnt](0, 0) += (r_node.X() - rDeltaPosition(i,0)) * shape_functions_gradients[pnt](i, 0);
567  rResult[pnt](1, 0) += (r_node.Y() - rDeltaPosition(i,1)) * shape_functions_gradients[pnt](i, 0);
568  }
569  }// End of loop over all integration points
570 
571  return rResult;
572  }
573 
591  Matrix& Jacobian( Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const override
592  {
593  // Setting up size of jacobian matrix
594  rResult.resize(2, 1, false);
595  noalias(rResult) = ZeroMatrix( 2, 1 );
596 
597  // Derivatives of shape functions
598  ShapeFunctionsGradientsType shape_functions_gradients = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
599  Matrix shape_function_gradient_in_integration_point = shape_functions_gradients( IntegrationPointIndex );
600 
601  // Values of shape functions in integration points
602  DenseVector<double> ShapeFunctionsValuesInIntegrationPoint = ZeroVector( 3 );
603  ShapeFunctionsValuesInIntegrationPoint = row( CalculateShapeFunctionsIntegrationPointsValues( ThisMethod ), IntegrationPointIndex );
604 
605  // Elements of jacobian matrix (e.g. J(1,1) = dX1/dXi1)
606  // Loop over all nodes
607  for (std::size_t i = 0; i < this->PointsNumber(); ++i ) {
608  const auto& r_node = this->GetPoint(i);
609  rResult(0, 0) += r_node.X() * shape_function_gradient_in_integration_point(i, 0);
610  rResult(1, 0) += r_node.Y() * shape_function_gradient_in_integration_point(i, 0);
611  }
612 
613  return rResult;
614  }
615 
628  Matrix& Jacobian( Matrix& rResult, const CoordinatesArrayType& rPoint ) const override
629  {
630  // Setting up size of jacobian matrix
631  rResult.resize( 2, 1, false );
632  noalias(rResult) = ZeroMatrix( 2, 1 );
633 
634  // Derivatives of shape functions
635  Matrix shape_functions_gradients;
636  shape_functions_gradients = ShapeFunctionsLocalGradients( shape_functions_gradients, rPoint );
637 
638  // Elements of jacobian matrix (e.g. J(1,1) = dX1/dXi1)
639  // Loop over all nodes
640  for (std::size_t i = 0; i < this->PointsNumber(); ++i) {
641  const auto& r_node = this->GetPoint(i);
642  rResult(0, 0) += r_node.X() * shape_functions_gradients(i, 0);
643  rResult(1, 0) += r_node.Y() * shape_functions_gradients(i, 0);
644  }
645 
646  return rResult;
647  }
648 
656  Vector& DeterminantOfJacobian( Vector& rResult, IntegrationMethod ThisMethod ) const override
657  {
658  const std::size_t number_of_integration_points = this->IntegrationPointsNumber( ThisMethod );
659  if( rResult.size() != number_of_integration_points)
660  rResult.resize( number_of_integration_points, false );
661 
662  Matrix J(2, 1);
663  for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt) {
664  this->Jacobian( J, pnt, ThisMethod);
665  rResult[pnt] = std::sqrt(std::pow(J(0,0), 2) + std::pow(J(1,0), 2));
666  }
667  return rResult;
668  }
669 
678  double DeterminantOfJacobian( IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const override
679  {
680  Matrix J(2, 1);
681  this->Jacobian( J, IntegrationPointIndex, ThisMethod);
682  return std::sqrt(std::pow(J(0,0), 2) + std::pow(J(1,0), 2));
683  }
684 
692  double DeterminantOfJacobian( const CoordinatesArrayType& rPoint ) const override
693  {
694  Matrix J(2, 1);
695  this->Jacobian( J, rPoint);
696  return std::sqrt(std::pow(J(0,0), 2) + std::pow(J(1,0), 2));
697  }
698 
702 
706  SizeType EdgesNumber() const override
707  {
708  return 2;
709  }
710 
711 
715  SizeType FacesNumber() const override
716  {
717  return 0;
718  }
719 
723 
733  Vector& rResult,
734  const CoordinatesArrayType& rCoordinates
735  ) const override
736  {
737  if(rResult.size() != 3) {
738  rResult.resize(3, false);
739  }
740 
741  rResult[0] = 0.5 * (rCoordinates[0] - 1.0) * rCoordinates[0];
742  rResult[1] = 0.5 * (rCoordinates[0] + 1.0) * rCoordinates[0];
743  rResult[2] = 1.0 - rCoordinates[0] * rCoordinates[0];
744 
745  return rResult;
746  }
747 
758  IndexType ShapeFunctionIndex,
759  const CoordinatesArrayType& rPoint
760  ) const override
761  {
762  switch ( ShapeFunctionIndex )
763  {
764  case 0:
765  return( 0.5*( rPoint[0] - 1.0 )*rPoint[0] );
766  case 1:
767  return( 0.5*( rPoint[0] + 1.0 )*rPoint[0] );
768  case 2:
769  return( 1.0 -rPoint[0]*rPoint[0] );
770  default:
771  KRATOS_ERROR << "Wrong index of shape function!" << *this << std::endl;
772  }
773 
774  return 0;
775  }
776 
780 
787  std::string Info() const override
788  {
789  return "1 dimensional line with 3 nodes in 2D space";
790  }
791 
798  void PrintInfo( std::ostream& rOStream ) const override
799  {
800  rOStream << "1 dimensional line with 3 nodes in 2D space";
801  }
802 
811  void PrintData( std::ostream& rOStream ) const override
812  {
813  // Base Geometry class PrintData call
814  BaseType::PrintData( rOStream );
815  std::cout << std::endl;
816 
817  // If the geometry has valid points, calculate and output its data
818  if (this->AllPointsAreValid()) {
819  Matrix jacobian;
820  this->Jacobian( jacobian, PointType() );
821  rOStream << " Jacobian\t : " << jacobian;
822  }
823  }
824 
830  IntegrationMethod ThisMethod )
831  {
832  ShapeFunctionsGradientsType localGradients
833  = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
834  const int integration_points_number
835  = msGeometryData.IntegrationPointsNumber( ThisMethod );
836  ShapeFunctionsGradientsType Result( integration_points_number );
837 
838  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
839  {
840  Result[pnt] = localGradients[pnt];
841  }
842 
843  return Result;
844  }
845 
851  {
852  IntegrationMethod ThisMethod = msGeometryData.DefaultIntegrationMethod();
853  ShapeFunctionsGradientsType localGradients
854  = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
855  const int integration_points_number
856  = msGeometryData.IntegrationPointsNumber( ThisMethod );
857  ShapeFunctionsGradientsType Result( integration_points_number );
858 
859  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
860  {
861  Result[pnt] = localGradients[pnt];
862  }
863 
864  return Result;
865  }
866 
876  const CoordinatesArrayType& rPoint ) const override
877  {
878  // Setting up result matrix
879  if(rResult.size1() != 3 || rResult.size2() != 1) {
880  rResult.resize( 3, 1, false );
881  }
882 
883  noalias( rResult ) = ZeroMatrix( 3, 1 );
884  rResult( 0, 0 ) = rPoint[0] - 0.5;
885  rResult( 1, 0 ) = rPoint[0] + 0.5;
886  rResult( 2, 0 ) = -rPoint[0] * 2.0;
887  return( rResult );
888  }
889 
895  Matrix& PointsLocalCoordinates( Matrix& rResult ) const override
896  {
897  if(rResult.size1() != 3 || rResult.size2() != 1)
898  {
899  rResult.resize( 3, 1, false );
900  }
901  noalias( rResult ) = ZeroMatrix( 3, 1 );
902  rResult( 0, 0 ) = -1.0;
903  rResult( 1, 0 ) = 1.0;
904  rResult( 2, 0 ) = 0.0;
905  return rResult;
906  }
907 
917  {
918  if(rResult.size1() != 3 || rResult.size2() != 1)
919  {
920  rResult.resize( 3, 1, false );
921  }
922  noalias( rResult ) = ZeroMatrix( 3, 1 );
923 
924  rResult( 0, 0 ) = rPoint[0] - 0.5;
925  rResult( 1, 0 ) = rPoint[0] + 0.5;
926  rResult( 2, 0 ) = -rPoint[0] * 2.0;
927  return rResult;
928  }
929 
933 
934 
936 
937 protected:
940 
941 
945 
946 
950 
951 
955 
956 
960 
961 
965 
966 
970 
971 
973 
974 private:
977 
978  static const GeometryData msGeometryData;
979 
980  static const GeometryDimension msGeometryDimension;
981 
985 
986 
990 
991  friend class Serializer;
992 
993  void save( Serializer& rSerializer ) const override
994  {
996  }
997 
998  void load( Serializer& rSerializer ) override
999  {
1001  }
1002 
1003  Line2D3(): BaseType( PointsArrayType(), &msGeometryData ) {}
1004 
1008 
1009 
1013 
1014  static Matrix CalculateShapeFunctionsIntegrationPointsValues( typename BaseType::IntegrationMethod ThisMethod )
1015  {
1016  const IntegrationPointsContainerType& all_integration_points = AllIntegrationPoints();
1017  const IntegrationPointsArrayType& IntegrationPoints = all_integration_points[static_cast<int>(ThisMethod)];
1018  int integration_points_number = IntegrationPoints.size();
1019  Matrix N( integration_points_number, 3 );
1020 
1021  for ( int it_gp = 0; it_gp < integration_points_number; it_gp++ )
1022  {
1023  double e = IntegrationPoints[it_gp].X();
1024  N( it_gp, 0 ) = 0.5 * ( e - 1 ) * e;
1025  N( it_gp, 2 ) = 1.0 - e * e;
1026  N( it_gp, 1 ) = 0.5 * ( 1 + e ) * e;
1027  }
1028 
1029  return N;
1030  }
1031 
1032  static ShapeFunctionsGradientsType CalculateShapeFunctionsIntegrationPointsLocalGradients(
1033  typename BaseType::IntegrationMethod ThisMethod )
1034  {
1035  const IntegrationPointsContainerType& all_integration_points = AllIntegrationPoints();
1036  const IntegrationPointsArrayType& IntegrationPoints = all_integration_points[static_cast<int>(ThisMethod)];
1038  std::fill( DN_De.begin(), DN_De.end(), Matrix( 3, 1 ) );
1039 
1040  for ( unsigned int it_gp = 0; it_gp < IntegrationPoints.size(); it_gp++ )
1041  {
1042  double e = IntegrationPoints[it_gp].X();
1043  DN_De[it_gp]( 0, 0 ) = e - 0.5;
1044  DN_De[it_gp]( 2, 0 ) = -2.0 * e;
1045  DN_De[it_gp]( 1, 0 ) = e + 0.5;
1046  }
1047 
1048  return DN_De;
1049  }
1050 
1051  static const IntegrationPointsContainerType AllIntegrationPoints()
1052  {
1053  IntegrationPointsContainerType integration_points = {{
1054  Quadrature<LineGaussLegendreIntegrationPoints1, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1055  Quadrature<LineGaussLegendreIntegrationPoints2, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1056  Quadrature<LineGaussLegendreIntegrationPoints3, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1057  Quadrature<LineGaussLegendreIntegrationPoints4, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1058  Quadrature<LineGaussLegendreIntegrationPoints5, 1, IntegrationPoint<3> >::GenerateIntegrationPoints()
1059  }
1060  };
1061  return integration_points;
1062  }
1063 
1064  static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
1065  {
1066  ShapeFunctionsValuesContainerType shape_functions_values = {{
1067  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_1 ),
1068  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_2 ),
1069  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_3 ),
1070  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4 ),
1071  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_5 )
1072  }
1073  };
1074  return shape_functions_values;
1075  }
1076 
1077  static const ShapeFunctionsLocalGradientsContainerType AllShapeFunctionsLocalGradients()
1078  {
1079  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients = {{
1080  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_1 ),
1081  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_2 ),
1082  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_3 ),
1083  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 ),
1084  Line2D3<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_5 )
1085  }
1086  };
1087  return shape_functions_local_gradients;
1088  }
1089 
1093 
1094 
1098 
1099 
1103 
1104  template<class TOtherPointType> friend class Line2D3;
1105 
1109 
1110 
1111 
1113 
1114 }; // Class Geometry
1115 
1117 
1120 
1121 
1125 
1126 
1128 template<class TPointType>
1129 inline std::istream& operator >> ( std::istream& rIStream,
1130  Line2D3<TPointType>& rThis );
1131 
1133 template<class TPointType>
1134 inline std::ostream& operator << ( std::ostream& rOStream,
1135  const Line2D3<TPointType>& rThis )
1136 {
1137  rThis.PrintInfo( rOStream );
1138  rOStream << std::endl;
1139  rThis.PrintData( rOStream );
1140 
1141  return rOStream;
1142 }
1143 
1145 
1146 template<class TPointType>
1147 const GeometryData Line2D3<TPointType>::msGeometryData(
1150  Line2D3<TPointType>::AllIntegrationPoints(),
1151  Line2D3<TPointType>::AllShapeFunctionsValues(),
1152  AllShapeFunctionsLocalGradients() );
1153 
1154 template<class TPointType>
1155 const GeometryDimension Line2D3<TPointType>::msGeometryDimension(2, 1);
1156 
1157 } // 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
IntegrationMethod DefaultIntegrationMethod() const
Definition: geometry_data.h:425
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
SizeType size() const
Definition: geometry.h:518
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
virtual CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, CoordinatesArrayType const &LocalCoordinates) const
Definition: geometry.h:2377
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
std::size_t SizeType
Definition: geometry.h:144
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
Short class definition.
Definition: integration_point.h:52
static double ComputeDomainSize(const TGeometryType &rGeometry)
This method calculates and returns the domain size of the geometry from any geometry in a generic man...
Definition: integration_utilities.h:63
static GeometryData::IntegrationMethod GetIntegrationMethodForExactMassMatrixEvaluation(const Geometry< TPointType > &rGeometry)
This method returns the integration order for the exact mass matrix evaluation.
Definition: integration_utilities.h:42
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
An three node 2D line geometry with quadratic shape functions.
Definition: line_2d_3.h:63
Line2D3(Line2D3 const &rOther)
Definition: line_2d_3.h:211
double DomainSize() const override
Definition: line_2d_3.h:383
BaseType::NormalType NormalType
Definition: line_2d_3.h:149
std::string Info() const override
Definition: line_2d_3.h:787
Line2D3 & operator=(const Line2D3 &rOther)
Definition: line_2d_3.h:258
Line2D3(const PointType &FirstPoint, const PointType &SecondPoint, const PointType &ThirdPoint)
Definition: line_2d_3.h:160
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: line_2d_3.h:895
double Area() const override
Definition: line_2d_3.h:367
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: line_2d_3.h:123
Line2D3(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: line_2d_3.h:187
double Length() const override
Definition: line_2d_3.h:350
void PrintData(std::ostream &rOStream) const override
Definition: line_2d_3.h:811
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients(IntegrationMethod ThisMethod)
Definition: line_2d_3.h:829
BaseType::JacobiansType JacobiansType
Definition: line_2d_3.h:139
GeometryData::IntegrationMethod IntegrationMethod
Definition: line_2d_3.h:77
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: line_2d_3.h:303
SizeType FacesNumber() const override
Definition: line_2d_3.h:715
BaseType::SizeType SizeType
Definition: line_2d_3.h:99
SizeType EdgesNumber() const override
Definition: line_2d_3.h:706
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: line_2d_3.h:234
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: line_2d_3.h:117
Geometry< TPointType > BaseType
Geometry as base class.
Definition: line_2d_3.h:70
BaseType::IntegrationPointType IntegrationPointType
Definition: line_2d_3.h:110
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_2d_3.h:321
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_2d_3.h:875
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: line_2d_3.h:133
Line2D3(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: line_2d_3.h:196
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: line_2d_3.h:289
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: line_2d_3.h:145
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_2d_3.h:396
BaseType::IndexType IndexType
Definition: line_2d_3.h:92
KRATOS_CLASS_POINTER_DEFINITION(Line2D3)
Pointer definition of Line2D3.
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients()
Definition: line_2d_3.h:850
BaseType::GeometriesArrayType GeometriesArrayType
Definition: line_2d_3.h:82
CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const override
Returns the local coordinates of a given arbitrary point.
Definition: line_2d_3.h:417
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod, Matrix &rDeltaPosition) const override
Definition: line_2d_3.h:544
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: line_2d_3.h:128
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_2d_3.h:499
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
This method gives value of given shape function evaluated in given point.
Definition: line_2d_3.h:757
~Line2D3() override
Destructor. Do nothing!!!
Definition: line_2d_3.h:232
Line2D3(Line2D3< TOtherPointType > const &rOther)
Definition: line_2d_3.h:226
double DeterminantOfJacobian(const CoordinatesArrayType &rPoint) const override
Determinant of jacobian in given point. This method calculate determinant of jacobian matrix in given...
Definition: line_2d_3.h:692
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: line_2d_3.h:239
Line2D3(const PointsArrayType &rThisPoints)
Definition: line_2d_3.h:180
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_2d_3.h:732
Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_2d_3.h:591
TPointType PointType
Definition: line_2d_3.h:86
Line2D3(typename PointType::Pointer pFirstPoint, typename PointType::Pointer pSecondPoint, typename PointType::Pointer pThirdPoint)
Definition: line_2d_3.h:170
Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_2d_3.h:628
friend class Line2D3
Definition: line_2d_3.h:1104
virtual Matrix & ShapeFunctionsGradients(Matrix &rResult, CoordinatesArrayType &rPoint)
Definition: line_2d_3.h:916
Vector & DeterminantOfJacobian(Vector &rResult, IntegrationMethod ThisMethod) const override
Determinant of jacobians for given integration method.
Definition: line_2d_3.h:656
Line2D3 & operator=(Line2D3< TOtherPointType > const &rOther)
Definition: line_2d_3.h:273
double DeterminantOfJacobian(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Determinant of jacobian in specific integration point of given integration method....
Definition: line_2d_3.h:678
void PrintInfo(std::ostream &rOStream) const override
Definition: line_2d_3.h:798
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: line_2d_3.h:154
BaseType::PointsArrayType PointsArrayType
Definition: line_2d_3.h:104
This class defines the node.
Definition: node.h:65
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 resize(size_type array_size, bool preserve=true)
Definition: array_1d.h:242
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
#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
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
const GeometryData Line2D3< TPointType >::msGeometryData & msGeometryDimension(), Line2D3< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
const GeometryData BrepCurve< TContainerPointType, TContainerPointEmbeddedType >::msGeometryData & msGeometryDimension
Definition: brep_curve.h:483
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
res
Definition: generate_convection_diffusion_explicit_element.py:211
DN
Definition: generate_convection_diffusion_explicit_element.py:98
def load(f)
Definition: ode_solve.py:307
int k
Definition: quadrature.py:595
float temp
Definition: rotating_cone.py:85
J
Definition: sensitivityMatrix.py:58
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31