KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
line_2d_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: Mohamed Nabi
11 //
12 //
13 // Contributors:
14 //
15 //
16 
17 #pragma once
18 
19 // System includes
20 
21 // External includes
22 
23 // Project includes
24 #include "geometries/geometry.h"
27 
28 namespace Kratos
29 {
30 
33 
37 
41 
45 
49 
60 template<class TPointType>
61 class Line2D4 : public Geometry<TPointType>
62 {
63 public:
67 
70 
73 
77 
82 
85  typedef TPointType PointType;
86 
91  typedef typename BaseType::IndexType IndexType;
92 
97  typedef typename BaseType::SizeType SizeType;
98 
103 
109 
116 
122 
127 
132 
138 
144 
148 
153 
157 
158  Line2D4(const PointType& Point01, const PointType& Point02, const PointType& Point03,
159  const PointType& Point04) : BaseType(PointsArrayType(), &msGeometryData)
160  {
161  BaseType::Points().push_back(typename PointType::Pointer(new PointType(Point01)));
162  BaseType::Points().push_back(typename PointType::Pointer(new PointType(Point02)));
163  BaseType::Points().push_back(typename PointType::Pointer(new PointType(Point03)));
164  BaseType::Points().push_back(typename PointType::Pointer(new PointType(Point04)));
165  }
166 
167  Line2D4(typename PointType::Pointer pPoint01, typename PointType::Pointer pPoint02,
168  typename PointType::Pointer pPoint03, typename PointType::Pointer pPoint04)
169  : BaseType(PointsArrayType(), &msGeometryData)
170  {
171  BaseType::Points().push_back(pPoint01);
172  BaseType::Points().push_back(pPoint02);
173  BaseType::Points().push_back(pPoint03);
174  BaseType::Points().push_back(pPoint04);
175  }
176 
177  explicit Line2D4(const PointsArrayType& rThisPoints) : BaseType(rThisPoints, &msGeometryData)
178  {
179  KRATOS_ERROR_IF(BaseType::PointsNumber() != 4) << "Invalid points number. Expected 4, given "
180  << BaseType::PointsNumber() << std::endl;
181  }
182 
184  explicit Line2D4(const IndexType GeometryId, const PointsArrayType& rThisPoints)
185  : BaseType(GeometryId, rThisPoints, &msGeometryData)
186  {
187  KRATOS_ERROR_IF(this->PointsNumber() != 4) << "Invalid points number. Expected 4, given "
188  << this->PointsNumber() << std::endl;
189  }
190 
192  explicit Line2D4(const std::string& rGeometryName, const PointsArrayType& rThisPoints)
193  : BaseType(rGeometryName, rThisPoints, &msGeometryData)
194  {
195  KRATOS_ERROR_IF(this->PointsNumber() != 4) << "Invalid points number. Expected 4, given "
196  << this->PointsNumber() << std::endl;
197  }
198 
206  Line2D4(Line2D4 const& rOther) : BaseType(rOther)
207  {
208  }
209 
220  template<class TOtherPointType> explicit Line2D4(Line2D4<TOtherPointType> const& rOther)
221  : BaseType(rOther)
222  {
223  }
224 
226  ~Line2D4() override {}
227 
229  {
231  }
232 
234  {
236  }
237 
241 
250  Line2D4& operator=(const Line2D4& rOther)
251  {
252  BaseType::operator=(rOther);
253  return *this;
254  }
255 
264  template<class TOtherPointType>
266  {
267  BaseType::operator=(rOther);
268  return *this;
269  }
270 
274 
281  typename BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const& rThisPoints)
282  const override
283  {
284  return typename BaseType::Pointer(new Line2D4(NewGeometryId, rThisPoints));
285  }
286 
293  typename BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType& rGeometry) const override
294  {
295  auto p_geometry = typename BaseType::Pointer(new Line2D4(NewGeometryId, rGeometry.Points()));
296  p_geometry->SetData(rGeometry.GetData());
297  return p_geometry;
298  }
299 
309  Vector& LumpingFactors(Vector& rResult, const typename BaseType::LumpingMethods LumpingMethod
310  = BaseType::LumpingMethods::ROW_SUM) const override
311  {
312  if (rResult.size() != 4) rResult.resize(4, false);
313  rResult[0] = 0.125;
314  rResult[1] = 0.125;
315  rResult[2] = 0.375;
316  rResult[3] = 0.375;
317  return rResult;
318  }
319 
323 
334  double Length() const override
335  {
336  Vector temp;
338  this->DeterminantOfJacobian(temp, integration_method);
339  const IntegrationPointsArrayType& r_integration_points = this->IntegrationPoints(integration_method);
340  double length = 0.0;
341 
342  for (std::size_t i = 0; i < r_integration_points.size(); ++i) {
343  length += temp[i] * r_integration_points[i].Weight();
344  }
345  return length;
346  }
347 
358  double Area() const override
359  {
360  return Length();
361  }
362 
373  double DomainSize() const override
374  {
375  return Length();
376  }
377 
386  bool IsInside(const CoordinatesArrayType& rPoint, CoordinatesArrayType& rResult,
387  const double Tolerance = std::numeric_limits<double>::epsilon()) const override
388  {
389  PointLocalCoordinates(rResult, rPoint);
390  if (std::abs(rResult[0]) <= (1.0 + Tolerance)) {
391  return true;
392  }
393  return false;
394  }
395 
403  const CoordinatesArrayType& rPoint) const override
404  {
407  for (IndexType i = 0; i < this->size(); ++i)
408  {
409  const auto& r_node = this->GetPoint(i);
410  X(0, i) = r_node.X();
411  X(1, i) = r_node.Y();
412  X(2, i) = r_node.Z();
413  }
414 
415  static constexpr double MaxNormPointLocalCoordinates = 300.0;
416  static constexpr std::size_t MaxIteratioNumberPointLocalCoordinates = 500;
417  static constexpr double MaxTolerancePointLocalCoordinates = 1.0e-8;
418 
419  Matrix J = ZeroMatrix(1, 1);
420  Matrix invJ = ZeroMatrix(1, 1);
421 
422  // Starting with xi = 0
423  if (rResult.size() != 3) rResult.resize(3, false);
424  noalias(rResult) = ZeroVector(3);
425  double delta_xi = 0.0;
426  const array_1d<double, 3> zero_array = ZeroVector(3);
427  array_1d<double, 3> current_global_coords;
429 
430  //Newton iteration:
431  for (IndexType k = 0; k < MaxIteratioNumberPointLocalCoordinates; ++k) {
432  noalias(current_global_coords) = zero_array;
433  this->GlobalCoordinates(current_global_coords, rResult);
434 
435  noalias(current_global_coords) = rPoint - current_global_coords;
436 
437  // Derivatives of shape functions
438  Matrix shape_functions_gradients;
439  shape_functions_gradients = ShapeFunctionsLocalGradients(shape_functions_gradients, rResult);
440  noalias(DN) = prod(X, shape_functions_gradients);
441  noalias(J) = prod(trans(DN), DN);
442  noalias(res) = prod(trans(DN), current_global_coords);
443 
444  // The inverted jacobian matrix
445  invJ(0, 0) = 1.0 / J(0, 0);
446 
447  delta_xi = invJ(0, 0) * res[0];
448 
449  rResult[0] += delta_xi;
450 
451  if (delta_xi > MaxNormPointLocalCoordinates) {
452  KRATOS_WARNING_IF("Line2D4", k > 0) << "detJ =\t" << J(0, 0) << " DeltaX =\t" << delta_xi << " stopping calculation. Iteration:\t" << k << std::endl;
453  break;
454  }
455 
456  if (delta_xi < MaxTolerancePointLocalCoordinates)
457  break;
458  }
459 
460  return rResult;
461  }
462 
466 
481  JacobiansType& Jacobian(JacobiansType& rResult, IntegrationMethod ThisMethod) const override
482  {
483  // Getting derivatives of shape functions
484  const ShapeFunctionsGradientsType shape_functions_gradients
485  = CalculateShapeFunctionsIntegrationPointsLocalGradients(ThisMethod);
486  const std::size_t number_of_integration_points = this->IntegrationPointsNumber(ThisMethod);
487  if (rResult.size() != number_of_integration_points) {
488  JacobiansType temp(number_of_integration_points);
489  rResult.swap(temp);
490  }
491  // Loop over all integration points
492  for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt) {
493  // Initializing jacobian matrix
494  noalias(rResult[pnt]) = ZeroMatrix(2, 1);
495  // Loop over all nodes
496  for (std::size_t i = 0; i < this->PointsNumber(); ++i) {
497  const auto& r_node = this->GetPoint(i);
498  rResult[pnt](0, 0) += r_node.X() * shape_functions_gradients[pnt](i, 0);
499  rResult[pnt](1, 0) += r_node.Y() * shape_functions_gradients[pnt](i, 0);
500  }
501  } // End of loop over all integration points
502  return rResult;
503  }
504 
523  Matrix& rDeltaPosition) const override
524  {
525  // Getting derivatives of shape functions
526  ShapeFunctionsGradientsType shape_functions_gradients
527  = CalculateShapeFunctionsIntegrationPointsLocalGradients(ThisMethod);
528  const std::size_t number_of_integration_points = this->IntegrationPointsNumber(ThisMethod);
529  // Getting values of shape functions
530  Matrix shape_functions_values = CalculateShapeFunctionsIntegrationPointsValues(ThisMethod);
531  if (rResult.size() != number_of_integration_points) {
532  JacobiansType temp(number_of_integration_points);
533  rResult.swap(temp);
534  }
535  // Loop over all integration points
536  for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt) {
537  // Initializing jacobian matrix
538  noalias(rResult[pnt]) = ZeroMatrix(2, 1);
539  // Loop over all nodes
540  for (std::size_t i = 0; i < this->PointsNumber(); ++i) {
541  const auto& r_node = this->GetPoint(i);
542  rResult[pnt](0, 0) += (r_node.X() - rDeltaPosition(i, 0)) * shape_functions_gradients[pnt](i, 0);
543  rResult[pnt](1, 0) += (r_node.Y() - rDeltaPosition(i, 1)) * shape_functions_gradients[pnt](i, 0);
544  }
545  }// End of loop over all integration points
546  return rResult;
547  }
548 
565  Matrix& Jacobian(Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod)
566  const override
567  {
568  // Setting up size of jacobian matrix
569  rResult.resize(2, 1, false);
570  noalias(rResult) = ZeroMatrix(2, 1);
571  // Derivatives of shape functions
572  ShapeFunctionsGradientsType shape_functions_gradients
573  = CalculateShapeFunctionsIntegrationPointsLocalGradients(ThisMethod);
574  Matrix shape_function_gradient_in_integration_point = shape_functions_gradients(IntegrationPointIndex);
575  // Values of shape functions in integration points
576  DenseVector<double> ShapeFunctionsValuesInIntegrationPoint = ZeroVector(3);
577  ShapeFunctionsValuesInIntegrationPoint = row(CalculateShapeFunctionsIntegrationPointsValues(ThisMethod), IntegrationPointIndex);
578  // Elements of jacobian matrix (e.g. J(1,1) = dX1/dXi1)
579  // Loop over all nodes
580  for (std::size_t i = 0; i < this->PointsNumber(); ++i) {
581  const auto& r_node = this->GetPoint(i);
582  rResult(0, 0) += r_node.X() * shape_function_gradient_in_integration_point(i, 0);
583  rResult(1, 0) += r_node.Y() * shape_function_gradient_in_integration_point(i, 0);
584  }
585  return rResult;
586  }
587 
595  Matrix& Jacobian(Matrix& rResult, const CoordinatesArrayType& rPoint) const override
596  {
597  // Setting up size of jacobian matrix
598  rResult.resize(2, 1, false);
599  noalias(rResult) = ZeroMatrix(2, 1);
600  // Derivatives of shape functions
601  Matrix shape_functions_gradients;
602  shape_functions_gradients = ShapeFunctionsLocalGradients(shape_functions_gradients, rPoint);
603  // Elements of jacobian matrix (e.g. J(1,1) = dX1/dXi1)
604  // Loop over all nodes
605  for (std::size_t i = 0; i < this->PointsNumber(); ++i) {
606  const auto& r_node = this->GetPoint(i);
607  rResult(0, 0) += r_node.X() * shape_functions_gradients(i, 0);
608  rResult(1, 0) += r_node.Y() * shape_functions_gradients(i, 0);
609  }
610  return rResult;
611  }
612 
620  Vector& DeterminantOfJacobian(Vector& rResult, IntegrationMethod ThisMethod) const override
621  {
622  const std::size_t number_of_integration_points = this->IntegrationPointsNumber(ThisMethod);
623  if (rResult.size() != number_of_integration_points)
624  rResult.resize(number_of_integration_points, false);
625  Matrix J(2, 1);
626  for (std::size_t pnt = 0; pnt < number_of_integration_points; ++pnt) {
627  this->Jacobian(J, pnt, ThisMethod);
628  rResult[pnt] = std::sqrt(std::pow(J(0, 0), 2) + std::pow(J(1, 0), 2));
629  }
630  return rResult;
631  }
632 
641  double DeterminantOfJacobian(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod)
642  const override
643  {
644  Matrix J(2, 1);
645  this->Jacobian(J, IntegrationPointIndex, ThisMethod);
646  return std::sqrt(std::pow(J(0, 0), 2) + std::pow(J(1, 0), 2));
647  }
648 
656  double DeterminantOfJacobian(const CoordinatesArrayType& rPoint) const override
657  {
658  Matrix J(2, 1);
659  this->Jacobian(J, rPoint);
660  return std::sqrt(std::pow(J(0, 0), 2) + std::pow(J(1, 0), 2));
661  }
662 
666  SizeType EdgesNumber() const override
667  {
668  return 2;
669  }
670 
674  SizeType FacesNumber() const override
675  {
676  return EdgesNumber();
677  }
678 
682 
691  Vector& ShapeFunctionsValues(Vector& rResult, const CoordinatesArrayType& rCoordinates) const override
692  {
693  if (rResult.size() != 4) rResult.resize(4, false);
694  //
695  const double xi = rCoordinates[0];
696  const double fx1 = 1.0 - xi;
697  const double fx2 = 1.0 + xi;
698  const double fx3 = fx1 * fx2;
699  const double gx1 = 1.0 - 3.0 * xi;
700  const double gx2 = 1.0 + 3.0 * xi;
701  const double gx3 = gx1 * gx2;
702  //
703  rResult[0] = -0.0625 * fx1 * gx3;
704  rResult[1] = -0.0625 * fx2 * gx3;
705  rResult[2] = 0.5625 * fx3 * gx1;
706  rResult[3] = 0.5625 * fx3 * gx2;
707  //
708  return rResult;
709  }
710 
720  double ShapeFunctionValue(const IndexType ShapeFunctionIndex, const CoordinatesArrayType& rPoint) const override
721  {
722  const double xi = rPoint[0];
723  const double fx1 = 1.0 - xi;
724  const double fx2 = 1.0 + xi;
725  const double fx3 = fx1 * fx2;
726  const double gx1 = 1.0 - 3.0 * xi;
727  const double gx2 = 1.0 + 3.0 * xi;
728  const double gx3 = gx1 * gx2;
729  double shape = 0.0;
730  //
731  switch (ShapeFunctionIndex)
732  {
733  case 0:
734  shape = -0.0625 * fx1 * gx3;
735  break;
736  case 1:
737  shape = -0.0625 * fx2 * gx3;
738  break;
739  case 2:
740  shape = 0.5625 * fx3 * gx1;
741  break;
742  case 3:
743  shape = 0.5625 * fx3 * gx2;
744  break;
745  default:
746  KRATOS_ERROR << "Wrong index of shape function!" << *this << std::endl;
747  break;
748  }
749  return shape;
750  }
751 
755 
757  IntegrationMethod ThisMethod) const override
758  {
759  KRATOS_ERROR << "Jacobian is not square" << std::endl;
760  }
761 
763  Vector& rDeterminantsOfJacobian, IntegrationMethod ThisMethod) const override
764  {
765  KRATOS_ERROR << "Jacobian is not square" << std::endl;
766  }
767 
771 
777  std::string Info() const override
778  {
779  return "1 dimensional line with 4 nodes in 2D space";
780  }
781 
787  void PrintInfo(std::ostream& rOStream) const override
788  {
789  rOStream << "1 dimensional line with 4 nodes in 2D space";
790  }
791 
798  void PrintData( std::ostream& rOStream ) const override
799  {
800  // Base Geometry class PrintData call
801  BaseType::PrintData( rOStream );
802  std::cout << std::endl;
803 
804  // If the geometry has valid points, calculate and output its data
805  if (this->AllPointsAreValid()) {
806  Matrix jacobian;
807  this->Jacobian( jacobian, PointType() );
808  rOStream << " Jacobian\t : " << jacobian;
809  }
810  }
811 
815  {
816  ShapeFunctionsGradientsType localGradients
817  = CalculateShapeFunctionsIntegrationPointsLocalGradients(ThisMethod);
818  const int integration_points_number = msGeometryData.IntegrationPointsNumber(ThisMethod);
819  ShapeFunctionsGradientsType Result(integration_points_number);
820  //
821  for (int pnt = 0; pnt < integration_points_number; ++pnt)
822  {
823  Result[pnt] = localGradients[pnt];
824  }
825  return Result;
826  }
827 
832  {
833  IntegrationMethod ThisMethod = msGeometryData.DefaultIntegrationMethod();
834  ShapeFunctionsGradientsType localGradients
835  = CalculateShapeFunctionsIntegrationPointsLocalGradients(ThisMethod);
836  const int integration_points_number = msGeometryData.IntegrationPointsNumber(ThisMethod);
837  ShapeFunctionsGradientsType Result(integration_points_number);
838  //
839  for (int pnt = 0; pnt < integration_points_number; ++pnt)
840  {
841  Result[pnt] = localGradients[pnt];
842  }
843  return Result;
844  }
845 
854  Matrix& ShapeFunctionsLocalGradients(Matrix& rResult, const CoordinatesArrayType& rPoint) const override
855  {
856  // Setting up result matrix
857  if (rResult.size1() != 4 || rResult.size2() != 1) rResult.resize(4, 1, false);
858  noalias(rResult) = ZeroMatrix(4, 1);
859  //
860  const double xi = rPoint[0];
861  const double fx1 = 1.0 - xi;
862  const double fx2 = 1.0 + xi;
863  const double fx3 = fx1 * fx2;
864  const double gx1 = 1.0 - 3.0 * xi;
865  const double gx2 = 1.0 + 3.0 * xi;
866  const double gx3 = gx1 * gx2;
867  //
868  rResult(0, 0) = 0.0625 * (18.0 * xi * fx1 + gx3);
869  rResult(1, 0) = 0.0625 * (18.0 * xi * fx2 - gx3);
870  rResult(2, 0) = -0.5625 * (3.0 * fx3 + 2.0 * xi * gx1);
871  rResult(3, 0) = 0.5625 * (3.0 * fx3 - 2.0 * xi * gx2);
872  //
873  return rResult;
874  }
875 
881  Matrix& PointsLocalCoordinates(Matrix& rResult) const override
882  {
883  if (rResult.size1() != 4 || rResult.size2() != 1) rResult.resize(4, 1, false);
884  noalias(rResult) = ZeroMatrix(4, 1);
885  //
886  rResult(0, 0) = -1.0;
887  rResult(1, 0) = 1.0;
888  rResult(2, 0) = -1.0 / 3.0;
889  rResult(3, 0) = 1.0 / 3.0;
890  //
891  return rResult;
892  }
893 
903  {
904  if (rResult.size1() != 4 || rResult.size2() != 1) rResult.resize(4, 1, false);
905  noalias(rResult) = ZeroMatrix(4, 1);
906 
907  const double xi = rPoint[0];
908  const double fx1 = 1.0 - xi;
909  const double fx2 = 1.0 + xi;
910  const double fx3 = fx1 * fx2;
911  const double gx1 = 1.0 - 3.0 * xi;
912  const double gx2 = 1.0 + 3.0 * xi;
913  const double gx3 = gx1 * gx2;
914 
915  rResult(0, 0) = 0.0625 * (18.0 * xi * fx1 + gx3);
916  rResult(1, 0) = 0.0625 * (18.0 * xi * fx2 - gx3);
917  rResult(2, 0) = -0.5625 * (3.0 * fx3 + 2.0 * xi * gx1);
918  rResult(3, 0) = 0.5625 * (3.0 * fx3 - 2.0 * xi * gx2);
919  //
920  return rResult;
921  }
922 
926 
928 
929 protected:
932 
936 
940 
944 
948 
952 
956 
958 
959 private:
962 
963  static const GeometryData msGeometryData;
964 
965  static const GeometryDimension msGeometryDimension;
966 
970 
974 
975  friend class Serializer;
976 
977  void save(Serializer& rSerializer) const override
978  {
980  }
981 
982  void load(Serializer& rSerializer) override
983  {
985  }
986 
987  Line2D4() : BaseType(PointsArrayType(), &msGeometryData) {}
988 
992 
996 
997  static Matrix CalculateShapeFunctionsIntegrationPointsValues(typename BaseType::IntegrationMethod ThisMethod)
998  {
999  const IntegrationPointsContainerType& all_integration_points = AllIntegrationPoints();
1000  const IntegrationPointsArrayType& IntegrationPoints = all_integration_points[static_cast<int>(ThisMethod)];
1001  const int integration_points_number = IntegrationPoints.size();
1002  Matrix shape_function_values(integration_points_number, 4);
1003  //
1004  for (int pnt = 0; pnt < integration_points_number; ++pnt)
1005  {
1006  const double xi = IntegrationPoints[pnt].X();
1007  const double fx1 = 1.0 - xi;
1008  const double fx2 = 1.0 + xi;
1009  const double fx3 = fx1 * fx2;
1010  const double gx1 = 1.0 - 3.0 * xi;
1011  const double gx2 = 1.0 + 3.0 * xi;
1012  const double gx3 = gx1 * gx2;
1013  //
1014  shape_function_values(pnt, 0) = -0.0625 * fx1 * gx3;
1015  shape_function_values(pnt, 1) = -0.0625 * fx2 * gx3;
1016  shape_function_values(pnt, 2) = 0.5625 * fx3 * gx1;
1017  shape_function_values(pnt, 3) = 0.5625 * fx3 * gx2;
1018  }
1019  return shape_function_values;
1020  }
1021 
1022  static ShapeFunctionsGradientsType CalculateShapeFunctionsIntegrationPointsLocalGradients(
1023  typename BaseType::IntegrationMethod ThisMethod)
1024  {
1025  const IntegrationPointsContainerType& all_integration_points = AllIntegrationPoints();
1026  const IntegrationPointsArrayType& IntegrationPoints = all_integration_points[static_cast<int>(ThisMethod)];
1028  std::fill(DN_De.begin(), DN_De.end(), Matrix(4, 1));
1029  //
1030  for (unsigned int pnt = 0; pnt < IntegrationPoints.size(); ++pnt)
1031  {
1032  const double xi = IntegrationPoints[pnt].X();
1033  const double fx1 = 1.0 - xi;
1034  const double fx2 = 1.0 + xi;
1035  const double fx3 = fx1 * fx2;
1036  const double gx1 = 1.0 - 3.0 * xi;
1037  const double gx2 = 1.0 + 3.0 * xi;
1038  const double gx3 = gx1 * gx2;
1039  //
1040  DN_De[pnt](0, 0) = 0.0625 * (18.0 * xi * fx1 + gx3);
1041  DN_De[pnt](1, 0) = 0.0625 * (18.0 * xi * fx2 - gx3);
1042  DN_De[pnt](2, 0) = -0.5625 * (3.0 * fx3 + 2.0 * xi * gx1);
1043  DN_De[pnt](3, 0) = 0.5625 * (3.0 * fx3 - 2.0 * xi * gx2);
1044  }
1045  return DN_De;
1046  }
1047 
1048  static const IntegrationPointsContainerType AllIntegrationPoints()
1049  {
1050  IntegrationPointsContainerType integration_points = {{
1051  Quadrature<LineGaussLegendreIntegrationPoints1, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1052  Quadrature<LineGaussLegendreIntegrationPoints2, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1053  Quadrature<LineGaussLegendreIntegrationPoints3, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1054  Quadrature<LineGaussLegendreIntegrationPoints4, 1, IntegrationPoint<3> >::GenerateIntegrationPoints(),
1055  Quadrature<LineGaussLegendreIntegrationPoints5, 1, IntegrationPoint<3> >::GenerateIntegrationPoints()
1056  }
1057  };
1058  return integration_points;
1059  }
1060 
1061  static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
1062  {
1063  ShapeFunctionsValuesContainerType shape_functions_values = {{
1064  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_1),
1065  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_2),
1066  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_3),
1067  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_4),
1068  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_5)
1069  }
1070  };
1071  return shape_functions_values;
1072  }
1073 
1074  static const ShapeFunctionsLocalGradientsContainerType AllShapeFunctionsLocalGradients()
1075  {
1076  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients = {{
1077  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_1),
1078  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_2),
1079  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_3),
1080  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_4),
1081  Line2D4<TPointType>::CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_5)
1082  }
1083  };
1084  return shape_functions_local_gradients;
1085  }
1086 
1090 
1094 
1098 
1099  template<class TOtherPointType> friend class Line2D4;
1100 
1104 
1106 
1107 }; // Class Geometry
1108 
1110 
1113 
1117 
1119 template<class TPointType>
1120 inline std::istream& operator >> (std::istream& rIStream, Line2D4<TPointType>& rThis);
1121 
1123 template<class TPointType>
1124 inline std::ostream& operator << (std::ostream& rOStream, const Line2D4<TPointType>& rThis)
1125 {
1126  rThis.PrintInfo(rOStream);
1127  rOStream << std::endl;
1128  rThis.PrintData(rOStream);
1129  return rOStream;
1130 }
1131 
1133 
1134 template<class TPointType>
1135 const GeometryData Line2D4<TPointType>::msGeometryData(
1138  Line2D4<TPointType>::AllIntegrationPoints(),
1139  Line2D4<TPointType>::AllShapeFunctionsValues(),
1140  AllShapeFunctionsLocalGradients());
1141 
1142 template<class TPointType>
1143 const GeometryDimension Line2D4<TPointType>::msGeometryDimension(2, 1);
1144 
1145 } // namespace Kratos.
Definition: geometry_data.h:60
KratosGeometryType
Definition: geometry_data.h:110
SizeType IntegrationPointsNumber() const
Definition: geometry_data.h:430
IntegrationMethod
Definition: geometry_data.h:76
KratosGeometryFamily
Definition: geometry_data.h:91
IntegrationMethod DefaultIntegrationMethod() const
Definition: geometry_data.h:425
Definition: geometry_dimension.h:42
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry.h:3834
SizeType size() const
Definition: geometry.h:518
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
virtual CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, CoordinatesArrayType const &LocalCoordinates) const
Definition: geometry.h:2377
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
std::size_t SizeType
Definition: geometry.h:144
std::size_t IndexType
Definition: geometry.h:137
std::array< Matrix, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Definition: geometry.h:172
const PointsArrayType & Points() const
Definition: geometry.h:1768
bool AllPointsAreValid() const
Checks if the geometry points are valid Checks if the geometry points are valid from the pointer valu...
Definition: geometry.h:4093
std::array< IntegrationPointsArrayType, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry.h:167
LumpingMethods
This defines the different methods to compute the lumping methods.
Definition: geometry.h:109
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
SizeType IntegrationPointsNumber() const
Definition: geometry.h:2257
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
Short class definition.
Definition: integration_point.h:52
static GeometryData::IntegrationMethod GetIntegrationMethodForExactMassMatrixEvaluation(const Geometry< TPointType > &rGeometry)
This method returns the integration order for the exact mass matrix evaluation.
Definition: integration_utilities.h:42
Definition: amatrix_interface.h:41
void swap(Matrix &Other)
Definition: amatrix_interface.h:289
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
An three node 2D line geometry with cubic shape functions.
Definition: line_2d_4.h:62
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: line_2d_4.h:152
double DeterminantOfJacobian(const CoordinatesArrayType &rPoint) const override
Determinant of jacobian in given point. This method calculate determinant of jacobian matrix in given...
Definition: line_2d_4.h:656
std::string Info() const override
Definition: line_2d_4.h:777
BaseType::IntegrationPointType IntegrationPointType
Definition: line_2d_4.h:108
TPointType PointType
Definition: line_2d_4.h:85
double DomainSize() const override
Definition: line_2d_4.h:373
double ShapeFunctionValue(const IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
This method gives value of given shape function evaluated in given point.
Definition: line_2d_4.h:720
Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_2d_4.h:565
Line2D4(Line2D4 const &rOther)
Definition: line_2d_4.h:206
Line2D4(const PointType &Point01, const PointType &Point02, const PointType &Point03, const PointType &Point04)
Definition: line_2d_4.h:158
CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const override
Returns the local coordinates of a given arbitrary point.
Definition: line_2d_4.h:402
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: line_2d_4.h:115
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: line_2d_4.h:131
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
This method gives all non-zero shape functions values evaluated at the rCoordinates provided.
Definition: line_2d_4.h:691
void PrintData(std::ostream &rOStream) const override
Definition: line_2d_4.h:798
Vector & LumpingFactors(Vector &rResult, const typename BaseType::LumpingMethods LumpingMethod=BaseType::LumpingMethods::ROW_SUM) const override
Lumping factors for the calculation of the lumped mass matrix.
Definition: line_2d_4.h:309
BaseType::JacobiansType JacobiansType
Definition: line_2d_4.h:137
friend class Line2D4
Definition: line_2d_4.h:1099
BaseType::GeometriesArrayType GeometriesArrayType
Definition: line_2d_4.h:81
double Length() const override
Definition: line_2d_4.h:334
BaseType::PointsArrayType PointsArrayType
Definition: line_2d_4.h:102
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult, Vector &rDeterminantsOfJacobian, IntegrationMethod ThisMethod) const override
Definition: line_2d_4.h:762
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: line_2d_4.h:293
Line2D4 & operator=(Line2D4< TOtherPointType > const &rOther)
Definition: line_2d_4.h:265
Line2D4(const PointsArrayType &rThisPoints)
Definition: line_2d_4.h:177
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: line_2d_4.h:126
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_2d_4.h:854
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: line_2d_4.h:121
virtual Matrix & ShapeFunctionsGradients(Matrix &rResult, CoordinatesArrayType &rPoint)
Definition: line_2d_4.h:902
Vector & DeterminantOfJacobian(Vector &rResult, IntegrationMethod ThisMethod) const override
Determinant of jacobians for given integration method.
Definition: line_2d_4.h:620
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: line_2d_4.h:143
double DeterminantOfJacobian(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Determinant of jacobian in specific integration point of given integration method....
Definition: line_2d_4.h:641
Geometry< TPointType > BaseType
Geometry as base class.
Definition: line_2d_4.h:69
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: line_2d_4.h:233
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients()
Definition: line_2d_4.h:831
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_2d_4.h:756
KRATOS_CLASS_POINTER_DEFINITION(Line2D4)
Pointer definition of Line2D4.
~Line2D4() override
Destructor. Do nothing!!!
Definition: line_2d_4.h:226
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_2d_4.h:481
Line2D4(typename PointType::Pointer pPoint01, typename PointType::Pointer pPoint02, typename PointType::Pointer pPoint03, typename PointType::Pointer pPoint04)
Definition: line_2d_4.h:167
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: line_2d_4.h:881
Line2D4(Line2D4< TOtherPointType > const &rOther)
Definition: line_2d_4.h:220
Line2D4(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: line_2d_4.h:192
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: line_2d_4.h:228
Line2D4(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: line_2d_4.h:184
BaseType::NormalType NormalType
Definition: line_2d_4.h:147
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: line_2d_4.h:281
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod, Matrix &rDeltaPosition) const override
Definition: line_2d_4.h:522
GeometryData::IntegrationMethod IntegrationMethod
Definition: line_2d_4.h:76
BaseType::SizeType SizeType
Definition: line_2d_4.h:97
bool IsInside(const CoordinatesArrayType &rPoint, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Returns whether given arbitrary point is inside the Geometry and the respective local point for the g...
Definition: line_2d_4.h:386
Line2D4 & operator=(const Line2D4 &rOther)
Definition: line_2d_4.h:250
double Area() const override
Definition: line_2d_4.h:358
SizeType EdgesNumber() const override
Definition: line_2d_4.h:666
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients(IntegrationMethod &ThisMethod)
Definition: line_2d_4.h:814
Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_2d_4.h:595
SizeType FacesNumber() const override
Definition: line_2d_4.h:674
BaseType::IndexType IndexType
Definition: line_2d_4.h:91
void PrintInfo(std::ostream &rOStream) const override
Definition: line_2d_4.h:787
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Short class definition.
Definition: array_1d.h:61
BOOST_UBLAS_INLINE void resize(size_type array_size, bool preserve=true)
Definition: array_1d.h:242
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
const GeometryData Line2D4< TPointType >::msGeometryData & msGeometryDimension(), Line2D4< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
const GeometryData BrepCurve< TContainerPointType, TContainerPointEmbeddedType >::msGeometryData & msGeometryDimension
Definition: brep_curve.h:483
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
res
Definition: generate_convection_diffusion_explicit_element.py:211
DN
Definition: generate_convection_diffusion_explicit_element.py:98
def load(f)
Definition: ode_solve.py:307
int k
Definition: quadrature.py:595
float temp
Definition: rotating_cone.py:85
J
Definition: sensitivityMatrix.py:58
integer i
Definition: TensorModule.f:17