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.
quadrilateral_3d_4.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 // Bodhinanda Chandra
16 //
17 
18 #pragma once
19 
20 // System includes
21 
22 // External includes
23 
24 // Project includes
25 #include "geometries/line_3d_2.h"
31 #include "utilities/geometry_utilities.h"
32 
33 namespace Kratos
34 {
37 
41 
45 
49 
53 
74 template<class TPointType> class Quadrilateral3D4
75  : public Geometry<TPointType>
76 {
77 public:
81 
86 
88 
93 
98 
103 
108 
114 
118  typedef TPointType PointType;
119 
126  typedef typename BaseType::IndexType IndexType;
127 
133  typedef typename BaseType::SizeType SizeType;
134 
140 
145 
151 
160 
167 
173 
179 
186 
193 
201 
209 
214 
215 
219 
220 // Quadrilateral3D4( const PointType& FirstPoint,
221 // const PointType& SecondPoint,
222 // const PointType& ThirdPoint,
223 // const PointType& FourthPoint )
224 // : BaseType( PointsArrayType(), &msGeometryData )
225 // {
226 // this->Points().push_back( typename PointType::Pointer( new PointType( FirstPoint ) ) );
227 // this->Points().push_back( typename PointType::Pointer( new PointType( SecondPoint ) ) );
228 // this->Points().push_back( typename PointType::Pointer( new PointType( ThirdPoint ) ) );
229 // this->Points().push_back( typename PointType::Pointer( new PointType( FourthPoint ) ) );
230 // }
231 
232  Quadrilateral3D4( typename PointType::Pointer pFirstPoint,
233  typename PointType::Pointer pSecondPoint,
234  typename PointType::Pointer pThirdPoint,
235  typename PointType::Pointer pFourthPoint )
236  : BaseType( PointsArrayType(), &msGeometryData )
237  {
238  this->Points().push_back( pFirstPoint );
239  this->Points().push_back( pSecondPoint );
240  this->Points().push_back( pThirdPoint );
241  this->Points().push_back( pFourthPoint );
242  }
243 
244  explicit Quadrilateral3D4( const PointsArrayType& ThisPoints )
245  : BaseType( ThisPoints, &msGeometryData )
246  {
247  if ( this->PointsNumber() != 4 )
248  KRATOS_ERROR << "Invalid points number. Expected 4, given " << this->PointsNumber() << std::endl;
249  }
250 
253  const IndexType GeometryId,
254  const PointsArrayType& rThisPoints
255  ) : BaseType(GeometryId, rThisPoints, &msGeometryData)
256  {
257  KRATOS_ERROR_IF( this->PointsNumber() != 4 ) << "Invalid points number. Expected 4, given " << this->PointsNumber() << std::endl;
258  }
259 
262  const std::string& rGeometryName,
263  const PointsArrayType& rThisPoints
264  ) : BaseType(rGeometryName, rThisPoints, &msGeometryData)
265  {
266  KRATOS_ERROR_IF(this->PointsNumber() != 4) << "Invalid points number. Expected 4, given " << this->PointsNumber() << std::endl;
267  }
268 
279  : BaseType( rOther )
280  {
281  }
282 
295  template<class TOtherPointType> explicit Quadrilateral3D4( Quadrilateral3D4<TOtherPointType> const& rOther )
296  : BaseType( rOther )
297  {
298  }
299 
303  ~Quadrilateral3D4() override {}
304 
306  {
308  }
309 
311  {
313  }
314 
318 
331  {
332  BaseType::operator=( rOther );
333  return *this;
334  }
335 
347  template<class TOtherPointType>
349  {
350  BaseType::operator=( rOther );
351  return *this;
352  }
353 
357 
364  typename BaseType::Pointer Create(
365  const IndexType NewGeometryId,
366  PointsArrayType const& rThisPoints
367  ) const override
368  {
369  return typename BaseType::Pointer( new Quadrilateral3D4( NewGeometryId, rThisPoints ) );
370  }
371 
378  typename BaseType::Pointer Create(
379  const IndexType NewGeometryId,
380  const BaseType& rGeometry
381  ) const override
382  {
383  auto p_geometry = typename BaseType::Pointer( new Quadrilateral3D4( NewGeometryId, rGeometry.Points() ) );
384  p_geometry->SetData(rGeometry.GetData());
385  return p_geometry;
386  }
387 
389  SizeType PointsNumberInDirection(IndexType LocalDirectionIndex) const override
390  {
391  if ((LocalDirectionIndex == 0) || (LocalDirectionIndex == 1)) {
392  return 2;
393  }
394  KRATOS_ERROR << "Possible direction index reaches from 0-1. Given direction index: "
395  << LocalDirectionIndex << std::endl;
396  }
397 
403  Matrix& PointsLocalCoordinates( Matrix& rResult ) const override
404  {
405  rResult.resize( 4, 2, false );
406  noalias( rResult ) = ZeroMatrix( 4, 2 );
407  rResult( 0, 0 ) = -1.0;
408  rResult( 0, 1 ) = -1.0;
409  rResult( 1, 0 ) = 1.0;
410  rResult( 1, 1 ) = -1.0;
411  rResult( 2, 0 ) = 1.0;
412  rResult( 2, 1 ) = 1.0;
413  rResult( 3, 0 ) = -1.0;
414  rResult( 3, 1 ) = 1.0;
415  return rResult;
416  }
417 
421 
441  double Length() const override
442  {
443  return std::sqrt( Area() );
444  }
445 
455  double Area() const override
456  {
457  const IntegrationMethod integration_method = msGeometryData.DefaultIntegrationMethod();
458  return IntegrationUtilities::ComputeDomainSize(*this, integration_method);
459  }
460 
468  double Volume() const override
469  {
470  KRATOS_WARNING("Quadrilateral3D4") << "Method not well defined. Replace with DomainSize() instead. This method preserves current behaviour but will be changed in June 2023 (returning error instead)" << std::endl;
471  return Area();
472  // TODO: Replace in June 2023
473  // KRATOS_ERROR << "Quadrilateral3D4:: Method not well defined. Replace with DomainSize() instead." << std::endl;
474  // return 0.0;
475  }
476 
485  double DomainSize() const override
486  {
487  return Area();
488  }
489 
490 
499  bool IsInside(
500  const CoordinatesArrayType& rPoint,
501  CoordinatesArrayType& rResult,
502  const double Tolerance = std::numeric_limits<double>::epsilon()
503  ) const override
504  {
505  PointLocalCoordinatesImplementation( rResult, rPoint, true );
506 
507  if ( std::abs(rResult[0]) <= (1.0+Tolerance) ) {
508  if ( std::abs(rResult[1]) <= (1.0+Tolerance) ) {
509  return true;
510  }
511  }
512 
513  return false;
514  }
515 
523  CoordinatesArrayType& rResult,
524  const CoordinatesArrayType& rPoint
525  ) const override
526  {
527  return PointLocalCoordinatesImplementation(rResult, rPoint);
528  }
529 
533 
552  JacobiansType& rResult,
553  IntegrationMethod ThisMethod
554  ) const override
555  {
556  // Getting derivatives of shape functions
557  const ShapeFunctionsGradientsType& shape_functions_gradients =
558  msGeometryData.ShapeFunctionsLocalGradients( ThisMethod );
559  // Getting values of shape functions
560  Matrix shape_functions_values =
561  CalculateShapeFunctionsIntegrationPointsValues( ThisMethod );
562 
563  if ( rResult.size() != this->IntegrationPointsNumber( ThisMethod ) )
564  {
565  // KLUDGE: While there is a bug in ublas
566  // vector resize, I have to put this beside resizing!!
567  JacobiansType temp( this->IntegrationPointsNumber( ThisMethod ) );
568  rResult.swap( temp );
569  }
570 
571  // Loop over all integration points
572  for ( unsigned int pnt = 0; pnt < this->IntegrationPointsNumber( ThisMethod ); pnt++ )
573  {
574  // Defining single jacobian matrix
575  Matrix jacobian = ZeroMatrix( 3, 2 );
576 
577  // Loop over all nodes
578  for ( unsigned int i = 0; i < this->PointsNumber(); i++ )
579  {
580  jacobian( 0, 0 ) +=
581  ( this->GetPoint( i ).X() ) * ( shape_functions_gradients[pnt]( i, 0 ) );
582  jacobian( 0, 1 ) +=
583  ( this->GetPoint( i ).X() ) * ( shape_functions_gradients[pnt]( i, 1 ) );
584  jacobian( 1, 0 ) +=
585  ( this->GetPoint( i ).Y() ) * ( shape_functions_gradients[pnt]( i, 0 ) );
586  jacobian( 1, 1 ) +=
587  ( this->GetPoint( i ).Y() ) * ( shape_functions_gradients[pnt]( i, 1 ) );
588  jacobian( 2, 0 ) +=
589  ( this->GetPoint( i ).Z() ) * ( shape_functions_gradients[pnt]( i, 0 ) );
590  jacobian( 2, 1 ) +=
591  ( this->GetPoint( i ).Z() ) * ( shape_functions_gradients[pnt]( i, 1 ) );
592  }
593 
594  rResult[pnt] = jacobian;
595  } //end of loop over all integration points
596 
597  return rResult;
598  }
599 
619  JacobiansType& rResult,
620  IntegrationMethod ThisMethod,
621  Matrix & DeltaPosition
622  ) const override
623  {
624  // Getting derivatives of shape functions
625  const ShapeFunctionsGradientsType& shape_functions_gradients =
626  msGeometryData.ShapeFunctionsLocalGradients( ThisMethod );
627  // Getting values of shape functions
628  Matrix shape_functions_values = CalculateShapeFunctionsIntegrationPointsValues( ThisMethod );
629 
630  if ( rResult.size() != this->IntegrationPointsNumber( ThisMethod ) )
631  {
632  // KLUDGE: While there is a bug in ublas
633  // vector resize, I have to put this beside resizing!!
634  JacobiansType temp( this->IntegrationPointsNumber( ThisMethod ) );
635  rResult.swap( temp );
636  }
637 
638  //loop over all integration points
639  for ( unsigned int pnt = 0; pnt < this->IntegrationPointsNumber( ThisMethod ); pnt++ )
640  {
641  //defining single jacobian matrix
642  Matrix jacobian = ZeroMatrix( 3, 2 );
643  //loop over all nodes
644 
645  for ( unsigned int i = 0; i < this->PointsNumber(); i++ )
646  {
647  jacobian( 0, 0 ) +=
648  ( this->GetPoint( i ).X() - DeltaPosition(i,0) ) * ( shape_functions_gradients[pnt]( i, 0 ) );
649  jacobian( 0, 1 ) +=
650  ( this->GetPoint( i ).X() - DeltaPosition(i,0) ) * ( shape_functions_gradients[pnt]( i, 1 ) );
651  jacobian( 1, 0 ) +=
652  ( this->GetPoint( i ).Y() - DeltaPosition(i,1) ) * ( shape_functions_gradients[pnt]( i, 0 ) );
653  jacobian( 1, 1 ) +=
654  ( this->GetPoint( i ).Y() - DeltaPosition(i,1) ) * ( shape_functions_gradients[pnt]( i, 1 ) );
655  jacobian( 2, 0 ) +=
656  ( this->GetPoint( i ).Z() - DeltaPosition(i,2) ) * ( shape_functions_gradients[pnt]( i, 0 ) );
657  jacobian( 2, 1 ) +=
658  ( this->GetPoint( i ).Z() - DeltaPosition(i,2) ) * ( shape_functions_gradients[pnt]( i, 1 ) );
659  }
660 
661  rResult[pnt] = jacobian;
662  }//end of loop over all integration points
663 
664  return rResult;
665  }
688  Matrix& rResult,
689  IndexType IntegrationPointIndex,
690  IntegrationMethod ThisMethod
691  ) const override
692  {
693  // Setting up size of jacobian matrix
694  if (rResult.size1() != 3 || rResult.size2() != 2 )
695  rResult.resize( 3, 2, false );
696  noalias(rResult) = ZeroMatrix(3, 2);
697  // Derivatives of shape functions
698  Matrix shape_functions_gradients = msGeometryData.ShapeFunctionLocalGradient(IntegrationPointIndex, ThisMethod );
699 
700  //Elements of jacobian matrix (e.g. J(1,1) = dX1/dXi1)
701  //loop over all nodes
702  for ( unsigned int i = 0; i < this->PointsNumber(); i++ )
703  {
704  rResult( 0, 0 ) +=
705  ( this->GetPoint( i ).X() ) * ( shape_functions_gradients( i, 0 ) );
706  rResult( 0, 1 ) +=
707  ( this->GetPoint( i ).X() ) * ( shape_functions_gradients( i, 1 ) );
708  rResult( 1, 0 ) +=
709  ( this->GetPoint( i ).Y() ) * ( shape_functions_gradients( i, 0 ) );
710  rResult( 1, 1 ) +=
711  ( this->GetPoint( i ).Y() ) * ( shape_functions_gradients( i, 1 ) );
712  rResult( 2, 0 ) +=
713  ( this->GetPoint( i ).Z() ) * ( shape_functions_gradients( i, 0 ) );
714  rResult( 2, 1 ) +=
715  ( this->GetPoint( i ).Z() ) * ( shape_functions_gradients( i, 1 ) );
716  }
717 
718  return rResult;
719  }
720 
736  Matrix& Jacobian( Matrix& rResult, const CoordinatesArrayType& rPoint ) const override
737  {
738  // Setting up size of jacobian matrix
739  if (rResult.size1() != 3 || rResult.size2() != 2 )
740  rResult.resize( 3, 2, false );
741  noalias(rResult) = ZeroMatrix(3, 2);
742 
743  // Derivatives of shape functions
744  Matrix shape_functions_gradients;
745  shape_functions_gradients = ShapeFunctionsLocalGradients(shape_functions_gradients, rPoint );
746  //Elements of jacobian matrix (e.g. J(1,1) = dX1/dXi1)
747 
748  //loop over all nodes
749  for ( unsigned int i = 0; i < this->PointsNumber(); i++ )
750  {
751  rResult( 0, 0 ) += ( this->GetPoint( i ).X() ) * ( shape_functions_gradients( i, 0 ) );
752  rResult( 0, 1 ) += ( this->GetPoint( i ).X() ) * ( shape_functions_gradients( i, 1 ) );
753  rResult( 1, 0 ) += ( this->GetPoint( i ).Y() ) * ( shape_functions_gradients( i, 0 ) );
754  rResult( 1, 1 ) += ( this->GetPoint( i ).Y() ) * ( shape_functions_gradients( i, 1 ) );
755  rResult( 2, 0 ) += ( this->GetPoint( i ).Z() ) * ( shape_functions_gradients( i, 0 ) );
756  rResult( 2, 1 ) += ( this->GetPoint( i ).Z() ) * ( shape_functions_gradients( i, 1 ) );
757  }
758 
759  return rResult;
760  }
761 
778  Vector& rResult,
779  IntegrationMethod ThisMethod
780  ) const override
781  {
782  const unsigned int integration_points_number = msGeometryData.IntegrationPointsNumber( ThisMethod );
783  if(rResult.size() != integration_points_number)
784  {
785  rResult.resize(integration_points_number,false);
786  }
787 
788  JacobiansType jacobian;
789  this->Jacobian( jacobian, ThisMethod);
790 
791  for ( unsigned int pnt = 0; pnt < integration_points_number; pnt++ )
792  {
793  const double det_j = std::pow(jacobian[pnt](0,1),2)*(std::pow(jacobian[pnt](1,0),2) + std::pow(jacobian[pnt](2,0),2)) + std::pow(jacobian[pnt](1,1)*jacobian[pnt](2,0) - jacobian[pnt](1,0)*jacobian[pnt](2,1),2) - 2.0*jacobian[pnt](0,0)*jacobian[pnt](0,1)*(jacobian[pnt](1,0)*jacobian[pnt](1,1) + jacobian[pnt](2,0)*jacobian[pnt](2,1)) + std::pow(jacobian[pnt](0,0),2)*(std::pow(jacobian[pnt](1,1),2) + std::pow(jacobian[pnt](2,1),2));
794 
795  if (det_j < 0.0) KRATOS_ERROR << "WARNING::NEGATIVE VALUE: NOT POSSIBLE TO EVALUATE THE JACOBIAN DETERMINANT" << std::endl;
796 
797  rResult[pnt] = std::sqrt(det_j);
798  }
799 
800  return rResult;
801  }
802 
826  IndexType IntegrationPointIndex,
827  IntegrationMethod ThisMethod
828  ) const override
829  {
830  Matrix jacobian( 3, 2 );
831 
832  this->Jacobian( jacobian, IntegrationPointIndex, ThisMethod);
833 
834  const double det_j = std::pow(jacobian(0,1),2)*(std::pow(jacobian(1,0),2) + std::pow(jacobian(2,0),2)) + std::pow(jacobian(1,1)*jacobian(2,0) - jacobian(1,0)*jacobian(2,1),2) - 2.0*jacobian(0,0)*jacobian(0,1)*(jacobian(1,0)*jacobian(1,1) + jacobian(2,0)*jacobian(2,1)) + std::pow(jacobian(0,0),2)*(std::pow(jacobian(1,1),2) + std::pow(jacobian(2,1),2));
835 
836  if (det_j < 0.0) KRATOS_ERROR << "WARNING::NEGATIVE VALUE: NOT POSSIBLE TO EVALUATE THE JACOBIAN DETERMINANT" << std::endl;
837 
838  return std::sqrt(det_j);
839  }
840 
866  double DeterminantOfJacobian( const CoordinatesArrayType& rPoint ) const override
867  {
868  Matrix jacobian( 3, 2 );
869 
870  this->Jacobian( jacobian, rPoint);
871 
872  const double det_j = std::pow(jacobian(0,1),2)*(std::pow(jacobian(1,0),2) + std::pow(jacobian(2,0),2)) + std::pow(jacobian(1,1)*jacobian(2,0) - jacobian(1,0)*jacobian(2,1),2) - 2.0*jacobian(0,0)*jacobian(0,1)*(jacobian(1,0)*jacobian(1,1) + jacobian(2,0)*jacobian(2,1)) + std::pow(jacobian(0,0),2)*(std::pow(jacobian(1,1),2) + std::pow(jacobian(2,1),2));
873 
874  if (det_j < 0.0) KRATOS_ERROR << "WARNING::NEGATIVE VALUE: NOT POSSIBLE TO EVALUATE THE JACOBIAN DETERMINANT" << std::endl;
875 
876  return std::sqrt(det_j);
877  }
878 
882 
894  SizeType EdgesNumber() const override
895  {
896  return 4;
897  }
898 
908  {
910  typedef typename Geometry<TPointType>::Pointer EdgePointerType;
911  edges.push_back( EdgePointerType( new EdgeType( this->pGetPoint( 0 ), this->pGetPoint( 1 ) ) ) );
912  edges.push_back( EdgePointerType( new EdgeType( this->pGetPoint( 1 ), this->pGetPoint( 2 ) ) ) );
913  edges.push_back( EdgePointerType( new EdgeType( this->pGetPoint( 2 ), this->pGetPoint( 3 ) ) ) );
914  edges.push_back( EdgePointerType( new EdgeType( this->pGetPoint( 3 ), this->pGetPoint( 0 ) ) ) );
915  return edges;
916  }
917 
921 
929  SizeType FacesNumber() const override
930  {
931  return 1;
932  }
933 
943  {
945 
946  faces.push_back( Kratos::make_shared<FaceType>( this->pGetPoint( 0 ), this->pGetPoint( 1 ), this->pGetPoint( 2 ), this->pGetPoint( 3 )) );
947  return faces;
948  }
949 
950  //Connectivities of faces required
952  {
953  if(NumberNodesInFaces.size() != 4 )
954  NumberNodesInFaces.resize(4,false);
955 
956  NumberNodesInFaces[0]=2;
957  NumberNodesInFaces[1]=2;
958  NumberNodesInFaces[2]=2;
959  NumberNodesInFaces[3]=2;
960 
961  }
962 
964  {
965  if(NodesInFaces.size1() != 3 || NodesInFaces.size2() != 4)
966  NodesInFaces.resize(3,4,false);
967  //face 1
968  NodesInFaces(0,0)=0;//contrary node to the face
969  NodesInFaces(1,0)=2;
970  NodesInFaces(2,0)=3;
971  //face 2
972  NodesInFaces(0,1)=1;//contrary node to the face
973  NodesInFaces(1,1)=3;
974  NodesInFaces(2,1)=0;
975  //face 3
976  NodesInFaces(0,2)=2;//contrary node to the face
977  NodesInFaces(1,2)=0;
978  NodesInFaces(2,2)=1;
979  //face 4
980  NodesInFaces(0,3)=3;//contrary node to the face
981  NodesInFaces(1,3)=1;
982  NodesInFaces(2,3)=2;
983  }
984 
991  bool HasIntersection(const GeometryType& ThisGeometry) const override
992  {
993  Triangle3D3<PointType> triangle_0 (this->pGetPoint( 0 ),
994  this->pGetPoint( 1 ),
995  this->pGetPoint( 2 )
996  );
997  Triangle3D3<PointType> triangle_1 (this->pGetPoint( 2 ),
998  this->pGetPoint( 3 ),
999  this->pGetPoint( 0 )
1000  );
1001  Triangle3D3<PointType> triangle_2 (ThisGeometry.pGetPoint( 0 ),
1002  ThisGeometry.pGetPoint( 1 ),
1003  ThisGeometry.pGetPoint( 2 )
1004  );
1005  Triangle3D3<PointType> triangle_3 (ThisGeometry.pGetPoint( 2 ),
1006  ThisGeometry.pGetPoint( 3 ),
1007  ThisGeometry.pGetPoint( 0 )
1008  );
1009 
1010  if ( triangle_0.HasIntersection(triangle_2) ) return true;
1011  else if ( triangle_1.HasIntersection(triangle_2) ) return true;
1012  else if ( triangle_0.HasIntersection(triangle_3) ) return true;
1013  else if ( triangle_1.HasIntersection(triangle_3) ) return true;
1014  else return false;
1015  }
1016 
1025  bool HasIntersection( const Point& rLowPoint, const Point& rHighPoint ) const override
1026  {
1027  Triangle3D3<PointType> triangle_0 (this->pGetPoint( 0 ),
1028  this->pGetPoint( 1 ),
1029  this->pGetPoint( 2 )
1030  );
1031  Triangle3D3<PointType> triangle_1 (this->pGetPoint( 2 ),
1032  this->pGetPoint( 3 ),
1033  this->pGetPoint( 0 )
1034  );
1035 
1036  if ( triangle_0.HasIntersection(rLowPoint, rHighPoint) ) return true;
1037  else if ( triangle_1.HasIntersection(rLowPoint, rHighPoint) ) return true;
1038  else return false;
1039  }
1040 
1041 
1050  GeometriesArrayType Faces( void ) override
1051  {
1052  return GeometriesArrayType();
1053  }
1054 
1058 
1068  double ShapeFunctionValue( IndexType ShapeFunctionIndex,
1069  const CoordinatesArrayType& rPoint ) const override
1070  {
1071  switch ( ShapeFunctionIndex )
1072  {
1073  case 0:
1074  return( 0.25*( 1.0 - rPoint[0] )*( 1.0 - rPoint[1] ) );
1075  case 1:
1076  return( 0.25*( 1.0 + rPoint[0] )*( 1.0 - rPoint[1] ) );
1077  case 2:
1078  return( 0.25*( 1.0 + rPoint[0] )*( 1.0 + rPoint[1] ) );
1079  case 3:
1080  return( 0.25*( 1.0 - rPoint[0] )*( 1.0 + rPoint[1] ) );
1081  default:
1082  KRATOS_ERROR << "Wrong index of shape function!" << *this << std::endl;
1083  }
1084 
1085  return 0;
1086  }
1087 
1099  Vector& ShapeFunctionsValues (Vector &rResult, const CoordinatesArrayType& rCoordinates) const override
1100  {
1101  if(rResult.size() != 4) rResult.resize(4,false);
1102  rResult[0] = 0.25*( 1.0 - rCoordinates[0] )*( 1.0 - rCoordinates[1] );
1103  rResult[1] = 0.25*( 1.0 + rCoordinates[0] )*( 1.0 - rCoordinates[1] );
1104  rResult[2] = 0.25*( 1.0 + rCoordinates[0] )*( 1.0 + rCoordinates[1] );
1105  rResult[3] = 0.25*( 1.0 - rCoordinates[0] )*( 1.0 + rCoordinates[1] );
1106 
1107  return rResult;
1108  }
1109 
1113 
1127  const CoordinatesArrayType& rPointGlobalCoordinates,
1128  const double Tolerance = std::numeric_limits<double>::epsilon()
1129  ) const override
1130  {
1131  // Calculate distances
1132  const Point point(rPointGlobalCoordinates);
1133  return GeometryUtils::PointDistanceToQuadrilateral3D(this->GetPoint(0), this->GetPoint(1), this->GetPoint(2), this->GetPoint(3), point);
1134  }
1135 
1139 
1147  std::string Info() const override
1148  {
1149  return "2 dimensional quadrilateral with four nodes in 3D space";
1150  }
1151 
1158  void PrintInfo( std::ostream& rOStream ) const override
1159  {
1160  rOStream << Info();
1161  }
1162 
1177  void PrintData( std::ostream& rOStream ) const override
1178  {
1179  // Base Geometry class PrintData call
1180  BaseType::PrintData( rOStream );
1181  std::cout << std::endl;
1182 
1183  // If the geometry has valid points, calculate and output its data
1184  if (this->AllPointsAreValid()) {
1185  Matrix jacobian;
1186  this->Jacobian( jacobian, PointType() );
1187  rOStream << " Jacobian in the origin\t : " << jacobian;
1188  }
1189  }
1190 
1196  IntegrationMethod ThisMethod )
1197  {
1198  const ShapeFunctionsGradientsType& shape_function_local_gradient
1199  = msGeometryData.ShapeFunctionsLocalGradients( ThisMethod );
1200  const int& integration_points_number
1201  = msGeometryData.IntegrationPointsNumber( ThisMethod );
1202  ShapeFunctionsGradientsType Result( integration_points_number );
1203 
1204  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
1205  {
1206  Result[pnt] = shape_function_local_gradient[pnt];
1207  }
1208 
1209  return Result;
1210  }
1211 
1217  {
1218  IntegrationMethod ThisMethod = msGeometryData.DefaultIntegrationMethod();
1219  const ShapeFunctionsGradientsType& shape_function_local_gradient
1220  = msGeometryData.ShapeFunctionsLocalGradients( ThisMethod );
1221  const int integration_points_number
1222  = msGeometryData.IntegrationPointsNumber( ThisMethod );
1223  ShapeFunctionsGradientsType Result( integration_points_number );
1224 
1225  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
1226  {
1227  Result[pnt] = shape_function_local_gradient[pnt];
1228  }
1229 
1230  return Result;
1231  }
1232 
1243  Matrix& rResult,
1244  const CoordinatesArrayType& rPoint
1245  ) const override
1246  {
1247  rResult.resize( 4, 2, false );
1248  noalias( rResult ) = ZeroMatrix( 4, 2 );
1249  rResult( 0, 0 ) = -0.25 * ( 1.0 - rPoint[1] );
1250  rResult( 0, 1 ) = -0.25 * ( 1.0 - rPoint[0] );
1251  rResult( 1, 0 ) = 0.25 * ( 1.0 - rPoint[1] );
1252  rResult( 1, 1 ) = -0.25 * ( 1.0 + rPoint[0] );
1253  rResult( 2, 0 ) = 0.25 * ( 1.0 + rPoint[1] );
1254  rResult( 2, 1 ) = 0.25 * ( 1.0 + rPoint[0] );
1255  rResult( 3, 0 ) = -0.25 * ( 1.0 + rPoint[1] );
1256  rResult( 3, 1 ) = 0.25 * ( 1.0 - rPoint[0] );
1257  return rResult;
1258  }
1259 
1270  Matrix& rResult,
1271  PointType& rPoint
1272  )
1273  {
1274  rResult.resize( 4, 2, false );
1275  rResult( 0, 0 ) = -0.25 * ( 1.0 - rPoint.Y() );
1276  rResult( 0, 1 ) = -0.25 * ( 1.0 - rPoint.X() );
1277  rResult( 1, 0 ) = 0.25 * ( 1.0 - rPoint.Y() );
1278  rResult( 1, 1 ) = -0.25 * ( 1.0 + rPoint.X() );
1279  rResult( 2, 0 ) = 0.25 * ( 1.0 + rPoint.Y() );
1280  rResult( 2, 1 ) = 0.25 * ( 1.0 + rPoint.X() );
1281  rResult( 3, 0 ) = -0.25 * ( 1.0 + rPoint.Y() );
1282  rResult( 3, 1 ) = 0.25 * ( 1.0 - rPoint.X() );
1283  return rResult;
1284  }
1285 
1294  const CoordinatesArrayType& rPoint
1295  ) const override
1296  {
1297  if ( rResult.size() != this->PointsNumber() )
1298  {
1299  // KLUDGE: While there is a bug in
1300  // ublas vector resize, I have to put this beside resizing!!
1302  rResult.swap( temp );
1303  }
1304 
1305  rResult[0].resize( 2, 2, false );
1306  rResult[1].resize( 2, 2, false );
1307  rResult[2].resize( 2, 2, false );
1308  rResult[3].resize( 2, 2, false );
1309 
1310  rResult[0]( 0, 0 ) = 0.0;
1311  rResult[0]( 0, 1 ) = 0.25;
1312  rResult[0]( 1, 0 ) = 0.25;
1313  rResult[0]( 1, 1 ) = 0.0;
1314  rResult[1]( 0, 0 ) = 0.0;
1315  rResult[1]( 0, 1 ) = -0.25;
1316  rResult[1]( 1, 0 ) = -0.25;
1317  rResult[1]( 1, 1 ) = 0.0;
1318  rResult[2]( 0, 0 ) = 0.0;
1319  rResult[2]( 0, 1 ) = 0.25;
1320  rResult[2]( 1, 0 ) = 0.25;
1321  rResult[2]( 1, 1 ) = 0.0;
1322  rResult[3]( 0, 0 ) = 0.0;
1323  rResult[3]( 0, 1 ) = -0.25;
1324  rResult[3]( 1, 0 ) = -0.25;
1325  rResult[3]( 1, 1 ) = 0.0;
1326  return rResult;
1327  }
1328 
1337  const CoordinatesArrayType& rPoint
1338  ) const override
1339  {
1340  if ( rResult.size() != this->PointsNumber() )
1341  {
1342  // KLUDGE: While there is a bug in
1343  // ublas vector resize, I have to put this beside resizing!!
1345  rResult.swap( temp );
1346  }
1347 
1348  for ( IndexType i = 0; i < rResult.size(); i++ )
1349  {
1351  rResult[i].swap( temp );
1352  }
1353 
1354  rResult[0][0].resize( 2, 2, false );
1355  rResult[0][1].resize( 2, 2, false );
1356  rResult[1][0].resize( 2, 2, false );
1357  rResult[1][1].resize( 2, 2, false );
1358  rResult[2][0].resize( 2, 2, false );
1359  rResult[2][1].resize( 2, 2, false );
1360  rResult[3][0].resize( 2, 2, false );
1361  rResult[3][1].resize( 2, 2, false );
1362 
1363  for ( int i = 0; i < 4; i++ )
1364  {
1365 
1366  rResult[i][0]( 0, 0 ) = 0.0;
1367  rResult[i][0]( 0, 1 ) = 0.0;
1368  rResult[i][0]( 1, 0 ) = 0.0;
1369  rResult[i][0]( 1, 1 ) = 0.0;
1370  rResult[i][1]( 0, 0 ) = 0.0;
1371  rResult[i][1]( 0, 1 ) = 0.0;
1372  rResult[i][1]( 1, 0 ) = 0.0;
1373  rResult[i][1]( 1, 1 ) = 0.0;
1374  }
1375 
1376  return rResult;
1377  }
1378 
1382 
1412  KRATOS_DEPRECATED_MESSAGE("This method is deprecated. Use either \'ProjectionPointLocalToLocalSpace\' or \'ProjectionPointGlobalToLocalSpace\' instead.")
1414  const CoordinatesArrayType& rPointGlobalCoordinates,
1415  CoordinatesArrayType& rProjectedPointGlobalCoordinates,
1416  CoordinatesArrayType& rProjectedPointLocalCoordinates,
1417  const double Tolerance = std::numeric_limits<double>::epsilon()
1418  ) const override
1419  {
1420  KRATOS_WARNING("ProjectionPoint") << "This method is deprecated. Use either \'ProjectionPointLocalToLocalSpace\' or \'ProjectionPointGlobalToLocalSpace\' instead." << std::endl;
1421 
1422  const int result = ProjectionPointGlobalToLocalSpace(rPointGlobalCoordinates, rProjectedPointLocalCoordinates, Tolerance);
1423 
1424  this->GlobalCoordinates(rProjectedPointGlobalCoordinates, rProjectedPointLocalCoordinates);
1425 
1426  return result;
1427  }
1428 
1430  const CoordinatesArrayType& rPointLocalCoordinates,
1431  CoordinatesArrayType& rProjectionPointLocalCoordinates,
1432  const double Tolerance = std::numeric_limits<double>::epsilon()
1433  ) const override
1434  {
1435  // Calculate the global coordinates of the coordinates to be projected
1436  CoordinatesArrayType pt_gl_coords;
1437  this->GlobalCoordinates(pt_gl_coords, rPointLocalCoordinates);
1438 
1439  // Calculate the projection point local coordinates
1440  return this->ProjectionPointGlobalToLocalSpace(pt_gl_coords, rProjectionPointLocalCoordinates, Tolerance);
1441  }
1442 
1444  const CoordinatesArrayType& rPointGlobalCoordinates,
1445  CoordinatesArrayType& rProjectionPointLocalCoordinates,
1446  const double Tolerance = std::numeric_limits<double>::epsilon()
1447  ) const override
1448  {
1449  // Max number of iterations
1450  const std::size_t max_number_of_iterations = 10;
1451 
1452  // We do a first guess in the center of the geometry
1453  CoordinatesArrayType proj_pt_gl_coords = this->Center();
1454  array_1d<double, 3> normal = this->UnitNormal(proj_pt_gl_coords);
1455 
1456  // Some auxiliar variables
1457  double distance;
1458  std::size_t iter;
1459 
1460  // We iterate until we find the properly projected point
1461  for (iter = 0; iter < max_number_of_iterations; ++iter) {
1462  // We compute the distance, if it is not in the plane we project
1463  proj_pt_gl_coords = GeometricalProjectionUtilities::FastProject<CoordinatesArrayType>(
1464  proj_pt_gl_coords,
1465  rPointGlobalCoordinates,
1466  normal,
1467  distance);
1468 
1469  // If the normal corresponds means that we have converged
1470  if (norm_2(this->UnitNormal(proj_pt_gl_coords) - normal) < Tolerance) {
1471  break;
1472  }
1473 
1474  // Compute normal
1475  noalias(normal) = this->UnitNormal(proj_pt_gl_coords);
1476  }
1477 
1478  PointLocalCoordinates(rProjectionPointLocalCoordinates, proj_pt_gl_coords);
1479 
1480  // We do check to print warning
1481  if (iter >= max_number_of_iterations - 1) {
1482  return 0;
1483  } else {
1484  return 1;
1485  }
1486  }
1487 
1491 
1493 
1494 protected:
1499 private:
1502 
1503  static const GeometryData msGeometryData;
1504 
1505  static const GeometryDimension msGeometryDimension;
1506 
1510 
1511  friend class Serializer;
1512 
1513  void save( Serializer& rSerializer ) const override
1514  {
1516  }
1517 
1518  void load( Serializer& rSerializer ) override
1519  {
1521  }
1522 
1523  Quadrilateral3D4(): BaseType( PointsArrayType(), &msGeometryData ) {}
1524 
1528 
1529 
1533 
1534 
1538 
1546  CoordinatesArrayType& PointLocalCoordinatesImplementation(
1547  CoordinatesArrayType& rResult,
1548  const CoordinatesArrayType& rPoint,
1549  const bool IsInside = false
1550  ) const
1551  {
1552  BoundedMatrix<double,3,4> X;
1553  BoundedMatrix<double,3,2> DN;
1554  for(IndexType i=0; i<this->size();i++) {
1555  X(0, i) = this->GetPoint( i ).X();
1556  X(1, i) = this->GetPoint( i ).Y();
1557  X(2, i) = this->GetPoint( i ).Z();
1558  }
1559 
1560  static constexpr double MaxNormPointLocalCoordinates = 300.0;
1561  static constexpr std::size_t MaxIteratioNumberPointLocalCoordinates = 500;
1562  static constexpr double MaxTolerancePointLocalCoordinates = 1.0e-8;
1563 
1564  Matrix J = ZeroMatrix( 2, 2 );
1565  Matrix invJ = ZeroMatrix( 2, 2 );
1566 
1567  // Starting with xi = 0
1568  rResult = ZeroVector( 3 );
1569  array_1d<double, 2> DeltaXi = ZeroVector( 2 );
1570  const array_1d<double, 3> zero_array = ZeroVector(3);
1571  array_1d<double, 3> CurrentGlobalCoords;
1572 
1573  //Newton iteration:
1574  for ( IndexType k = 0; k < MaxIteratioNumberPointLocalCoordinates; k++ ) {
1575  noalias(CurrentGlobalCoords) = zero_array;
1576  this->GlobalCoordinates( CurrentGlobalCoords, rResult );
1577 
1578  noalias( CurrentGlobalCoords ) = rPoint - CurrentGlobalCoords;
1579 
1580  // Derivatives of shape functions
1581  Matrix shape_functions_gradients;
1582  shape_functions_gradients = ShapeFunctionsLocalGradients(shape_functions_gradients, rResult );
1583  noalias(DN) = prod(X,shape_functions_gradients);
1584 
1585  noalias(J) = prod(trans(DN),DN);
1586  const array_1d<double, 2> res = prod(trans(DN), CurrentGlobalCoords);
1587 
1588  // Deteminant of Jacobian
1589  const double det_j = J( 0, 0 ) * J( 1, 1 ) - J( 0, 1 ) * J( 1, 0 );
1590 
1591  // Filling matrix
1592  invJ( 0, 0 ) = ( J( 1, 1 ) ) / ( det_j );
1593  invJ( 1, 0 ) = -( J( 1, 0 ) ) / ( det_j );
1594  invJ( 0, 1 ) = -( J( 0, 1 ) ) / ( det_j );
1595  invJ( 1, 1 ) = ( J( 0, 0 ) ) / ( det_j );
1596 
1597  DeltaXi( 0 ) = invJ( 0, 0 ) * res[0] + invJ( 0, 1 ) * res[1];
1598  DeltaXi( 1 ) = invJ( 1, 0 ) * res[0] + invJ( 1, 1 ) * res[1];
1599 
1600  rResult[0] += DeltaXi[0];
1601  rResult[1] += DeltaXi[1];
1602 
1603  if ( norm_2( DeltaXi ) > MaxNormPointLocalCoordinates ) {
1604  KRATOS_WARNING_IF("Quadrilateral3D4", IsInside == false && k > 0) << "detJ =\t" << det_j << " DeltaX =\t" << DeltaXi << " stopping calculation. Iteration:\t" << k << std::endl;
1605  break;
1606  }
1607 
1608  if ( norm_2( DeltaXi ) < MaxTolerancePointLocalCoordinates )
1609  break;
1610  }
1611 
1612  return rResult;
1613  }
1614 
1622  static Matrix CalculateShapeFunctionsIntegrationPointsValues(
1623  typename BaseType::IntegrationMethod ThisMethod )
1624  {
1625  IntegrationPointsContainerType all_integration_points =
1626  AllIntegrationPoints();
1627  IntegrationPointsArrayType integration_points = all_integration_points[static_cast<int>(ThisMethod)];
1628  //number of integration points
1629  const int integration_points_number = integration_points.size();
1630  //number of nodes in current geometry
1631  const int points_number = 4;
1632  //setting up return matrix
1633  Matrix shape_function_values( integration_points_number, points_number );
1634  //loop over all integration points
1635 
1636  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
1637  {
1638  shape_function_values( pnt, 0 ) =
1639  0.25 * ( 1.0 - integration_points[pnt].X() )
1640  * ( 1.0 - integration_points[pnt].Y() );
1641  shape_function_values( pnt, 1 ) =
1642  0.25 * ( 1.0 + integration_points[pnt].X() )
1643  * ( 1.0 - integration_points[pnt].Y() );
1644  shape_function_values( pnt, 2 ) =
1645  0.25 * ( 1.0 + integration_points[pnt].X() )
1646  * ( 1.0 + integration_points[pnt].Y() );
1647  shape_function_values( pnt, 3 ) =
1648  0.25 * ( 1.0 - integration_points[pnt].X() )
1649  * ( 1.0 + integration_points[pnt].Y() );
1650  }
1651 
1652  return shape_function_values;
1653  }
1654 
1664  static ShapeFunctionsGradientsType CalculateShapeFunctionsIntegrationPointsLocalGradients( typename BaseType::IntegrationMethod ThisMethod )
1665  {
1666  IntegrationPointsContainerType all_integration_points = AllIntegrationPoints();
1667  IntegrationPointsArrayType integration_points = all_integration_points[static_cast<int>(ThisMethod)];
1668  //number of integration points
1669  const int integration_points_number = integration_points.size();
1670  ShapeFunctionsGradientsType d_shape_f_values( integration_points_number );
1671  //initialising container
1672  //std::fill(d_shape_f_values.begin(), d_shape_f_values.end(), Matrix(4,2));
1673  //loop over all integration points
1674 
1675  for ( int pnt = 0; pnt < integration_points_number; pnt++ )
1676  {
1677  Matrix result( 4, 2 );
1678  result( 0, 0 ) = -0.25 * ( 1.0 - integration_points[pnt].Y() );
1679  result( 0, 1 ) = -0.25 * ( 1.0 - integration_points[pnt].X() );
1680  result( 1, 0 ) = 0.25 * ( 1.0 - integration_points[pnt].Y() );
1681  result( 1, 1 ) = -0.25 * ( 1.0 + integration_points[pnt].X() );
1682  result( 2, 0 ) = 0.25 * ( 1.0 + integration_points[pnt].Y() );
1683  result( 2, 1 ) = 0.25 * ( 1.0 + integration_points[pnt].X() );
1684  result( 3, 0 ) = -0.25 * ( 1.0 + integration_points[pnt].Y() );
1685  result( 3, 1 ) = 0.25 * ( 1.0 - integration_points[pnt].X() );
1686  d_shape_f_values[pnt] = result;
1687  }
1688 
1689  return d_shape_f_values;
1690  }
1691 
1695  static const IntegrationPointsContainerType AllIntegrationPoints()
1696  {
1697  IntegrationPointsContainerType integration_points =
1698  {
1699  {
1700  Quadrature < QuadrilateralGaussLegendreIntegrationPoints1,
1701  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1702  Quadrature < QuadrilateralGaussLegendreIntegrationPoints2,
1703  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1704  Quadrature < QuadrilateralGaussLegendreIntegrationPoints3,
1705  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1706  Quadrature < QuadrilateralGaussLegendreIntegrationPoints4,
1707  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1708  Quadrature < QuadrilateralGaussLegendreIntegrationPoints5,
1709  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1710  Quadrature < QuadrilateralCollocationIntegrationPoints1,
1711  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1712  Quadrature < QuadrilateralCollocationIntegrationPoints2,
1713  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1714  Quadrature < QuadrilateralCollocationIntegrationPoints3,
1715  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1716  Quadrature < QuadrilateralCollocationIntegrationPoints4,
1717  2, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1718  Quadrature < QuadrilateralCollocationIntegrationPoints5,
1719  2, IntegrationPoint<3> >::GenerateIntegrationPoints()
1720  }
1721  };
1722  return integration_points;
1723  }
1724 
1728  static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
1729  {
1730  ShapeFunctionsValuesContainerType shape_functions_values =
1731  {
1732  {
1733  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1735  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1737  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1739  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1741  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1743  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1745  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1747  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1749  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1751  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(
1753  }
1754  };
1755  return shape_functions_values;
1756  }
1757 
1762  AllShapeFunctionsLocalGradients()
1763  {
1764  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients =
1765  {
1766  {
1767  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_1 ),
1768  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_2 ),
1769  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_3 ),
1770  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 ),
1771  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_5 ),
1772  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ),
1773  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ),
1774  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ),
1775  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ),
1776  Quadrilateral3D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 )
1777  }
1778  };
1779  return shape_functions_local_gradients;
1780  }
1781 
1785 
1786 
1790 
1791 
1795 
1796  template<class TOtherPointType> friend class Quadrilateral3D4;
1797 
1801 
1802 
1804 }; // Class Geometry
1805 
1809 
1810 
1814 
1817 template<class TPointType> inline std::istream& operator >> (
1818  std::istream& rIStream,
1823 template<class TPointType> inline std::ostream& operator << (
1824  std::ostream& rOStream,
1825  const Quadrilateral3D4<TPointType>& rThis )
1826 {
1827  rThis.PrintInfo( rOStream );
1828  rOStream << std::endl;
1829  rThis.PrintData( rOStream );
1830  return rOStream;
1831 }
1832 
1834 
1835 template<class TPointType>
1836 const GeometryData Quadrilateral3D4<TPointType>::msGeometryData(
1839  Quadrilateral3D4<TPointType>::AllIntegrationPoints(),
1840  Quadrilateral3D4<TPointType>::AllShapeFunctionsValues(),
1841  AllShapeFunctionsLocalGradients()
1842 );
1843 
1844 template<class TPointType>
1845 const GeometryDimension Quadrilateral3D4<TPointType>::msGeometryDimension(3, 2);
1846 
1847 }// namespace Kratos.
Definition: geometry_data.h:60
const ShapeFunctionsGradientsType & ShapeFunctionsLocalGradients() const
Definition: geometry_data.h:607
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex) const
Definition: geometry_data.h:660
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
KRATOS_DEPRECATED_MESSAGE("This is legacy version (use GenerateEdges instead)") virtual GeometriesArrayType Edges(void)
This method gives you all edges of this geometry.
Definition: geometry.h:2106
std::size_t SizeType
Definition: geometry.h:144
virtual array_1d< double, 3 > UnitNormal(const CoordinatesArrayType &rPointLocalCoordinates) const
It computes the unit normal of the geometry in the given local point.
Definition: geometry.h:1639
const TPointType::Pointer pGetPoint(const int Index) const
Definition: geometry.h:1790
std::size_t IndexType
Definition: geometry.h:137
std::array< Matrix, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Definition: geometry.h:172
const PointsArrayType & Points() const
Definition: geometry.h:1768
bool AllPointsAreValid() const
Checks if the geometry points are valid Checks if the geometry points are valid from the pointer valu...
Definition: geometry.h:4093
std::array< IntegrationPointsArrayType, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry.h:167
virtual Point Center() const
Definition: geometry.h:1514
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
SizeType IntegrationPointsNumber() const
Definition: geometry.h:2257
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
static double PointDistanceToQuadrilateral3D(const Point &rQuadrilateralPoint1, const Point &rQuadrilateralPoint2, const Point &rQuadrilateralPoint3, const Point &rQuadrilateralPoint4, const Point &rPoint)
This function calculates the distance of a 3D point to a 3D quadrilateral.
Definition: geometry_utilities.cpp:376
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
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 two node 3D line geometry with linear shape functions.
Definition: line_3d_2.h:64
This class defines the node.
Definition: node.h:65
Point class.
Definition: point.h:59
double Y() const
Definition: point.h:187
double X() const
Definition: point.h:181
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
A four node 3D quadrilateral geometry with bi-linear shape functions.
Definition: quadrilateral_3d_4.h:76
bool HasIntersection(const Point &rLowPoint, const Point &rHighPoint) const override
Definition: quadrilateral_3d_4.h:1025
TPointType PointType
Definition: quadrilateral_3d_4.h:118
Line3D2< TPointType > EdgeType
Definition: quadrilateral_3d_4.h:92
GeometriesArrayType GenerateFaces() const override
Returns all faces of the current geometry.
Definition: quadrilateral_3d_4.h:942
double DeterminantOfJacobian(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: quadrilateral_3d_4.h:825
SizeType FacesNumber() const override
Returns the number of faces of the current geometry.
Definition: quadrilateral_3d_4.h:929
Quadrilateral3D4(typename PointType::Pointer pFirstPoint, typename PointType::Pointer pSecondPoint, typename PointType::Pointer pThirdPoint, typename PointType::Pointer pFourthPoint)
Definition: quadrilateral_3d_4.h:232
BaseType::PointsArrayType PointsArrayType
Definition: quadrilateral_3d_4.h:139
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: quadrilateral_3d_4.h:1242
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: quadrilateral_3d_4.h:192
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: quadrilateral_3d_4.h:551
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: quadrilateral_3d_4.h:166
~Quadrilateral3D4() override
Definition: quadrilateral_3d_4.h:303
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
Definition: quadrilateral_3d_4.h:1068
Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: quadrilateral_3d_4.h:687
KRATOS_CLASS_POINTER_DEFINITION(Quadrilateral3D4)
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: quadrilateral_3d_4.h:364
std::string Info() const override
Definition: quadrilateral_3d_4.h:1147
BaseType::JacobiansType JacobiansType
Definition: quadrilateral_3d_4.h:185
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: quadrilateral_3d_4.h:178
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: quadrilateral_3d_4.h:172
Quadrilateral3D4(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: quadrilateral_3d_4.h:252
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: quadrilateral_3d_4.h:403
Quadrilateral3D4(Quadrilateral3D4 const &rOther)
Definition: quadrilateral_3d_4.h:278
bool HasIntersection(const GeometryType &ThisGeometry) const override
Test the intersection with another geometry.
Definition: quadrilateral_3d_4.h:991
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients(IntegrationMethod ThisMethod)
Definition: quadrilateral_3d_4.h:1195
void NumberNodesInFaces(DenseVector< unsigned int > &NumberNodesInFaces) const override
Definition: quadrilateral_3d_4.h:951
int ProjectionPointGlobalToLocalSpace(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rProjectionPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Projects a point onto the geometry Projects a certain point on the geometry, or finds the closest poi...
Definition: quadrilateral_3d_4.h:1443
BaseType::IndexType IndexType
Definition: quadrilateral_3d_4.h:126
double DeterminantOfJacobian(const CoordinatesArrayType &rPoint) const override
Definition: quadrilateral_3d_4.h:866
Quadrilateral3D4(Quadrilateral3D4< TOtherPointType > const &rOther)
Definition: quadrilateral_3d_4.h:295
Quadrilateral3D4(const PointsArrayType &ThisPoints)
Definition: quadrilateral_3d_4.h:244
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: quadrilateral_3d_4.h:1099
BaseType::NormalType NormalType
Definition: quadrilateral_3d_4.h:213
GeometriesArrayType Faces(void) override
Definition: quadrilateral_3d_4.h:1050
Quadrilateral3D4< TPointType > FaceType
Definition: quadrilateral_3d_4.h:97
void PrintInfo(std::ostream &rOStream) const override
Definition: quadrilateral_3d_4.h:1158
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: quadrilateral_3d_4.h:1126
BaseType::SizeType SizeType
Definition: quadrilateral_3d_4.h:133
Quadrilateral3D4(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: quadrilateral_3d_4.h:261
SizeType PointsNumberInDirection(IndexType LocalDirectionIndex) const override
Returns number of points per direction.
Definition: quadrilateral_3d_4.h:389
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod, Matrix &DeltaPosition) const override
Definition: quadrilateral_3d_4.h:618
Geometry< TPointType > GeometryType
Definition: quadrilateral_3d_4.h:87
Quadrilateral3D4 & operator=(const Quadrilateral3D4 &rOther)
Definition: quadrilateral_3d_4.h:330
BaseType::ShapeFunctionsSecondDerivativesType ShapeFunctionsSecondDerivativesType
Definition: quadrilateral_3d_4.h:200
bool IsInside(const CoordinatesArrayType &rPoint, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Definition: quadrilateral_3d_4.h:499
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: quadrilateral_3d_4.h:305
Geometry< TPointType > BaseType
Definition: quadrilateral_3d_4.h:85
friend class Quadrilateral3D4
Definition: quadrilateral_3d_4.h:1796
double Area() const override
This method calculates and returns area or surface area of this geometry depending to it's dimension.
Definition: quadrilateral_3d_4.h:455
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: quadrilateral_3d_4.h:144
ShapeFunctionsThirdDerivativesType & ShapeFunctionsThirdDerivatives(ShapeFunctionsThirdDerivativesType &rResult, const CoordinatesArrayType &rPoint) const override
Definition: quadrilateral_3d_4.h:1335
BaseType::IntegrationPointType IntegrationPointType
Definition: quadrilateral_3d_4.h:150
double DomainSize() const override
This method calculates and returns length, area or volume of this geometry depending to it's dimensio...
Definition: quadrilateral_3d_4.h:485
Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: quadrilateral_3d_4.h:736
BaseType::ShapeFunctionsThirdDerivativesType ShapeFunctionsThirdDerivativesType
Definition: quadrilateral_3d_4.h:208
void PrintData(std::ostream &rOStream) const override
Definition: quadrilateral_3d_4.h:1177
SizeType EdgesNumber() const override
This method gives you number of all edges of this geometry.
Definition: quadrilateral_3d_4.h:894
CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const override
Returns the local coordinates of a given arbitrary point.
Definition: quadrilateral_3d_4.h:522
BaseType::GeometriesArrayType GeometriesArrayType
Definition: quadrilateral_3d_4.h:113
Vector & DeterminantOfJacobian(Vector &rResult, IntegrationMethod ThisMethod) const override
Definition: quadrilateral_3d_4.h:777
double Volume() const override
This method calculates and returns the volume of this geometry.
Definition: quadrilateral_3d_4.h:468
void NodesInFaces(DenseMatrix< unsigned int > &NodesInFaces) const override
Definition: quadrilateral_3d_4.h:963
int ProjectionPointLocalToLocalSpace(const CoordinatesArrayType &rPointLocalCoordinates, CoordinatesArrayType &rProjectionPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Projects a point onto the geometry Projects a certain point on the geometry, or finds the closest poi...
Definition: quadrilateral_3d_4.h:1429
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: quadrilateral_3d_4.h:159
Quadrilateral3D4 & operator=(Quadrilateral3D4< TOtherPointType > const &rOther)
Definition: quadrilateral_3d_4.h:348
ShapeFunctionsSecondDerivativesType & ShapeFunctionsSecondDerivatives(ShapeFunctionsSecondDerivativesType &rResult, const CoordinatesArrayType &rPoint) const override
Definition: quadrilateral_3d_4.h:1292
GeometryData::IntegrationMethod IntegrationMethod
Definition: quadrilateral_3d_4.h:107
virtual Matrix & ShapeFunctionsGradients(Matrix &rResult, PointType &rPoint)
Definition: quadrilateral_3d_4.h:1269
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: quadrilateral_3d_4.h:378
double Length() const override
Definition: quadrilateral_3d_4.h:441
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: quadrilateral_3d_4.h:310
GeometriesArrayType GenerateEdges() const override
This method gives you all edges of this geometry.
Definition: quadrilateral_3d_4.h:907
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients()
Definition: quadrilateral_3d_4.h:1216
int ProjectionPoint(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rProjectedPointGlobalCoordinates, CoordinatesArrayType &rProjectedPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Projects a certain point on the geometry, or finds the closest point, depending on the provided initi...
Definition: quadrilateral_3d_4.h:1413
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
A three node 3D triangle geometry with linear shape functions.
Definition: triangle_3d_3.h:77
bool HasIntersection(const GeometryType &rThisGeometry) const override
Test the intersection with another geometry.
Definition: triangle_3d_3.h:649
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
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
#define KRATOS_WARNING(label)
Definition: logger.h:265
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
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::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
const GeometryData Quadrilateral3D4< TPointType >::msGeometryData & msGeometryDimension(), Quadrilateral3D4< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
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
tuple const
Definition: ode_solve.py:403
int k
Definition: quadrature.py:595
float temp
Definition: rotating_cone.py:85
J
Definition: sensitivityMatrix.py:58
namespace
Definition: array_1d.h:793
integer i
Definition: TensorModule.f:17