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.
triangle_2d_6.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/line_2d_3.h"
26 
27 namespace Kratos
28 {
31 
35 
39 
43 
47 
65 template<class TPointType>
67  : public Geometry<TPointType>
68 {
69 public:
73 
78 
83 
88 
93 
99 
103  typedef TPointType PointType;
104 
111  typedef typename BaseType::IndexType IndexType;
112 
118  typedef typename BaseType::SizeType SizeType;
119 
125 
130 
136 
145 
152 
158 
164 
171 
178 
186 
194 
199 
203 
204 // Triangle2D6( const PointType& FirstPoint,
205 // const PointType& SecondPoint,
206 // const PointType& ThirdPoint,
207 // const PointType& FourthPoint,
208 // const PointType& FifthPoint,
209 // const PointType& SixthPoint
210 // )
211 // : BaseType( PointsArrayType(), &msGeometryData )
212 // {
213 // this->Points().push_back( typename PointType::Pointer( new PointType( FirstPoint ) ) );
214 // this->Points().push_back( typename PointType::Pointer( new PointType( SecondPoint ) ) );
215 // this->Points().push_back( typename PointType::Pointer( new PointType( ThirdPoint ) ) );
216 // this->Points().push_back( typename PointType::Pointer( new PointType( FourthPoint ) ) );
217 // this->Points().push_back( typename PointType::Pointer( new PointType( FifthPoint ) ) );
218 // this->Points().push_back( typename PointType::Pointer( new PointType( SixthPoint ) ) );
219 // }
220 
221  Triangle2D6( typename PointType::Pointer pFirstPoint,
222  typename PointType::Pointer pSecondPoint,
223  typename PointType::Pointer pThirdPoint,
224  typename PointType::Pointer pFourthPoint,
225  typename PointType::Pointer pFifthPoint,
226  typename PointType::Pointer pSixthPoint
227  )
228  : BaseType( PointsArrayType(), &msGeometryData )
229  {
230  this->Points().push_back( pFirstPoint );
231  this->Points().push_back( pSecondPoint );
232  this->Points().push_back( pThirdPoint );
233  this->Points().push_back( pFourthPoint );
234  this->Points().push_back( pFifthPoint );
235  this->Points().push_back( pSixthPoint );
236  }
237 
238  Triangle2D6( const PointsArrayType& ThisPoints )
239  : BaseType( ThisPoints, &msGeometryData )
240  {
241  if ( this->PointsNumber() != 6 )
242  {
243  KRATOS_ERROR << "Invalid points number. Expected 6, given " << this->PointsNumber() << std::endl;
244  }
245  }
246 
248  explicit Triangle2D6(
249  const IndexType GeometryId,
250  const PointsArrayType& rThisPoints
251  ) : BaseType( GeometryId, rThisPoints, &msGeometryData )
252  {
253  KRATOS_ERROR_IF( this->PointsNumber() != 6 ) << "Invalid points number. Expected 6, given " << this->PointsNumber() << std::endl;
254  }
255 
257  explicit Triangle2D6(
258  const std::string& rGeometryName,
259  const PointsArrayType& rThisPoints
260  ) : BaseType( rGeometryName, rThisPoints, &msGeometryData )
261  {
262  KRATOS_ERROR_IF(this->PointsNumber() != 6) << "Invalid points number. Expected 6, given " << this->PointsNumber() << std::endl;
263  }
264 
274  Triangle2D6( Triangle2D6 const& rOther )
275  : BaseType( rOther )
276  {
277  }
278 
291  template<class TOtherPointType> Triangle2D6( Triangle2D6<TOtherPointType> const& rOther )
292  : BaseType( rOther )
293  {
294  }
295 
299  ~Triangle2D6() override {}
300 
302  {
304  }
305 
307  {
309  }
310 
314 
327  {
328  BaseType::operator=( rOther );
329  return *this;
330  }
331 
343  template<class TOtherPointType>
345  {
346  BaseType::operator=( rOther );
347  return *this;
348  }
349 
353 
359  typename BaseType::Pointer Create(
360  PointsArrayType const& rThisPoints
361  ) const override
362  {
363  return typename BaseType::Pointer( new Triangle2D6( rThisPoints ) );
364  }
365 
372  typename BaseType::Pointer Create(
373  const IndexType NewGeometryId,
374  PointsArrayType const& rThisPoints
375  ) const override
376  {
377  return typename BaseType::Pointer( new Triangle2D6( NewGeometryId, rThisPoints ) );
378  }
379 
385  typename BaseType::Pointer Create(
386  const BaseType& rGeometry
387  ) const override
388  {
389  auto p_geometry = typename BaseType::Pointer( new Triangle2D6( rGeometry.Points() ) );
390  p_geometry->SetData(rGeometry.GetData());
391  return p_geometry;
392  }
393 
400  typename BaseType::Pointer Create(
401  const IndexType NewGeometryId,
402  const BaseType& rGeometry
403  ) const override
404  {
405  auto p_geometry = typename BaseType::Pointer( new Triangle2D6( NewGeometryId, rGeometry.Points() ) );
406  p_geometry->SetData(rGeometry.GetData());
407  return p_geometry;
408  }
409 
415  Matrix& PointsLocalCoordinates( Matrix& rResult ) const override
416  {
417  rResult.resize( 6, 2,false );
418  noalias( rResult ) = ZeroMatrix( 6, 2 );
419  rResult( 0, 0 ) = 0.0;
420  rResult( 0, 1 ) = 0.0;
421  rResult( 1, 0 ) = 1.0;
422  rResult( 1, 1 ) = 0.0;
423  rResult( 2, 0 ) = 0.0;
424  rResult( 2, 1 ) = 1.0;
425  rResult( 3, 0 ) = 0.5;
426  rResult( 3, 1 ) = 0.0;
427  rResult( 4, 0 ) = 0.5;
428  rResult( 4, 1 ) = 0.5;
429  rResult( 5, 0 ) = 0.0;
430  rResult( 5, 1 ) = 0.5;
431  return rResult;
432  }
433 
437 
457  double Length() const override
458  {
459  return std::sqrt( std::abs( Area() ) );
460  }
461 
471  double Area() const override
472  {
474  }
475 
476  // TODO: Code activated in June 2023
477  // /**
478  // * @brief This method calculates and returns the volume of this geometry.
479  // * @return Error, the volume of a 2D geometry is not defined
480  // * @see Length()
481  // * @see Area()
482  // * @see Volume()
483  // */
484  // double Volume() const override
485  // {
486  // KRATOS_ERROR << "Triangle2D6:: Method not well defined. Replace with DomainSize() instead" << std::endl;
487  // return 0.0;
488  // }
489 
498  double DomainSize() const override
499  {
500  return Area();
501  }
502 
511  bool IsInside(
512  const CoordinatesArrayType& rPoint,
513  CoordinatesArrayType& rResult,
514  const double Tolerance = std::numeric_limits<double>::epsilon()
515  ) const override
516  {
517  this->PointLocalCoordinates( rResult, rPoint );
518 
519  if ( (rResult[0] >= (0.0-Tolerance)) && (rResult[0] <= (1.0+Tolerance)) )
520  {
521  if ( (rResult[1] >= (0.0-Tolerance)) && (rResult[1] <= (1.0+Tolerance)) )
522  {
523  if ( (rResult[0] + rResult[1]) <= (1.0+Tolerance) )
524  {
525  return true;
526  }
527  }
528  }
529 
530  return false;
531  }
532 
536 
543  Vector& ShapeFunctionsValues(Vector& rResult, const CoordinatesArrayType& rCoordinates) const override
544  {
545  if (rResult.size() != 6)
546  rResult.resize(6, false);
547  const double thirdCoord = 1.0 - rCoordinates[0] - rCoordinates[1];
548  rResult[0] = thirdCoord * (2.0 * thirdCoord - 1.0);
549  rResult[1] = rCoordinates[0] * (2.0 * rCoordinates[0] - 1.0);
550  rResult[2] = rCoordinates[1] * (2.0 * rCoordinates[1] - 1.0);
551  rResult[3] = 4.0 * thirdCoord * rCoordinates[0];
552  rResult[4] = 4.0 * rCoordinates[0] * rCoordinates[1];
553  rResult[5] = 4.0 * rCoordinates[1] * thirdCoord;
554  return rResult;
555  }
556 
566  double ShapeFunctionValue( IndexType ShapeFunctionIndex,
567  const CoordinatesArrayType& rPoint ) const override
568  {
569 
570  double thirdCoord = 1 - rPoint[0] - rPoint[1];
571 
572  switch ( ShapeFunctionIndex )
573  {
574  case 0:
575  return( thirdCoord*( 2*thirdCoord - 1 ) );
576  case 1:
577  return( rPoint[0]*( 2*rPoint[0] - 1 ) );
578  case 2:
579  return( rPoint[1]*( 2*rPoint[1] - 1 ) );
580  case 3:
581  return( 4*thirdCoord*rPoint[0] );
582  case 4:
583  return( 4*rPoint[0]*rPoint[1] );
584  case 5:
585  return( 4*rPoint[1]*thirdCoord );
586 
587  default:
588  KRATOS_ERROR << "Wrong index of shape function!" << *this << std::endl;
589  }
590 
591  return 0;
592  }
593 
597 
605  std::string Info() const override
606  {
607  return "2 dimensional triangle with six nodes in 2D space";
608  }
609 
616  void PrintInfo( std::ostream& rOStream ) const override
617  {
618  rOStream << "2 dimensional triangle with six nodes in 2D space";
619  }
620 
635  void PrintData( std::ostream& rOStream ) const override
636  {
637  // Base Geometry class PrintData call
638  BaseType::PrintData( rOStream );
639  std::cout << std::endl;
640 
641  // If the geometry has valid points, calculate and output its data
642  if (this->AllPointsAreValid()) {
643  Matrix jacobian;
644  this->Jacobian( jacobian, PointType() );
645  rOStream << " Jacobian in the origin\t : " << jacobian;
646  }
647  }
648 
652 
664  SizeType EdgesNumber() const override
665  {
666  return 3;
667  }
668 
678  {
680 
681  edges.push_back( Kratos::make_shared<EdgeType>( this->pGetPoint( 0 ), this->pGetPoint( 1 ), this->pGetPoint( 3 ) ) );
682  edges.push_back( Kratos::make_shared<EdgeType>( this->pGetPoint( 1 ), this->pGetPoint( 2 ), this->pGetPoint( 4 ) ) );
683  edges.push_back( Kratos::make_shared<EdgeType>( this->pGetPoint( 2 ), this->pGetPoint( 0 ), this->pGetPoint( 5 ) ) );
684  return edges;
685  }
686 
687  SizeType FacesNumber() const override
688  {
689  return 3;
690  }
691 
692  //Connectivities of faces required
694  {
695  if(NumberNodesInFaces.size() != 3 )
696  NumberNodesInFaces.resize(3,false);
697 
698  NumberNodesInFaces[0]=3;
699  NumberNodesInFaces[1]=3;
700  NumberNodesInFaces[2]=3;
701 
702  }
703 
704 
706  {
707  // faces in columns
708  if(NodesInFaces.size1() != 4 || NodesInFaces.size2() != 3)
709  NodesInFaces.resize(4,3,false);
710 
711  //compatible to Edges() function. Triangle library considers a different order
712  NodesInFaces(0,0)=0;//face or master node
713  NodesInFaces(1,0)=1;
714  NodesInFaces(2,0)=4;
715  NodesInFaces(3,0)=2;
716 
717  NodesInFaces(0,1)=1;//face or master node
718  NodesInFaces(1,1)=2;
719  NodesInFaces(2,1)=5;
720  NodesInFaces(3,1)=0;
721 
722  NodesInFaces(0,2)=2;//face or master node
723  NodesInFaces(1,2)=0;
724  NodesInFaces(2,2)=3;
725  NodesInFaces(3,2)=1;
726 
727  }
728 
729 
735  IntegrationMethod ThisMethod )
736  {
737  ShapeFunctionsGradientsType localGradients
738  = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
739  const int integration_points_number
740  = msGeometryData.IntegrationPointsNumber( ThisMethod );
741  ShapeFunctionsGradientsType Result( integration_points_number );
742 
743  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
744  {
745  Result[pnt] = localGradients[pnt];
746  }
747 
748  return Result;
749  }
750 
756  {
757  IntegrationMethod ThisMethod = msGeometryData.DefaultIntegrationMethod();
758  ShapeFunctionsGradientsType localGradients
759  = CalculateShapeFunctionsIntegrationPointsLocalGradients( ThisMethod );
760  const int integration_points_number
761  = msGeometryData.IntegrationPointsNumber( ThisMethod );
762  ShapeFunctionsGradientsType Result( integration_points_number );
763 
764  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
765  {
766  Result[pnt] = localGradients[pnt];
767  }
768 
769  return Result;
770  }
771 
782  const CoordinatesArrayType& rPoint ) const override
783  {
784  rResult.resize( 6, 2 ,false);
785  double thirdCoord = 1 - rPoint[0] - rPoint[1];
786  double thirdCoord_DX = -1;
787  double thirdCoord_DY = -1;
788 
789  noalias( rResult ) = ZeroMatrix( 6, 2 );
790  rResult( 0, 0 ) = ( 4 * thirdCoord - 1 ) * thirdCoord_DX;
791  rResult( 0, 1 ) = ( 4 * thirdCoord - 1 ) * thirdCoord_DY;
792  rResult( 1, 0 ) = 4 * rPoint[0] - 1;
793  rResult( 1, 1 ) = 0;
794  rResult( 2, 0 ) = 0;
795  rResult( 2, 1 ) = 4 * rPoint[1] - 1;
796  rResult( 3, 0 ) = 4 * thirdCoord_DX * rPoint[0] + 4 * thirdCoord;
797  rResult( 3, 1 ) = 4 * thirdCoord_DY * rPoint[0];
798  rResult( 4, 0 ) = 4 * rPoint[1];
799  rResult( 4, 1 ) = 4 * rPoint[0];
800  rResult( 5, 0 ) = 4 * rPoint[1] * thirdCoord_DX;
801  rResult( 5, 1 ) = 4 * rPoint[1] * thirdCoord_DY + 4 * thirdCoord;
802  return rResult;
803  }
804 
805 
806 
817  {
818  rResult.resize( 6, 2 ,false);
819  double thirdCoord = 1 - rPoint[0] - rPoint[1];
820  double thirdCoord_DX = -1;
821  double thirdCoord_DY = -1;
822 
823  noalias( rResult ) = ZeroMatrix( 6, 2 );
824  rResult( 0, 0 ) = ( 4 * thirdCoord - 1 ) * thirdCoord_DX;
825  rResult( 0, 1 ) = ( 4 * thirdCoord - 1 ) * thirdCoord_DY;
826  rResult( 1, 0 ) = 4 * rPoint[0] - 1;
827  rResult( 1, 1 ) = 0;
828  rResult( 2, 0 ) = 0;
829  rResult( 2, 1 ) = 4 * rPoint[1] - 1;
830  rResult( 3, 0 ) = 4 * thirdCoord_DX * rPoint[0] + 4 * thirdCoord;
831  rResult( 3, 1 ) = 4 * thirdCoord_DY * rPoint[0];
832  rResult( 4, 0 ) = 4 * rPoint[1];
833  rResult( 4, 1 ) = 4 * rPoint[0];
834  rResult( 5, 0 ) = 4 * rPoint[1] * thirdCoord_DX;
835  rResult( 5, 1 ) = 4 * rPoint[1] * thirdCoord_DY + 4 * thirdCoord;
836  return rResult;
837  }
838 
846  {
847  if ( rResult.size() != this->PointsNumber() )
848  {
849  // KLUDGE: While there is a bug in
850  // ublas vector resize, I have to put this beside resizing!!
852  rResult.swap( temp );
853  }
854 
855  rResult[0].resize( 2, 2 ,false);
856  rResult[1].resize( 2, 2 ,false);
857  rResult[2].resize( 2, 2 ,false);
858  rResult[3].resize( 2, 2 ,false);
859  rResult[4].resize( 2, 2 ,false);
860  rResult[5].resize( 2, 2 ,false);
861 
862  rResult[0]( 0, 0 ) = 4.0;
863  rResult[0]( 0, 1 ) = 4.0;
864  rResult[0]( 1, 0 ) = 4.0;
865  rResult[0]( 1, 1 ) = 4.0;
866  rResult[1]( 0, 0 ) = 4.0;
867  rResult[1]( 0, 1 ) = 0.0;
868  rResult[1]( 1, 0 ) = 0.0;
869  rResult[1]( 1, 1 ) = 0.0;
870  rResult[2]( 0, 0 ) = 0.0;
871  rResult[2]( 0, 1 ) = 0.0;
872  rResult[2]( 1, 0 ) = 0.0;
873  rResult[2]( 1, 1 ) = 4.0;
874  rResult[3]( 0, 0 ) = -8.0;
875  rResult[3]( 0, 1 ) = -4.0;
876  rResult[3]( 1, 0 ) = -4.0;
877  rResult[3]( 1, 1 ) = 0.0;
878  rResult[4]( 0, 0 ) = 0.0;
879  rResult[4]( 0, 1 ) = 4.0;
880  rResult[4]( 1, 0 ) = 4.0;
881  rResult[4]( 1, 1 ) = 0.0;
882  rResult[5]( 0, 0 ) = 0.0;
883  rResult[5]( 0, 1 ) = -4.0;
884  rResult[5]( 1, 0 ) = -4.0;
885  rResult[5]( 1, 1 ) = -8.0;
886 
887  return rResult;
888  }
889 
897  {
898  if ( rResult.size() != this->PointsNumber() )
899  {
900  // KLUDGE: While there is a bug in
901  // ublas vector resize, I have to put this beside resizing!!
902 // ShapeFunctionsGradientsType
904  rResult.swap( temp );
905  }
906 
907  for ( IndexType i = 0; i < rResult.size(); i++ )
908  {
910  rResult[i].swap( temp );
911  }
912 
913  rResult[0][0].resize( 2, 2 ,false);
914 
915  rResult[0][1].resize( 2, 2 ,false);
916  rResult[1][0].resize( 2, 2 ,false);
917  rResult[1][1].resize( 2, 2 ,false);
918  rResult[2][0].resize( 2, 2 ,false);
919  rResult[2][1].resize( 2, 2 ,false);
920  rResult[3][0].resize( 2, 2 ,false);
921  rResult[3][1].resize( 2, 2 ,false);
922  rResult[4][0].resize( 2, 2 ,false);
923  rResult[4][1].resize( 2, 2 ,false);
924  rResult[5][0].resize( 2, 2 ,false);
925  rResult[5][1].resize( 2, 2 ,false);
926 
927 
928  for ( int i = 0; i < 6; i++ )
929  {
930  rResult[i][0]( 0, 0 ) = 0.0;
931  rResult[i][0]( 0, 1 ) = 0.0;
932  rResult[i][0]( 1, 0 ) = 0.0;
933  rResult[i][0]( 1, 1 ) = 0.0;
934  rResult[i][1]( 0, 0 ) = 0.0;
935  rResult[i][1]( 0, 1 ) = 0.0;
936  rResult[i][1]( 1, 0 ) = 0.0;
937  rResult[i][1]( 1, 1 ) = 0.0;
938  }
939 
940  return rResult;
941  }
942 
946 
948 
949 protected:
954 private:
957 
958  static const GeometryData msGeometryData;
959 
960  static const GeometryDimension msGeometryDimension;
961 
965 
966  friend class Serializer;
967 
968  void save( Serializer& rSerializer ) const override
969  {
971  }
972 
973  void load( Serializer& rSerializer ) override
974  {
976  }
977 
978  Triangle2D6(): BaseType( PointsArrayType(), &msGeometryData ) {}
979 
983 
984 
988 
989 
993 
1001  static Matrix CalculateShapeFunctionsIntegrationPointsValues(
1002  typename BaseType::IntegrationMethod ThisMethod )
1003  {
1004  IntegrationPointsContainerType all_integration_points =
1005  AllIntegrationPoints();
1006  IntegrationPointsArrayType integration_points = all_integration_points[static_cast<int>(ThisMethod)];
1007  //number of integration points
1008  const int integration_points_number = integration_points.size();
1009  //number of nodes in current geometry
1010  const int points_number = 6;
1011  //setting up return matrix
1012  Matrix shape_function_values( integration_points_number, points_number );
1013  //loop over all integration points
1014 
1015  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
1016  {
1017  double thirdCoord = 1 - integration_points[pnt].X() - integration_points[pnt].Y();
1018 
1019  shape_function_values( pnt, 0 ) = thirdCoord * ( 2 * thirdCoord - 1 ) ;
1020  shape_function_values( pnt, 1 ) = integration_points[pnt].X() * ( 2 * integration_points[pnt].X() - 1 ) ;
1021  shape_function_values( pnt, 2 ) = integration_points[pnt].Y() * ( 2 * integration_points[pnt].Y() - 1 ) ;
1022  shape_function_values( pnt, 3 ) = 4 * thirdCoord * integration_points[pnt].X();
1023  shape_function_values( pnt, 4 ) = 4 * integration_points[pnt].X() * integration_points[pnt].Y();
1024  shape_function_values( pnt, 5 ) = 4 * integration_points[pnt].Y() * thirdCoord;
1025 
1026  }
1027 
1028  return shape_function_values;
1029  }
1030 
1041  CalculateShapeFunctionsIntegrationPointsLocalGradients(
1042  typename BaseType::IntegrationMethod ThisMethod )
1043  {
1044  IntegrationPointsContainerType all_integration_points =
1045  AllIntegrationPoints();
1046  IntegrationPointsArrayType integration_points = all_integration_points[static_cast<int>(ThisMethod)];
1047  //number of integration points
1048  const int integration_points_number = integration_points.size();
1049  ShapeFunctionsGradientsType d_shape_f_values( integration_points_number );
1050  //initialising container
1051  //std::fill(d_shape_f_values.begin(), d_shape_f_values.end(), Matrix(4,2));
1052  //loop over all integration points
1053 
1054  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
1055  {
1056  Matrix result( 6, 2 );
1057  double thirdCoord = 1 - integration_points[pnt].X() - integration_points[pnt].Y();
1058  double thirdCoord_DX = -1;
1059  double thirdCoord_DY = -1;
1060 
1061  noalias( result ) = ZeroMatrix( 6, 2 );
1062  result( 0, 0 ) = ( 4 * thirdCoord - 1 ) * thirdCoord_DX;
1063  result( 0, 1 ) = ( 4 * thirdCoord - 1 ) * thirdCoord_DY;
1064  result( 1, 0 ) = 4 * integration_points[pnt].X() - 1;
1065  result( 1, 1 ) = 0;
1066  result( 2, 0 ) = 0;
1067  result( 2, 1 ) = 4 * integration_points[pnt].Y() - 1;
1068  result( 3, 0 ) = 4 * thirdCoord_DX * integration_points[pnt].X() + 4 * thirdCoord;
1069  result( 3, 1 ) = 4 * thirdCoord_DY * integration_points[pnt].X();
1070  result( 4, 0 ) = 4 * integration_points[pnt].Y();
1071  result( 4, 1 ) = 4 * integration_points[pnt].X();
1072  result( 5, 0 ) = 4 * integration_points[pnt].Y() * thirdCoord_DX;
1073  result( 5, 1 ) = 4 * integration_points[pnt].Y() * thirdCoord_DY + 4 * thirdCoord;
1074 
1075  d_shape_f_values[pnt] = result;
1076  }
1077 
1078  return d_shape_f_values;
1079  }
1080 
1084  static const IntegrationPointsContainerType AllIntegrationPoints()
1085  {
1086  IntegrationPointsContainerType integration_points =
1087  {
1088  {
1089  Quadrature<TriangleGaussLegendreIntegrationPoints1, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1090  Quadrature<TriangleGaussLegendreIntegrationPoints2, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1091  Quadrature<TriangleGaussLegendreIntegrationPoints3, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1092  Quadrature<TriangleGaussLegendreIntegrationPoints4, 2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1093  }
1094  };
1095  return integration_points;
1096  }
1097 
1098  static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
1099  {
1100  ShapeFunctionsValuesContainerType shape_functions_values =
1101  {
1102  {
1103  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1105  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1107  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1109  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1111  }
1112  };
1113  return shape_functions_values;
1114  }
1115 
1117  AllShapeFunctionsLocalGradients()
1118  {
1119  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients =
1120  {
1121  {
1122  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_1 ),
1123  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_2 ),
1124  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_3 ),
1125  Triangle2D6<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 )
1126  }
1127  };
1128  return shape_functions_local_gradients;
1129  }
1130 
1134 
1135 
1139 
1140 
1144 
1145  template<class TOtherPointType> friend class Triangle2D6;
1146 
1150 
1151 
1153 }; // Class Geometry
1154 
1158 
1159 
1163 
1166 template<class TPointType> inline std::istream& operator >> (
1167  std::istream& rIStream,
1168  Triangle2D6<TPointType>& rThis );
1172 template<class TPointType> inline std::ostream& operator << (
1173  std::ostream& rOStream,
1174  const Triangle2D6<TPointType>& rThis )
1175 {
1176  rThis.PrintInfo( rOStream );
1177  rOStream << std::endl;
1178  rThis.PrintData( rOStream );
1179  return rOStream;
1180 }
1181 
1183 
1184 template<class TPointType> const
1185 GeometryData Triangle2D6<TPointType>::msGeometryData(
1188  Triangle2D6<TPointType>::AllIntegrationPoints(),
1189  Triangle2D6<TPointType>::AllShapeFunctionsValues(),
1190  AllShapeFunctionsLocalGradients()
1191 );
1192 
1193 template<class TPointType>
1194 const GeometryDimension Triangle2D6<TPointType>::msGeometryDimension(2, 2);
1195 
1196 }// 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
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
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
virtual CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const
Returns the local coordinates of a given arbitrary point.
Definition: geometry.h:1854
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
JacobiansType & Jacobian(JacobiansType &rResult) const
Definition: geometry.h:2901
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
Short class definition.
Definition: integration_point.h:52
static double ComputeArea2DGeometry(const Geometry< TPointType > &rGeometry)
This method calculates and returns the volume of the geometry from a 3D geometry.
Definition: integration_utilities.h:107
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
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
A six node 2D triangular geometry with quadratic shape functions.
Definition: triangle_2d_6.h:68
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: triangle_2d_6.h:157
TPointType PointType
Definition: triangle_2d_6.h:103
Triangle2D6(Triangle2D6 const &rOther)
Definition: triangle_2d_6.h:274
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients()
Definition: triangle_2d_6.h:755
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: triangle_2d_6.h:177
virtual Matrix & ShapeFunctionsGradients(Matrix &rResult, CoordinatesArrayType &rPoint)
Definition: triangle_2d_6.h:816
BaseType::ShapeFunctionsSecondDerivativesType ShapeFunctionsSecondDerivativesType
Definition: triangle_2d_6.h:185
Triangle2D6(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: triangle_2d_6.h:257
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: triangle_2d_6.h:301
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: triangle_2d_6.h:129
void NumberNodesInFaces(DenseVector< unsigned int > &NumberNodesInFaces) const override
Definition: triangle_2d_6.h:693
Triangle2D6(Triangle2D6< TOtherPointType > const &rOther)
Definition: triangle_2d_6.h:291
BaseType::IndexType IndexType
Definition: triangle_2d_6.h:111
GeometryData::IntegrationMethod IntegrationMethod
Definition: triangle_2d_6.h:92
BaseType::JacobiansType JacobiansType
Definition: triangle_2d_6.h:170
Triangle2D6 & operator=(Triangle2D6< TOtherPointType > const &rOther)
Definition: triangle_2d_6.h:344
SizeType FacesNumber() const override
Returns the number of faces of the current geometry.
Definition: triangle_2d_6.h:687
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: triangle_2d_6.h:415
BaseType::SizeType SizeType
Definition: triangle_2d_6.h:118
friend class Triangle2D6
Definition: triangle_2d_6.h:1145
Triangle2D6 & operator=(const Triangle2D6 &rOther)
Definition: triangle_2d_6.h:326
Geometry< TPointType > BaseType
Definition: triangle_2d_6.h:77
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
Definition: triangle_2d_6.h:566
Triangle2D6(typename PointType::Pointer pFirstPoint, typename PointType::Pointer pSecondPoint, typename PointType::Pointer pThirdPoint, typename PointType::Pointer pFourthPoint, typename PointType::Pointer pFifthPoint, typename PointType::Pointer pSixthPoint)
Definition: triangle_2d_6.h:221
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients(IntegrationMethod ThisMethod)
Definition: triangle_2d_6.h:734
BaseType::GeometriesArrayType GeometriesArrayType
Definition: triangle_2d_6.h:98
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: triangle_2d_6.h:511
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: triangle_2d_6.h:144
void NodesInFaces(DenseMatrix< unsigned int > &NodesInFaces) const override
Definition: triangle_2d_6.h:705
BaseType::Pointer Create(const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: triangle_2d_6.h:385
KRATOS_CLASS_POINTER_DEFINITION(Triangle2D6)
double Area() const override
This method calculates and returns area or surface area of this geometry depending to it's dimension.
Definition: triangle_2d_6.h:471
void PrintData(std::ostream &rOStream) const override
Definition: triangle_2d_6.h:635
BaseType::ShapeFunctionsThirdDerivativesType ShapeFunctionsThirdDerivativesType
Definition: triangle_2d_6.h:193
BaseType::PointsArrayType PointsArrayType
Definition: triangle_2d_6.h:124
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: triangle_2d_6.h:151
double Length() const override
Definition: triangle_2d_6.h:457
std::string Info() const override
Definition: triangle_2d_6.h:605
SizeType EdgesNumber() const override
This method gives you number of all edges of this geometry.
Definition: triangle_2d_6.h:664
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: triangle_2d_6.h:781
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
Returns vector of shape function values at local coordinate.
Definition: triangle_2d_6.h:543
ShapeFunctionsSecondDerivativesType & ShapeFunctionsSecondDerivatives(ShapeFunctionsSecondDerivativesType &rResult, const CoordinatesArrayType &rPoint) const override
Definition: triangle_2d_6.h:845
BaseType::Pointer Create(PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: triangle_2d_6.h:359
~Triangle2D6() override
Definition: triangle_2d_6.h:299
GeometriesArrayType GenerateEdges() const override
This method gives you all edges of this geometry.
Definition: triangle_2d_6.h:677
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: triangle_2d_6.h:163
double DomainSize() const override
This method calculates and returns length, area or volume of this geometry depending to it's dimensio...
Definition: triangle_2d_6.h:498
void PrintInfo(std::ostream &rOStream) const override
Definition: triangle_2d_6.h:616
ShapeFunctionsThirdDerivativesType & ShapeFunctionsThirdDerivatives(ShapeFunctionsThirdDerivativesType &rResult, const CoordinatesArrayType &rPoint) const override
Definition: triangle_2d_6.h:896
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: triangle_2d_6.h:400
Triangle2D6(const PointsArrayType &ThisPoints)
Definition: triangle_2d_6.h:238
Triangle2D6(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: triangle_2d_6.h:248
Line2D3< TPointType > EdgeType
Definition: triangle_2d_6.h:82
BaseType::IntegrationPointType IntegrationPointType
Definition: triangle_2d_6.h:135
BaseType::NormalType NormalType
Definition: triangle_2d_6.h:198
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: triangle_2d_6.h:372
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: triangle_2d_6.h:306
Short class definition.
Definition: array_1d.h:61
#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
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
const GeometryData Triangle2D6< TPointType >::msGeometryData & msGeometryDimension(), Triangle2D6< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
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
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
integer i
Definition: TensorModule.f:17