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.
tetrahedra_3d_10.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 #include <numeric>
21 
22 // External includes
23 
24 // Project includes
27 #include "utilities/geometry_utilities.h"
30 
31 namespace Kratos
32 {
35 
39 
43 
47 
51 
72 template<class TPointType>
74  : public Geometry<TPointType>
75 {
76 public:
79 
82 
86 
89 
92 
96 
98  using PointType = TPointType;
99 
103  using IndexType = typename BaseType::IndexType;
104 
108  using SizeType = typename BaseType::SizeType;
109 
113 
118 
124 
129 
133 
137 
142 
147 
150 
153 
156 
160 
162  Tetrahedra3D10( typename PointType::Pointer pPoint1,
163  typename PointType::Pointer pPoint2,
164  typename PointType::Pointer pPoint3,
165  typename PointType::Pointer pPoint4,
166  typename PointType::Pointer pPoint5,
167  typename PointType::Pointer pPoint6,
168  typename PointType::Pointer pPoint7,
169  typename PointType::Pointer pPoint8,
170  typename PointType::Pointer pPoint9,
171  typename PointType::Pointer pPoint10
172  )
173  : BaseType( PointsArrayType(), &msGeometryData )
174  {
175  this->Points().reserve( 10 );
176  this->Points().push_back( pPoint1 );
177  this->Points().push_back( pPoint2 );
178  this->Points().push_back( pPoint3 );
179  this->Points().push_back( pPoint4 );
180  this->Points().push_back( pPoint5 );
181  this->Points().push_back( pPoint6 );
182  this->Points().push_back( pPoint7 );
183  this->Points().push_back( pPoint8 );
184  this->Points().push_back( pPoint9 );
185  this->Points().push_back( pPoint10 );
186  }
187 
192  Tetrahedra3D10( const PointsArrayType& ThisPoints )
193  : BaseType( ThisPoints, &msGeometryData )
194  {
195  KRATOS_ERROR_IF( this->PointsNumber() != 10 ) << "Invalid points number. Expected 10, given " << this->PointsNumber() << std::endl;
196  }
197 
199  explicit Tetrahedra3D10(
200  const IndexType GeometryId,
201  const PointsArrayType& rThisPoints
202  ) : BaseType(GeometryId, rThisPoints, &msGeometryData)
203  {
204  KRATOS_ERROR_IF( this->PointsNumber() != 10 ) << "Invalid points number. Expected 10, given " << this->PointsNumber() << std::endl;
205  }
206 
208  explicit Tetrahedra3D10(
209  const std::string& rGeometryName,
210  const PointsArrayType& rThisPoints
211  ) : BaseType(rGeometryName, rThisPoints, &msGeometryData)
212  {
213  KRATOS_ERROR_IF(this->PointsNumber() != 10) << "Invalid points number. Expected 10, given " << this->PointsNumber() << std::endl;
214  }
215 
226  : BaseType( rOther )
227  {
228  }
229 
242  template<class TOtherPointType> Tetrahedra3D10( Tetrahedra3D10<TOtherPointType> const& rOther )
243  : BaseType( rOther )
244  {
245  }
246 
248  ~Tetrahedra3D10() override {}
249 
251  {
253  }
254 
256  {
258  }
259 
263 
276  {
277  BaseType::operator=( rOther );
278  return *this;
279  }
280 
292  template<class TOtherPointType>
294  {
295  BaseType::operator=( rOther );
296 
297  return *this;
298  }
299 
303 
309  typename BaseType::Pointer Create(
310  PointsArrayType const& rThisPoints
311  ) const override
312  {
313  return typename BaseType::Pointer( new Tetrahedra3D10( rThisPoints ) );
314  }
315 
322  typename BaseType::Pointer Create(
323  const IndexType NewGeometryId,
324  PointsArrayType const& rThisPoints
325  ) const override
326  {
327  return typename BaseType::Pointer( new Tetrahedra3D10( NewGeometryId, rThisPoints ) );
328  }
329 
335  typename BaseType::Pointer Create(
336  const BaseType& rGeometry
337  ) const override
338  {
339  auto p_geometry = typename BaseType::Pointer( new Tetrahedra3D10( rGeometry.Points() ) );
340  p_geometry->SetData(rGeometry.GetData());
341  return p_geometry;
342  }
343 
350  typename BaseType::Pointer Create(
351  const IndexType NewGeometryId,
352  const BaseType& rGeometry
353  ) const override
354  {
355  auto p_geometry = typename BaseType::Pointer( new Tetrahedra3D10( NewGeometryId, rGeometry.Points() ) );
356  p_geometry->SetData(rGeometry.GetData());
357  return p_geometry;
358  }
359 
363 
379  double Length() const override
380  {
381  return std::sqrt( std::abs( this->DeterminantOfJacobian( PointType() ) ) );
382  }
383 
398  double Area() const override
399  {
400  return Volume();
401  }
402 
411  double Volume() const override
412  {
414  }
415 
427  double DomainSize() const override
428  {
429  return Volume();
430  }
431 
439  CoordinatesArrayType& rResult,
440  const CoordinatesArrayType& rPoint
441  ) const override
442  {
443  // Using linear approximation for planar faces
444  if (this->FacesArePlanar()) {
445  return GeometryUtils::PointLocalCoordinatesPlanarFaceTetrahedra(*this, rResult, rPoint);
446  } else {
447  return BaseType::PointLocalCoordinates( rResult, rPoint );
448  }
449  }
450 
459  bool IsInside(
460  const CoordinatesArrayType& rPoint,
461  CoordinatesArrayType& rResult,
462  const double Tolerance = std::numeric_limits<double>::epsilon()
463  ) const override
464  {
465  this->PointLocalCoordinates( rResult, rPoint );
466 
467  if ( (rResult[0] >= (0.0 - Tolerance)) && (rResult[0] <= (1.0 + Tolerance)) ) {
468  if ( (rResult[1] >= (0.0 - Tolerance)) && (rResult[1] <= (1.0 + Tolerance)) ) {
469  if ( (rResult[2] >= (0.0 - Tolerance)) && (rResult[2] <= (1.0 + Tolerance)) ) {
470  if ((( 1.0 - ( rResult[0] + rResult[1] + rResult[2] ) ) >= (0.0 - Tolerance) ) && (( 1.0 - ( rResult[0] + rResult[1] + rResult[2] ) ) <= (1.0 + Tolerance) ) ) {
471  return true;
472  }
473  }
474  }
475  }
476 
477  return false;
478  }
479 
483 
495  SizeType EdgesNumber() const override
496  {
497  return 6;
498  }
499 
509  {
511  typedef typename Geometry<TPointType>::Pointer EdgePointerType;
512  edges.push_back( EdgePointerType( new EdgeType(
513  this->pGetPoint( 0 ),
514  this->pGetPoint( 1 ),
515  this->pGetPoint( 4 ) ) ) );
516  edges.push_back( EdgePointerType( new EdgeType(
517  this->pGetPoint( 1 ),
518  this->pGetPoint( 2 ),
519  this->pGetPoint( 5 ) ) ) );
520  edges.push_back( EdgePointerType( new EdgeType(
521  this->pGetPoint( 2 ),
522  this->pGetPoint( 0 ),
523  this->pGetPoint( 6 ) ) ) );
524  edges.push_back( EdgePointerType( new EdgeType(
525  this->pGetPoint( 0 ),
526  this->pGetPoint( 3 ),
527  this->pGetPoint( 7 ) ) ) );
528  edges.push_back( EdgePointerType( new EdgeType(
529  this->pGetPoint( 1 ),
530  this->pGetPoint( 3 ),
531  this->pGetPoint( 8 ) ) ) );
532  edges.push_back( EdgePointerType( new EdgeType(
533  this->pGetPoint( 2 ),
534  this->pGetPoint( 3 ),
535  this->pGetPoint( 9 ) ) ) );
536 
537  return edges;
538  }
539 
543 
551  SizeType FacesNumber() const override
552  {
553  return 4;
554  }
555 
565  {
567  typedef typename Geometry<TPointType>::Pointer FacePointerType;
568  faces.push_back( FacePointerType( new FaceType(
569  this->pGetPoint( 0 ),
570  this->pGetPoint( 2 ),
571  this->pGetPoint( 1 ),
572  this->pGetPoint( 6 ),
573  this->pGetPoint( 5 ),
574  this->pGetPoint( 4 ) ) ) );
575  faces.push_back( FacePointerType( new FaceType(
576  this->pGetPoint( 0 ),
577  this->pGetPoint( 3 ),
578  this->pGetPoint( 2 ),
579  this->pGetPoint( 7 ),
580  this->pGetPoint( 9 ),
581  this->pGetPoint( 6 ) ) ) );
582  faces.push_back( FacePointerType( new FaceType(
583  this->pGetPoint( 0 ),
584  this->pGetPoint( 1 ),
585  this->pGetPoint( 3 ),
586  this->pGetPoint( 4 ),
587  this->pGetPoint( 8 ),
588  this->pGetPoint( 7 ) ) ) );
589  faces.push_back( FacePointerType( new FaceType(
590  this->pGetPoint( 2 ),
591  this->pGetPoint( 3 ),
592  this->pGetPoint( 1 ),
593  this->pGetPoint( 9 ),
594  this->pGetPoint( 8 ),
595  this->pGetPoint( 5 ) ) ) );
596  return faces;
597  }
598 
604  double AverageEdgeLength() const override {
605  const GeometriesArrayType edges = this->GenerateEdges();
606  return std::accumulate(
607  edges.begin(),
608  edges.end(),
609  0.0,
610  [](double sum, const auto& rEdge) {return sum + rEdge.Length();}
611  ) * 0.16666666666666666667;
612  }
613 
614  Matrix& PointsLocalCoordinates( Matrix& rResult ) const override
615  {
616  if(rResult.size1()!= 10 || rResult.size2()!= 3)
617  rResult.resize(10, 3, false);
618  rResult(0,0)=0.0;
619  rResult(0,1)=0.0;
620  rResult(0,2)=0.0;
621  rResult(1,0)=1.0;
622  rResult(1,1)=0.0;
623  rResult(1,2)=0.0;
624  rResult(2,0)=0.0;
625  rResult(2,1)=1.0;
626  rResult(2,2)=0.0;
627  rResult(3,0)=0.0;
628  rResult(3,1)=0.0;
629  rResult(3,2)=1.0;
630  rResult(4,0)=0.5;
631  rResult(4,1)=0.0;
632  rResult(4,2)=0.0;
633  rResult(5,0)=0.5;
634  rResult(5,1)=0.5;
635  rResult(5,2)=0.0;
636  rResult(6,0)=0.0;
637  rResult(6,1)=0.5;
638  rResult(6,2)=0.0;
639  rResult(7,0)=0.0;
640  rResult(7,1)=0.0;
641  rResult(7,2)=0.5;
642  rResult(8,0)=0.5;
643  rResult(8,1)=0.0;
644  rResult(8,2)=0.5;
645  rResult(9,0)=0.0;
646  rResult(9,1)=0.5;
647  rResult(9,2)=0.5;
648  return rResult;
649  }
650 
654 
655  Vector& ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType& rCoordinates) const override
656  {
657  ShapeFunctionsValuesImpl(rResult, rCoordinates);
658  return rResult;
659  }
660 
670  double ShapeFunctionValue( IndexType ShapeFunctionIndex,
671  const CoordinatesArrayType& rPoint ) const override
672  {
673  double fourthCoord = 1.0 - ( rPoint[0] + rPoint[1] + rPoint[2] );
674 
675  switch ( ShapeFunctionIndex )
676  {
677  case 0:
678  return( fourthCoord*( 2*fourthCoord - 1 ) );
679  case 1:
680  return( rPoint[0]*( 2*rPoint[0] - 1 ) );
681  case 2:
682  return( rPoint[1]*( 2*rPoint[1] - 1 ) );
683  case 3:
684  return( rPoint[2]*( 2*rPoint[2] - 1 ) );
685  case 4:
686  return( 4*fourthCoord*rPoint[0] );
687  case 5:
688  return( 4*rPoint[0]*rPoint[1] );
689  case 6:
690  return( 4*fourthCoord*rPoint[1] );
691  case 7:
692  return( 4*fourthCoord*rPoint[2] );
693  case 8:
694  return( 4*rPoint[0]*rPoint[2] );
695  case 9:
696  return( 4*rPoint[1]*rPoint[2] );
697  default:
698  KRATOS_ERROR << "Wrong index of shape function!" << *this << std::endl;
699  }
700 
701  return 0;
702  }
703 
705  const CoordinatesArrayType& rPoint) const override
706  {
707  const double fourthCoord = 1.0 - (rPoint[0] + rPoint[1] + rPoint[2]);
708  if (rResult.size1() != this->size() || rResult.size2() != this->LocalSpaceDimension())
709  rResult.resize(this->size(), this->LocalSpaceDimension(), false);
710 
711  rResult(0, 0) = -(4.0 * fourthCoord - 1.0);
712  rResult(0, 1) = -(4.0 * fourthCoord - 1.0);
713  rResult(0, 2) = -(4.0 * fourthCoord - 1.0);
714  rResult(1, 0) = 4.0 * rPoint[0] - 1.0;
715  rResult(1, 1) = 0.0;
716  rResult(1, 2) = 0.0;
717  rResult(2, 0) = 0.0;
718  rResult(2, 1) = 4.0 * rPoint[1] - 1.0;
719  rResult(2, 2) = 0.0;
720  rResult(3, 0) = 0.0;
721  rResult(3, 1) = 0.0;
722  rResult(3, 2) = 4.0 * rPoint[2] - 1.0;
723  rResult(4, 0) = -4.0 * rPoint[0] + 4.0 * fourthCoord;
724  rResult(4, 1) = -4.0 * rPoint[0];
725  rResult(4, 2) = -4.0 * rPoint[0];
726  rResult(5, 0) = 4.0 * rPoint[1];
727  rResult(5, 1) = 4.0 * rPoint[0];
728  rResult(5, 2) = 0.0;
729  rResult(6, 0) = -4.0 * rPoint[1];
730  rResult(6, 1) = -4.0 * rPoint[1] + 4.0 * fourthCoord;
731  rResult(6, 2) = -4.0 * rPoint[1];
732  rResult(7, 0) = -4.0 * rPoint[2];
733  rResult(7, 1) = -4.0 * rPoint[2];
734  rResult(7, 2) = -4.0 * rPoint[2] + 4.0 * fourthCoord;
735  rResult(8, 0) = 4.0 * rPoint[2];
736  rResult(8, 1) = 0.0;
737  rResult(8, 2) = 4.0 * rPoint[0];
738  rResult(9, 0) = 0.0;
739  rResult(9, 1) = 4.0 * rPoint[2];
740  rResult(9, 2) = 4.0 * rPoint[1];
741 
742  return rResult;
743  }
744 
754  bool HasIntersection(const Point& rLowPoint, const Point& rHighPoint) const override
755  {
756  // Check if the faces are planar
757  if (this->FacesArePlanar()) {
758  // TODO: Move implementation to GeometryUtils to avoid creating a new tetrahedra
760  this->pGetPoint(0),
761  this->pGetPoint(1),
762  this->pGetPoint(2),
763  this->pGetPoint(3)).HasIntersection(rLowPoint, rHighPoint);
764  } else {
765  KRATOS_ERROR << "\"HasIntersection\" is not implemented for non-planar 10 noded tetrahedra.";
766  }
767  return false;
768  }
769 
773 
787  const CoordinatesArrayType& rPointGlobalCoordinates,
788  const double Tolerance = std::numeric_limits<double>::epsilon()
789  ) const override
790  {
791  // Point to compute distance to
792  const Point point(rPointGlobalCoordinates);
793 
794  // Check if point is inside
795  CoordinatesArrayType aux_coordinates;
796  if (this->IsInside(rPointGlobalCoordinates, aux_coordinates, Tolerance)) {
797  return 0.0;
798  }
799 
800  // Compute distance to faces
801  std::array<double, 4> distances;
802  distances[0] = GeometryUtils::PointDistanceToTriangle3D(this->GetPoint(0), this->GetPoint(2), this->GetPoint(1), this->GetPoint(6), this->GetPoint(5), this->GetPoint(4), point);
803  distances[1] = GeometryUtils::PointDistanceToTriangle3D(this->GetPoint(0), this->GetPoint(3), this->GetPoint(2), this->GetPoint(7), this->GetPoint(9), this->GetPoint(6), point);
804  distances[2] = GeometryUtils::PointDistanceToTriangle3D(this->GetPoint(0), this->GetPoint(1), this->GetPoint(3), this->GetPoint(4), this->GetPoint(8), this->GetPoint(7), point);
805  distances[3] = GeometryUtils::PointDistanceToTriangle3D(this->GetPoint(2), this->GetPoint(3), this->GetPoint(1), this->GetPoint(9), this->GetPoint(8), this->GetPoint(5), point);
806  const auto min = std::min_element(distances.begin(), distances.end());
807  return *min;
808  }
809 
813 
821  std::string Info() const override
822  {
823  return "3 dimensional tetrahedra with ten nodes in 3D space";
824  }
825 
833  void PrintInfo( std::ostream& rOStream ) const override
834  {
835  rOStream << "3 dimensional tetrahedra with ten nodes in 3D space";
836  }
837 
847  void PrintData( std::ostream& rOStream ) const override
848  {
849  // Base Geometry class PrintData call
850  BaseType::PrintData( rOStream );
851  std::cout << std::endl;
852 
853  // If the geometry has valid points, calculate and output its data
854  if (this->AllPointsAreValid()) {
855  Matrix jacobian;
856  this->Jacobian( jacobian, PointType() );
857  rOStream << " Jacobian in the origin\t : " << jacobian;
858  }
859  }
860 private:
863 
864  static const GeometryData msGeometryData;
865 
866  static const GeometryDimension msGeometryDimension;
867 
871 
872  friend class Serializer;
873 
874  void save( Serializer& rSerializer ) const override
875  {
877  }
878 
879  void load( Serializer& rSerializer ) override
880  {
882  }
883 
887 
888  Tetrahedra3D10(): BaseType( PointsArrayType(), &msGeometryData ) {}
889 
893 
900  static void ShapeFunctionsValuesImpl(Vector &rResult, const CoordinatesArrayType& rCoordinates)
901  {
902  if (rResult.size() != 10)
903  rResult.resize(10, false);
904  const double fourthCoord = 1.0 - rCoordinates[0] - rCoordinates[1] - rCoordinates[2];
905  rResult[0] = fourthCoord * (2.0 * fourthCoord - 1.0);
906  rResult[1] = rCoordinates[0] * (2.0 * rCoordinates[0] - 1.0);
907  rResult[2] = rCoordinates[1] * (2.0 * rCoordinates[1] - 1.0);
908  rResult[3] = rCoordinates[2] * (2.0 * rCoordinates[2] - 1.0);
909  rResult[4] = 4.0 * fourthCoord * rCoordinates[0];
910  rResult[5] = 4.0 * rCoordinates[0] * rCoordinates[1];
911  rResult[6] = 4.0 * rCoordinates[1] * fourthCoord;
912  rResult[7] = 4.0 * rCoordinates[2] * fourthCoord;
913  rResult[8] = 4.0 * rCoordinates[0] * rCoordinates[2];
914  rResult[9] = 4.0 * rCoordinates[1] * rCoordinates[2];
915  }
916 
925  static Matrix CalculateShapeFunctionsIntegrationPointsValues(typename BaseType::IntegrationMethod ThisMethod)
926  {
927  const std::size_t points_number = 10;
928  IntegrationPointsContainerType all_integration_points = AllIntegrationPoints();
929  IntegrationPointsArrayType integration_points = all_integration_points[static_cast<int>(ThisMethod)];
930  Matrix shape_function_values(integration_points.size(), points_number);
931  //loop over all integration points
932  Vector N(points_number);
933  for (std::size_t pnt = 0; pnt < integration_points.size(); ++pnt)
934  {
935  ShapeFunctionsValuesImpl(N, integration_points[pnt]);
936  for (std::size_t i = 0; i < N.size(); ++i)
937  shape_function_values(pnt, i) = N[i];
938  }
939  return shape_function_values;
940  }
941 
952  CalculateShapeFunctionsIntegrationPointsLocalGradients(
953  typename BaseType::IntegrationMethod ThisMethod )
954  {
955  IntegrationPointsContainerType all_integration_points =
956  AllIntegrationPoints();
957  IntegrationPointsArrayType integration_points = all_integration_points[static_cast<int>(ThisMethod)];
958  //number of integration points
959  const int integration_points_number = integration_points.size();
960  ShapeFunctionsGradientsType d_shape_f_values( integration_points_number );
961  //initialising container
962  //loop over all integration points
963 
964  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
965  {
966  double fourthCoord = 1.0 - ( integration_points[pnt].X() + integration_points[pnt].Y() + integration_points[pnt].Z() );
967  double fourthCoord_DX = -1.0;
968  double fourthCoord_DY = -1.0;
969  double fourthCoord_DZ = -1.0;
970 
971  Matrix result = ZeroMatrix( 10, 3 );
972  result( 0, 0 ) = ( 4 * fourthCoord - 1.0 ) * fourthCoord_DX;
973  result( 0, 1 ) = ( 4 * fourthCoord - 1.0 ) * fourthCoord_DY;
974  result( 0, 2 ) = ( 4 * fourthCoord - 1.0 ) * fourthCoord_DZ;
975  result( 1, 0 ) = 4 * integration_points[pnt].X() - 1.0;
976  result( 1, 1 ) = 0.0;
977  result( 1, 2 ) = 0.0;
978  result( 2, 0 ) = 0.0;
979  result( 2, 1 ) = 4 * integration_points[pnt].Y() - 1.0;
980  result( 2, 2 ) = 0.0;
981  result( 3, 0 ) = 0.0;
982  result( 3, 1 ) = 0.0;
983  result( 3, 2 ) = 4 * integration_points[pnt].Z() - 1.0 ;
984  result( 4, 0 ) = 4 * fourthCoord_DX * integration_points[pnt].X() + 4 * fourthCoord;
985  result( 4, 1 ) = 4 * fourthCoord_DY * integration_points[pnt].X();
986  result( 4, 2 ) = 4 * fourthCoord_DZ * integration_points[pnt].X();
987  result( 5, 0 ) = 4 * integration_points[pnt].Y();
988  result( 5, 1 ) = 4 * integration_points[pnt].X();
989  result( 5, 2 ) = 0.0;
990  result( 6, 0 ) = 4 * fourthCoord_DX * integration_points[pnt].Y();
991  result( 6, 1 ) = 4 * fourthCoord_DY * integration_points[pnt].Y() + 4 * fourthCoord;
992  result( 6, 2 ) = 4 * fourthCoord_DZ * integration_points[pnt].Y();
993  result( 7, 0 ) = 4 * fourthCoord_DX * integration_points[pnt].Z();
994  result( 7, 1 ) = 4 * fourthCoord_DY * integration_points[pnt].Z();
995  result( 7, 2 ) = 4 * fourthCoord_DZ * integration_points[pnt].Z() + 4 * fourthCoord;
996  result( 8, 0 ) = 4 * integration_points[pnt].Z();
997  result( 8, 1 ) = 0.0;
998  result( 8, 2 ) = 4 * integration_points[pnt].X();
999  result( 9, 0 ) = 0.0;
1000  result( 9, 1 ) = 4 * integration_points[pnt].Z();
1001  result( 9, 2 ) = 4 * integration_points[pnt].Y();
1002 
1003  d_shape_f_values[pnt] = result;
1004  }
1005 
1006  return d_shape_f_values;
1007  }
1008 
1009  static const IntegrationPointsContainerType AllIntegrationPoints()
1010  {
1011  IntegrationPointsContainerType integration_points =
1012  {
1013  {
1014  Quadrature < TetrahedronGaussLegendreIntegrationPoints1,
1015  3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1016  Quadrature < TetrahedronGaussLegendreIntegrationPoints2,
1017  3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1018  Quadrature < TetrahedronGaussLegendreIntegrationPoints3,
1019  3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1020  Quadrature < TetrahedronGaussLegendreIntegrationPoints4,
1021  3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1022  Quadrature < TetrahedronGaussLegendreIntegrationPoints5,
1023  3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1024  }
1025  };
1026  return integration_points;
1027  }
1028 
1029  static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
1030  {
1031  ShapeFunctionsValuesContainerType shape_functions_values =
1032  {
1033  {
1034  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1036  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1038  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1040  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1042  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1044  }
1045  };
1046  return shape_functions_values;
1047  }
1048 
1050  AllShapeFunctionsLocalGradients()
1051  {
1052  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients =
1053  {
1054  {
1055  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1057  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1059  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1061  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1063  Tetrahedra3D10<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(
1065  }
1066  };
1067  return shape_functions_local_gradients;
1068  }
1069 
1075  bool FacesArePlanar() const
1076  {
1077  constexpr double tol = 1e-6;
1078  constexpr std::array<std::array<size_t, 3>, 6> edges{
1079  {{0, 1, 4}, {1, 2, 5}, {2, 0, 6}, {0, 3, 7}, {1, 3, 8}, {2, 3, 9}}};
1080  const auto& r_points = this->Points();
1081  for (const auto& r_edge : edges) {
1082  const double a = MathUtils<double>::Norm3(r_points[r_edge[0]] - r_points[r_edge[1]]);
1083  const double b = MathUtils<double>::Norm3(r_points[r_edge[1]] - r_points[r_edge[2]]);
1084  const double c = MathUtils<double>::Norm3(r_points[r_edge[2]] - r_points[r_edge[0]]);
1085  if (b + c > a*(1.0+tol) ) {
1086  return false;
1087  }
1088  }
1089  return true;
1090  }
1091 
1095 
1096  template<class TOtherPointType> friend class Tetrahedra3D10;
1097 
1101 
1103 };// Class Tetrahedra3D10
1104 
1108 
1112 
1114 template<class TPointType> inline std::istream& operator >> (
1115  std::istream& rIStream, Tetrahedra3D10<TPointType>& rThis );
1116 
1118 template<class TPointType> inline std::ostream& operator << (
1119  std::ostream& rOStream, const Tetrahedra3D10<TPointType>& rThis )
1120 {
1121  rThis.PrintInfo( rOStream );
1122  rOStream << std::endl;
1123  rThis.PrintData( rOStream );
1124 
1125  return rOStream;
1126 }
1127 
1128 template<class TPointType> const
1129 GeometryData Tetrahedra3D10<TPointType>::msGeometryData(
1132  Tetrahedra3D10<TPointType>::AllIntegrationPoints(),
1133  Tetrahedra3D10<TPointType>::AllShapeFunctionsValues(),
1134  AllShapeFunctionsLocalGradients()
1135 );
1136 
1137 template<class TPointType> const
1138 GeometryDimension Tetrahedra3D10<TPointType>::msGeometryDimension(3, 3);
1139 
1141 
1142 }// namespace Kratos.
Definition: geometry_data.h:60
KratosGeometryType
Definition: geometry_data.h:110
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
PointerVector< GeometryType > GeometriesArrayType
Definition: geometry.h:127
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
DenseVector< double > NormalType
Definition: geometry.h:203
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
SizeType LocalSpaceDimension() const
Definition: geometry.h:1300
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
Vector & DeterminantOfJacobian(Vector &rResult) const
Definition: geometry.h:3154
virtual CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const
Returns the local coordinates of a given arbitrary point.
Definition: geometry.h:1854
PointerVector< TPointType > PointsArrayType
Definition: geometry.h:118
DenseVector< Matrix > JacobiansType
Definition: geometry.h:183
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
GeometryData::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: geometry.h:189
JacobiansType & Jacobian(JacobiansType &rResult) const
Definition: geometry.h:2901
PointType::CoordinatesArrayType CoordinatesArrayType
Definition: geometry.h:147
IntegrationPoint< 3 > IntegrationPointType
Definition: geometry.h:154
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
static TGeometryType::CoordinatesArrayType & PointLocalCoordinatesPlanarFaceTetrahedra(const TGeometryType &rGeometry, typename TGeometryType::CoordinatesArrayType &rResult, const typename TGeometryType::CoordinatesArrayType &rPoint)
Returns the local coordinates of a given arbitrary point for a given linear tetrahedra.
Definition: geometry_utilities.h:67
static double PointDistanceToTriangle3D(const Point &rTrianglePoint1, const Point &rTrianglePoint2, const Point &rTrianglePoint3, const Point &rPoint)
This function calculates the distance of a 3D point to a 3D triangle.
Definition: geometry_utilities.cpp:172
Short class definition.
Definition: integration_point.h:52
static double ComputeVolume3DGeometry(const Geometry< TPointType > &rGeometry)
This method calculates and returns the volume of the geometry from a 3D geometry.
Definition: integration_utilities.h:168
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
An three node 3D line geometry with quadratic shape functions.
Definition: line_3d_3.h:66
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
This class defines the node.
Definition: node.h:65
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
iterator end()
Definition: pointer_vector.h:177
void reserve(size_type dim)
Definition: pointer_vector.h:319
iterator begin()
Definition: pointer_vector.h:169
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 ten node tetrahedra geometry with quadratic shape functions.
Definition: tetrahedra_3d_10.h:75
GeometriesArrayType GenerateFaces() const override
Returns all faces of the current geometry.
Definition: tetrahedra_3d_10.h:564
typename BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: tetrahedra_3d_10.h:128
typename BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: tetrahedra_3d_10.h:136
Tetrahedra3D10(typename PointType::Pointer pPoint1, typename PointType::Pointer pPoint2, typename PointType::Pointer pPoint3, typename PointType::Pointer pPoint4, typename PointType::Pointer pPoint5, typename PointType::Pointer pPoint6, typename PointType::Pointer pPoint7, typename PointType::Pointer pPoint8, typename PointType::Pointer pPoint9, typename PointType::Pointer pPoint10)
Default constructor.
Definition: tetrahedra_3d_10.h:162
KRATOS_CLASS_POINTER_DEFINITION(Tetrahedra3D10)
Pointer definition of Tetrahedra3D10.
Tetrahedra3D10(Tetrahedra3D10< TOtherPointType > const &rOther)
Definition: tetrahedra_3d_10.h:242
std::string Info() const override
Definition: tetrahedra_3d_10.h:821
typename BaseType::PointsArrayType PointsArrayType
Definition: tetrahedra_3d_10.h:112
SizeType FacesNumber() const override
Returns the number of faces of the current geometry.
Definition: tetrahedra_3d_10.h:551
SizeType EdgesNumber() const override
This method gives you number of all edges of this geometry.
Definition: tetrahedra_3d_10.h:495
~Tetrahedra3D10() override
Destructor. Does nothing!!!
Definition: tetrahedra_3d_10.h:248
double Volume() const override
This method calculate and return volume of this geometry.
Definition: tetrahedra_3d_10.h:411
typename BaseType::CoordinatesArrayType CoordinatesArrayType
Type of coordinates array.
Definition: tetrahedra_3d_10.h:152
friend class Tetrahedra3D10
Definition: tetrahedra_3d_10.h:1096
Tetrahedra3D10 & operator=(Tetrahedra3D10< TOtherPointType > const &rOther)
Definition: tetrahedra_3d_10.h:293
Tetrahedra3D10(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: tetrahedra_3d_10.h:208
typename BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: tetrahedra_3d_10.h:146
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: tetrahedra_3d_10.h:350
Geometry< TPointType > BaseType
Geometry as base class.
Definition: tetrahedra_3d_10.h:81
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: tetrahedra_3d_10.h:322
double Area() const override
Definition: tetrahedra_3d_10.h:398
Tetrahedra3D10(const PointsArrayType &ThisPoints)
Constructor with points array.
Definition: tetrahedra_3d_10.h:192
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
Definition: tetrahedra_3d_10.h:670
void PrintData(std::ostream &rOStream) const override
Definition: tetrahedra_3d_10.h:847
Tetrahedra3D10 & operator=(const Tetrahedra3D10 &rOther)
Definition: tetrahedra_3d_10.h:275
CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const override
Returns the local coordinates of a given arbitrary point.
Definition: tetrahedra_3d_10.h:438
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: tetrahedra_3d_10.h:614
Triangle3D6< TPointType > FaceType
Definition: tetrahedra_3d_10.h:85
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: tetrahedra_3d_10.h:786
typename BaseType::GeometriesArrayType GeometriesArrayType
Definition: tetrahedra_3d_10.h:95
TPointType PointType
Redefinition of template parameter TPointType.
Definition: tetrahedra_3d_10.h:98
void PrintInfo(std::ostream &rOStream) const override
Definition: tetrahedra_3d_10.h:833
BaseType::Pointer Create(PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: tetrahedra_3d_10.h:309
GeometriesArrayType GenerateEdges() const override
This method gives you all edges of this geometry.
Definition: tetrahedra_3d_10.h:508
double DomainSize() const override
Definition: tetrahedra_3d_10.h:427
typename BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: tetrahedra_3d_10.h:132
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: tetrahedra_3d_10.h:704
BaseType::Pointer Create(const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: tetrahedra_3d_10.h:335
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: tetrahedra_3d_10.h:255
Line3D3< TPointType > EdgeType
Type of edge and face geometries.
Definition: tetrahedra_3d_10.h:84
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: tetrahedra_3d_10.h:655
Tetrahedra3D10(Tetrahedra3D10 const &rOther)
Definition: tetrahedra_3d_10.h:225
Tetrahedra3D10(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: tetrahedra_3d_10.h:199
typename BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: tetrahedra_3d_10.h:123
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: tetrahedra_3d_10.h:250
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: tetrahedra_3d_10.h:459
bool HasIntersection(const Point &rLowPoint, const Point &rHighPoint) const override
Definition: tetrahedra_3d_10.h:754
double AverageEdgeLength() const override
Definition: tetrahedra_3d_10.h:604
double Length() const override
Definition: tetrahedra_3d_10.h:379
A four node tetrahedra geometry with linear shape functions.
Definition: tetrahedra_3d_4.h:59
bool HasIntersection(const BaseType &rThisGeometry) const override
Test if this geometry intersects with other geometry.
Definition: tetrahedra_3d_4.h:1367
A six node 3D triangular geometry with quadratic shape functions.
Definition: triangle_3d_6.h:68
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
const GeometryData Tetrahedra3D10< TPointType >::msGeometryData & msGeometryDimension(), Tetrahedra3D10< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
static double min(double a, double b)
Definition: GeometryFunctions.h:71
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
TExpressionType::data_type sum(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:675
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
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
int tol
Definition: hinsberg_optimization.py:138
def load(f)
Definition: ode_solve.py:307
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31