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.
geometry.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: Pooyan Dadvand
11 // Riccardo Rossi
12 // Janosch Stascheit
13 // Felix Nagel
14 // contributors: Hoang Giang Bui
15 // Josep Maria Carbonell
16 // Carlos Roig
17 // Vicente Mataix Ferrandiz
18 //
19 
20 #pragma once
21 
22 // System includes
23 #include <typeinfo>
24 
25 // External includes
26 
27 // Project includes
29 #include "geometries/point.h"
32 #include "utilities/math_utils.h"
33 #include "input_output/logger.h"
35 
36 namespace Kratos
37 {
52 
54 
69 template<class TPointType>
70 class Geometry
71 {
72 public:
76 
79 
82 
86  enum class QualityCriteria {
92  REGULARITY,
100  };
101 
109  enum class LumpingMethods {
110  ROW_SUM,
113  };
114 
119 
123 
128 
131  typedef TPointType PointType;
132 
137  typedef std::size_t IndexType;
138 
139 
144  typedef std::size_t SizeType;
145 
146 
148 
149 
155 
161  typedef std::vector<IntegrationPointType> IntegrationPointsArrayType;
162 
167  typedef std::array<IntegrationPointsArrayType, static_cast<int>(GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType;
168 
173 
178 
184 
190 
196 
200 
204 
206  typedef typename PointType::Pointer PointPointerType;
208  typedef TPointType& PointReferenceType;
209  typedef const TPointType& ConstPointReferenceType;
210  typedef std::vector<PointPointerType> PointPointerContainerType;
211 
215 
219 
221 
225 
228  : mId(GenerateSelfAssignedId())
229  , mpGeometryData(&GeometryDataInstance())
230  {
231  }
232 
234  Geometry(IndexType GeomertyId)
235  : mpGeometryData(&GeometryDataInstance())
236  {
237  SetId(GeomertyId);
238  }
239 
241  Geometry(const std::string& GeometryName)
242  : mId(GenerateId(GeometryName))
243  , mpGeometryData(&GeometryDataInstance())
244  {
245  }
246 
306  const PointsArrayType &ThisPoints,
307  GeometryData const *pThisGeometryData = &GeometryDataInstance())
308  : mId(GenerateSelfAssignedId())
309  , mpGeometryData(pThisGeometryData)
310  , mPoints(ThisPoints)
311  {
312  }
313 
315  IndexType GeometryId,
316  const PointsArrayType& ThisPoints,
317  GeometryData const* pThisGeometryData = &GeometryDataInstance())
318  : mpGeometryData(pThisGeometryData)
319  , mPoints(ThisPoints)
320  {
321  SetId(GeometryId);
322  }
323 
325  const std::string& GeometryName,
326  const PointsArrayType& ThisPoints,
327  GeometryData const* pThisGeometryData = &GeometryDataInstance())
328  : mId(GenerateId(GeometryName))
329  , mpGeometryData(pThisGeometryData)
330  , mPoints(ThisPoints)
331  {
332  }
333 
343  Geometry( const Geometry& rOther )
344  : mId(rOther.mId),
345  mpGeometryData(rOther.mpGeometryData),
346  mPoints(rOther.mPoints),
347  mData(rOther.mData)
348  {
349  }
350 
364  template<class TOtherPointType>
366  : mId(rOther.mId),
367  mpGeometryData(rOther.mpGeometryData),
368  mData(rOther.mData)
369  {
370  mPoints = new PointsArrayType(rOther.begin(), rOther.end());
371  }
372 
374  virtual ~Geometry() {}
375 
377  {
379  }
380 
382  {
384  }
385 
389 
400  Geometry& operator=( const Geometry& rOther )
401  {
402  mpGeometryData = rOther.mpGeometryData;
403  mPoints = rOther.mPoints;
404  mData = rOther.mData;
405 
406  return *this;
407  }
408 
419  template<class TOtherPointType>
421  {
422  this->clear();
423 
424  for ( typename Geometry<TOtherPointType>::ptr_const_iterator i = rOther.ptr_begin() ; i != rOther.ptr_end() ; ++i )
425  push_back( typename PointType::Pointer( new PointType( **i ) ) );
426 
427  mpGeometryData = rOther.mpGeometryData;
428 
429  return *this;
430  }
431 
432  operator PointsArrayType&()
433  {
434  return mPoints;
435  }
436 
440 
441  TPointType& operator[](const SizeType& i)
442  {
443  return mPoints[i];
444  }
445 
446  TPointType const& operator[](const SizeType& i) const
447  {
448  return mPoints[i];
449  }
450 
452  {
453  return mPoints(i);
454  }
455 
457  {
458  return mPoints(i);
459  }
460 
464 
466  {
467  return iterator(mPoints.begin());
468  }
470  {
471  return const_iterator(mPoints.begin());
472  }
474  {
475  return iterator(mPoints.end());
476  }
478  {
479  return const_iterator(mPoints.end());
480  }
482  {
483  return mPoints.ptr_begin();
484  }
486  {
487  return mPoints.ptr_begin();
488  }
490  {
491  return mPoints.ptr_end();
492  }
494  {
495  return mPoints.ptr_end();
496  }
497  PointReferenceType front() /* nothrow */
498  {
499  assert(!empty());
500  return mPoints.front();
501  }
503  {
504  assert(!empty());
505  return mPoints.front();
506  }
507  PointReferenceType back() /* nothrow */
508  {
509  assert(!empty());
510  return mPoints.back();
511  }
513  {
514  assert(!empty());
515  return mPoints.back();
516  }
517 
518  SizeType size() const
519  {
520  return mPoints.size();
521  }
522 
529  return this->size();
530  }
531 
533  virtual SizeType PointsNumberInDirection(IndexType LocalDirectionIndex) const
534  {
535  KRATOS_ERROR << "Trying to access PointsNumberInDirection from geometry base class." << std::endl;
536  }
537 
539  {
540  return mPoints.max_size();
541  }
542 
543  void swap(GeometryType& rOther)
544  {
545  mPoints.swap(rOther.mPoints);
546  }
547 
549  {
550  mPoints.push_back(x);
551  }
552 
553  void clear()
554  {
555  mPoints.clear();
556  }
557 
558  void reserve(int dim)
559  {
560  mPoints.reserve(dim);
561  }
562 
563  int capacity()
564  {
565  return mPoints.capacity();
566  }
567 
571 
574  {
575  return mPoints.GetContainer();
576  }
577 
580  {
581  return mPoints.GetContainer();
582  }
583 
587 
592  {
593  return mData;
594  }
595 
597  {
598  return mData;
599  }
600 
601  void SetData(DataValueContainer const& rThisData)
602  {
603  mData = rThisData;
604  }
605 
609  template<class TDataType> bool Has(const Variable<TDataType>& rThisVariable) const
610  {
611  return mData.Has(rThisVariable);
612  }
613 
617  template<class TVariableType> void SetValue(
618  const TVariableType& rThisVariable,
619  typename TVariableType::Type const& rValue)
620  {
621  mData.SetValue(rThisVariable, rValue);
622  }
623 
627  template<class TVariableType> typename TVariableType::Type& GetValue(
628  const TVariableType& rThisVariable)
629  {
630  return mData.GetValue(rThisVariable);
631  }
632 
633  template<class TVariableType> typename TVariableType::Type const& GetValue(
634  const TVariableType& rThisVariable) const
635  {
636  return mData.GetValue(rThisVariable);
637  }
638 
642 
643  /* Assigns a value to the geometry,
644  * according to a variable.
645  * Allows dynamic interfaces with each respective geometry.
646  */
647 
649  virtual void Assign(
650  const Variable<bool>& rVariable,
651  const bool Input) {}
652 
654  virtual void Assign(
655  const Variable<int>& rVariable,
656  const int Input) {}
657 
659  virtual void Assign(
660  const Variable<double>& rVariable,
661  const double Input) {}
662 
664  virtual void Assign(
665  const Variable<array_1d<double, 2>>& rVariable,
666  const array_1d<double, 2>& rInput) {}
667 
669  virtual void Assign(
670  const Variable<array_1d<double, 3>>& rVariable,
671  const array_1d<double, 3>& rInput) {}
672 
674  virtual void Assign(
675  const Variable<array_1d<double, 6>>& rVariable,
676  const array_1d<double, 6>& rInput) {}
677 
679  virtual void Assign(
680  const Variable<Vector>& rVariable,
681  const Vector& rInput) {}
682 
684  virtual void Assign(
685  const Variable<Matrix>& rVariable,
686  const Matrix& rInput) {}
687 
688  /* Calculate either provides, gets or calculates a certain value,
689  * according to a variable.
690  */
691 
693  virtual void Calculate(
694  const Variable<bool>& rVariable,
695  bool& rOutput) const {}
696 
698  virtual void Calculate(
699  const Variable<int>& rVariable,
700  int& rOutput) const {}
701 
703  virtual void Calculate(
704  const Variable<double>& rVariable,
705  double& rOutput) const {}
706 
708  virtual void Calculate(
709  const Variable<array_1d<double, 2>>& rVariable,
710  array_1d<double, 2>& rOutput) const {}
711 
713  virtual void Calculate(
714  const Variable<array_1d<double, 3>>& rVariable,
715  array_1d<double, 3>& rOutput) const {}
716 
718  virtual void Calculate(
719  const Variable<array_1d<double, 6>>& rVariable,
720  array_1d<double, 6>& rOutput) const {}
721 
723  virtual void Calculate(
724  const Variable<Vector>& rVariable,
725  Vector& rOutput) const {}
726 
728  virtual void Calculate(
729  const Variable<Matrix>& rVariable,
730  Matrix& rOutput) const {}
731 
735 
740  inline static bool HasSameType(
741  const GeometryType& rLHS,
742  const GeometryType& rRHS)
743  {
744  return (typeid(rLHS) == typeid(rRHS));
745  }
746 
751  inline static bool HasSameType(
752  const GeometryType * rLHS,
753  const GeometryType* rRHS)
754  {
755  return GeometryType::HasSameType(*rLHS, *rRHS);
756  }
757 
762  inline static bool HasSameGeometryType(const GeometryType& rLHS, const GeometryType& rRHS) {
763  return (rLHS.GetGeometryType() == rRHS.GetGeometryType());
764  }
765 
770  inline static bool HasSameGeometryType(
771  const GeometryType* rLHS,
772  const GeometryType* rRHS)
773  {
774  return GeometryType::HasSameGeometryType(*rLHS, *rRHS);
775  }
776 
781  inline static bool IsSame(
782  const GeometryType& rLHS,
783  const GeometryType& rRHS)
784  {
785  return GeometryType::HasSameType(rLHS, rRHS) && GeometryType::HasSameGeometryType(rLHS, rRHS);
786  }
787 
792  inline static bool IsSame(
793  const GeometryType* rLHS,
794  const GeometryType* rRHS)
795  {
796  return GeometryType::HasSameType(*rLHS, *rRHS) && GeometryType::HasSameGeometryType(*rLHS, *rRHS);
797  }
798 
799  bool empty() const
800  {
801  return mPoints.empty();
802  }
803 
807 
813  virtual Pointer Create(
814  PointsArrayType const& rThisPoints
815  ) const
816  {
817  // Create geometry
818  auto p_geom = this->Create(0, rThisPoints);
819 
820  // Generate Id
821  IndexType id = reinterpret_cast<IndexType>(p_geom.get());
822 
823  // Sets second bit to zero.
824  p_geom->SetIdSelfAssigned(id);
825 
826  // Sets first bit to zero.
827  p_geom->SetIdNotGeneratedFromString(id);
828 
829  // Sets Id
830  p_geom->SetIdWithoutCheck(id);
831 
832  return p_geom;
833  }
834 
841  virtual Pointer Create(
842  const IndexType NewGeometryId,
843  PointsArrayType const& rThisPoints
844  ) const
845  {
846  return Pointer( new Geometry( NewGeometryId, rThisPoints, mpGeometryData));
847  }
848 
855  Pointer Create(
856  const std::string& rNewGeometryName,
857  PointsArrayType const& rThisPoints
858  ) const
859  {
860  auto p_geom = this->Create(0, rThisPoints);
861  p_geom->SetId(rNewGeometryName);
862  return p_geom;
863  }
864 
870  virtual Pointer Create(
871  const GeometryType& rGeometry
872  ) const
873  {
874  // Create geometry
875  auto p_geom = this->Create(0, rGeometry);
876 
877  // Generate Id
878  IndexType id = reinterpret_cast<IndexType>(p_geom.get());
879 
880  // Sets second bit to zero.
881  p_geom->SetIdSelfAssigned(id);
882 
883  // Sets first bit to zero.
884  p_geom->SetIdNotGeneratedFromString(id);
885 
886  // Sets Id
887  p_geom->SetIdWithoutCheck(id);
888 
889  return p_geom;
890  }
891 
898  virtual Pointer Create(
899  const IndexType NewGeometryId,
900  const GeometryType& rGeometry
901  ) const
902  {
903  auto p_geometry = Pointer( new Geometry( NewGeometryId, rGeometry.Points(), mpGeometryData));
904  p_geometry->SetData(rGeometry.GetData());
905  return p_geometry;
906  }
907 
914  Pointer Create(
915  const std::string& rNewGeometryName,
916  const GeometryType& rGeometry
917  ) const
918  {
919  auto p_geom = this->Create(0, rGeometry);
920  p_geom->SetId(rNewGeometryName);
921  return p_geom;
922  }
923 
926  void ClonePoints()
927  {
928  for ( ptr_iterator i = this->ptr_begin() ; i != this->ptr_end() ; i++ )
929  *i = typename PointType::Pointer( new PointType( **i ) );
930  }
931 
935 
943  {
944  return *mpGeometryData;
945  }
946 
947  /* @brief SetGeometryShapeFunctionContainer updates the GeometryShapeFunctionContainer within
948  * the GeometryData. This function works only for geometries with a non-const GeometryData.
949  * E.g. QuadraturePointGeometries.
950  */
952  const GeometryShapeFunctionContainer<GeometryData::IntegrationMethod>& rGeometryShapeFunctionContainer)
953  {
954  KRATOS_ERROR <<
955  "Calling SetGeometryShapeFunctionContainer from base geometry class."
956  << std::endl;
957  }
958 
962 
964  IndexType const& Id() const
965  {
966  return mId;
967  }
968 
971  {
972  return IsIdGeneratedFromString(mId);
973  }
974 
977  {
978  return IsIdSelfAssigned(mId);
979  }
980 
982  void SetId(const IndexType Id)
983  {
984  // The first bit of the Id is used to detect if Id
985  // is int or hash of name. Second bit defines if Id
986  // is self assigned or not.
988  || IsIdSelfAssigned(Id))
989  << "Id: " << Id << " out of range. The Id must me lower than 2^62 = 4.61e+18. "
990  << "Geometry being recognized as generated from string: " << IsIdGeneratedFromString(Id)
991  << ", self assigned: " << IsIdSelfAssigned(Id) << "."
992  << std::endl;
993 
994  mId = Id;
995  }
996 
998  void SetId(const std::string& rName)
999  {
1000  mId = GenerateId(rName);
1001  }
1002 
1004  static inline IndexType GenerateId(const std::string& rName)
1005  {
1006  // Create id hash from provided name.
1007  std::hash<std::string> string_hash_generator;
1008  auto id = string_hash_generator(rName);
1009 
1010  // Sets first bit to one.
1011  SetIdGeneratedFromString(id);
1012 
1013  // Sets second bit to zero.
1014  SetIdNotSelfAssigned(id);
1015 
1016  return id;
1017  }
1018 
1022 
1030  {
1031  KRATOS_ERROR <<
1032  "Calling GetGeometryParent from base geometry class."
1033  << std::endl;
1034  }
1035 
1042  virtual void SetGeometryParent(GeometryType* pGeometryParent)
1043  {
1044  KRATOS_ERROR <<
1045  "Calling SetGeometryParent from base geometry class."
1046  << std::endl;
1047  }
1048 
1052 
1061  {
1062  return *pGetGeometryPart(Index);
1063  }
1064 
1072  virtual const GeometryType& GetGeometryPart(const IndexType Index) const
1073  {
1074  return *pGetGeometryPart(Index);
1075  }
1076 
1084  virtual typename GeometryType::Pointer pGetGeometryPart(const IndexType Index)
1085  {
1086  KRATOS_ERROR << "Calling base class 'pGetGeometryPart' method instead of derived function."
1087  << " Please check the definition in the derived class. " << *this << std::endl;
1088  }
1089 
1098  virtual const typename GeometryType::Pointer pGetGeometryPart(const IndexType Index) const
1099  {
1100  KRATOS_ERROR << "Calling base class 'pGetGeometryPart' method instead of derived function."
1101  << " Please check the definition in the derived class. " << *this << std::endl;
1102  }
1103 
1109  virtual void SetGeometryPart(
1110  const IndexType Index,
1111  GeometryType::Pointer pGeometry
1112  )
1113  {
1114  KRATOS_ERROR << "Calling base class 'SetGeometryPart' method instead of derived function."
1115  << " Please check the definition in the derived class. " << *this << std::endl;
1116  }
1117 
1122  virtual IndexType AddGeometryPart(GeometryType::Pointer pGeometry)
1123  {
1124  KRATOS_ERROR << "Calling base class 'AddGeometryPart' method instead of derived function."
1125  << " Please check the definition in the derived class. " << *this << std::endl;
1126  }
1127 
1132  virtual void RemoveGeometryPart(GeometryType::Pointer pGeometry)
1133  {
1134  KRATOS_ERROR << "Calling base class 'RemoveGeometryPart' method instead of derived function."
1135  << " Please check the definition in the derived class. " << *this << std::endl;
1136  }
1137 
1142  virtual void RemoveGeometryPart(const IndexType Index)
1143  {
1144  KRATOS_ERROR << "Calling base class 'RemoveGeometryPart' method instead of derived function."
1145  << " Please check the definition in the derived class. " << *this << std::endl;
1146  }
1147 
1155  virtual bool HasGeometryPart(const IndexType Index) const
1156  {
1157  KRATOS_ERROR << "Calling base class 'HasGeometryPart' method instead of derived function."
1158  << " Please check the definition in the derived class. " << *this << std::endl;
1159  }
1160 
1165  {
1166  return 0;
1167  }
1168 
1172 
1182  Vector& rResult,
1183  const LumpingMethods LumpingMethod = LumpingMethods::ROW_SUM
1184  ) const
1185  {
1186  const SizeType number_of_nodes = this->size();
1187  const SizeType local_space_dimension = this->LocalSpaceDimension();
1188 
1189  // Clear lumping factors
1190  if (rResult.size() != number_of_nodes)
1191  rResult.resize(number_of_nodes, false);
1192  noalias(rResult) = ZeroVector(number_of_nodes);
1193 
1194  if (LumpingMethod == LumpingMethods::ROW_SUM) {
1195  const IntegrationMethod integration_method = GetDefaultIntegrationMethod();
1196  const GeometryType::IntegrationPointsArrayType& r_integrations_points = this->IntegrationPoints( integration_method );
1197  const Matrix& r_Ncontainer = this->ShapeFunctionsValues(integration_method);
1198 
1199  // Vector fo jacobians
1200  Vector detJ_vector(r_integrations_points.size());
1201  DeterminantOfJacobian(detJ_vector, integration_method);
1202 
1203  // Iterate over the integration points
1204  double domain_size = 0.0;
1205  for ( IndexType point_number = 0; point_number < r_integrations_points.size(); ++point_number ) {
1206  const double integration_weight = r_integrations_points[point_number].Weight() * detJ_vector[point_number];
1207  const Vector& rN = row(r_Ncontainer,point_number);
1208 
1209  // Computing domain size
1210  domain_size += integration_weight;
1211 
1212  for ( IndexType i = 0; i < number_of_nodes; ++i ) {
1213  rResult[i] += rN[i] * integration_weight;
1214  }
1215  }
1216 
1217  // Divide by the domain size
1218  for ( IndexType i = 0; i < number_of_nodes; ++i ) {
1219  rResult[i] /= domain_size;
1220  }
1221  } else if (LumpingMethod == LumpingMethods::DIAGONAL_SCALING) {
1222  IntegrationMethod integration_method = GetDefaultIntegrationMethod();
1223  int j = std::min(static_cast<int>(integration_method) + 1, 4);
1224  integration_method = static_cast<IntegrationMethod>(j);
1225  const GeometryType::IntegrationPointsArrayType& r_integrations_points = this->IntegrationPoints( integration_method );
1226  const Matrix& r_Ncontainer = this->ShapeFunctionsValues(integration_method);
1227 
1228  // Vector fo jacobians
1229  Vector detJ_vector(r_integrations_points.size());
1230  DeterminantOfJacobian(detJ_vector, integration_method);
1231 
1232  // Iterate over the integration points
1233  for ( IndexType point_number = 0; point_number < r_integrations_points.size(); ++point_number ) {
1234  const double detJ = detJ_vector[point_number];
1235  const double integration_weight = r_integrations_points[point_number].Weight() * detJ;
1236  const Vector& rN = row(r_Ncontainer,point_number);
1237 
1238  for ( IndexType i = 0; i < number_of_nodes; ++i ) {
1239  rResult[i] += std::pow(rN[i], 2) * integration_weight;
1240  }
1241  }
1242 
1243  // Computing diagonal scaling coefficient
1244  double total_value = 0.0;
1245  for ( IndexType i = 0; i < number_of_nodes; ++i ) {
1246  total_value += rResult[i];
1247  }
1248  for ( IndexType i = 0; i < number_of_nodes; ++i ) {
1249  rResult[i] /= total_value;
1250  }
1251  } else if (LumpingMethod == LumpingMethods::QUADRATURE_ON_NODES) {
1252  // Divide by the domain size
1253  const double domain_size = DomainSize();
1254 
1255  // Getting local coordinates
1256  Matrix local_coordinates(number_of_nodes, local_space_dimension);
1257  PointsLocalCoordinates(local_coordinates);
1258  Point local_point(ZeroVector(3));
1259  array_1d<double, 3>& r_local_coordinates = local_point.Coordinates();
1260 
1261  // Iterate over integration points
1263  const double weight = r_integrations_points[0].Weight()/static_cast<double>(number_of_nodes);
1264  for ( IndexType point_number = 0; point_number < number_of_nodes; ++point_number ) {
1265  for ( IndexType dim = 0; dim < local_space_dimension; ++dim ) {
1266  r_local_coordinates[dim] = local_coordinates(point_number, dim);
1267  }
1268  const double detJ = DeterminantOfJacobian(local_point);
1269  rResult[point_number] = weight * detJ/domain_size;
1270  }
1271  }
1272 
1273  return rResult;
1274  }
1275 
1279 
1288  {
1289  return mpGeometryData->WorkingSpaceDimension();
1290  }
1291 
1301  {
1302  return mpGeometryData->LocalSpaceDimension();
1303  }
1304 
1308 
1310  virtual SizeType PolynomialDegree(IndexType LocalDirectionIndex) const
1311  {
1312  KRATOS_ERROR << "Trying to access PolynomialDegree from geometry base class." << std::endl;
1313  }
1314 
1318 
1332  virtual double Length() const {
1333  KRATOS_ERROR << "Calling base class 'Length' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1334  return 0.0;
1335  }
1336 
1345  virtual double Area() const {
1346  KRATOS_ERROR << "Calling base class 'Area' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1347  return 0.0;
1348  }
1349 
1358  virtual double Volume() const {
1359  KRATOS_ERROR << "Calling base class 'Volume' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1360  return 0.0;
1361  }
1362 
1371  virtual double DomainSize() const {
1372  const SizeType local_dimension = this->LocalSpaceDimension();
1373  if (local_dimension == 1) { // 1D geometry
1374  return this->Length();
1375  } else if (local_dimension == 2) { // 2D geometry
1376  return this->Area();
1377  } else { // 3D geometry
1378  return this->Volume();
1379  }
1380  return 0.0;
1381  }
1382 
1391  virtual double MinEdgeLength() const {
1392  KRATOS_ERROR << "Calling base class 'MinEdgeLength' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1393  return 0.0;
1394  }
1395 
1404  virtual double MaxEdgeLength() const {
1405  KRATOS_ERROR << "Calling base class 'MaxEdgeLength' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1406  return 0.0;
1407  }
1408 
1417  virtual double AverageEdgeLength() const {
1418  KRATOS_ERROR << "Calling base class 'AverageEdgeLength' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1419  return 0.0;
1420  }
1421 
1429  virtual double Circumradius() const {
1430  KRATOS_ERROR << "Calling base class 'Circumradius' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1431  return 0.0;
1432  }
1433 
1441  virtual double Inradius() const {
1442  KRATOS_ERROR << "Calling base class 'Inradius' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1443  return 0.0;
1444  }
1445 
1453  virtual bool HasIntersection(const GeometryType& ThisGeometry) const {
1454  KRATOS_ERROR << "Calling base class 'HasIntersection' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1455  return false;
1456  }
1457 
1467  virtual bool HasIntersection(const Point& rLowPoint, const Point& rHighPoint) const {
1468  KRATOS_ERROR << "Calling base class 'HasIntersection' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1469  return false;
1470  }
1471 
1472  // virtual void BoundingBox(BoundingBoxType& rResult) const
1473  // {
1474  //
1475  // Bounding_Box(rResult.LowPoint(), rResult.HighPoint());
1476  // }
1477 
1484  virtual void BoundingBox(
1485  TPointType& rLowPoint,
1486  TPointType& rHighPoint
1487  ) const
1488  {
1489  rHighPoint = this->GetPoint( 0 );
1490  rLowPoint = this->GetPoint( 0 );
1491  const SizeType dim = WorkingSpaceDimension();
1492 
1493  for ( IndexType point = 1; point < PointsNumber(); ++point ) { //The first node is already assigned, so we can start from 1
1494  const auto& r_point = this->GetPoint( point );
1495  for ( IndexType i = 0; i < dim; ++i ) {
1496  rHighPoint[i] = ( rHighPoint[i] < r_point[i] ) ? r_point[i] : rHighPoint[i];
1497  rLowPoint[i] = ( rLowPoint[i] > r_point[i] ) ? r_point[i] : rLowPoint[i];
1498  }
1499  }
1500  }
1501 
1514  virtual Point Center() const
1515  {
1516  const SizeType points_number = this->size();
1517 
1518  if ( points_number == 0 )
1519  {
1520  KRATOS_ERROR << "can not compute the ceneter of a geometry of zero points" << std::endl;
1521  // return PointType();
1522  }
1523 
1524  Point result = ( *this )[0];
1525 
1526  for ( IndexType i = 1 ; i < points_number ; i++ )
1527  {
1528  result.Coordinates() += ( *this )[i];
1529  }
1530 
1531  const double temp = 1.0 / double( points_number );
1532 
1533  result.Coordinates() *= temp;
1534 
1535  return result;
1536  }
1537 
1543  virtual array_1d<double, 3> Normal(const CoordinatesArrayType& rPointLocalCoordinates) const
1544  {
1545  const SizeType local_space_dimension = this->LocalSpaceDimension();
1546  const SizeType dimension = this->WorkingSpaceDimension();
1547 
1548  KRATOS_ERROR_IF(dimension == local_space_dimension) << "Remember the normal can be computed just in geometries with a local dimension: "<< this->LocalSpaceDimension() << "smaller than the spatial dimension: " << this->WorkingSpaceDimension() << std::endl;
1549 
1550  // We define the normal and tangents
1551  array_1d<double,3> tangent_xi = ZeroVector(3);
1552  array_1d<double,3> tangent_eta = ZeroVector(3);
1553 
1554  Matrix j_node = ZeroMatrix( dimension, local_space_dimension );
1555  this->Jacobian( j_node, rPointLocalCoordinates);
1556 
1557  // Using the Jacobian tangent directions
1558  if (dimension == 2) {
1559  tangent_eta[2] = 1.0;
1560  for (unsigned int i_dim = 0; i_dim < dimension; i_dim++) {
1561  tangent_xi[i_dim] = j_node(i_dim, 0);
1562  }
1563  } else {
1564  for (unsigned int i_dim = 0; i_dim < dimension; i_dim++) {
1565  tangent_xi[i_dim] = j_node(i_dim, 0);
1566  tangent_eta[i_dim] = j_node(i_dim, 1);
1567  }
1568  }
1569 
1570  array_1d<double, 3> normal;
1571  MathUtils<double>::CrossProduct(normal, tangent_xi, tangent_eta);
1572  return normal;
1573  }
1574 
1583  IndexType IntegrationPointIndex) const
1584  {
1585  return Normal(IntegrationPointIndex, mpGeometryData->DefaultIntegrationMethod());
1586  }
1587 
1597  IndexType IntegrationPointIndex,
1598  IntegrationMethod ThisMethod) const
1599  {
1600  const SizeType local_space_dimension = this->LocalSpaceDimension();
1601  const SizeType dimension = this->WorkingSpaceDimension();
1602 
1603  KRATOS_DEBUG_ERROR_IF(dimension == local_space_dimension)
1604  << "Remember the normal can be computed just in geometries with a local dimension: "
1605  << this->LocalSpaceDimension() << "smaller than the spatial dimension: "
1606  << this->WorkingSpaceDimension() << std::endl;
1607 
1608  // We define the normal and tangents
1609  array_1d<double, 3> tangent_xi = ZeroVector(3);
1610  array_1d<double, 3> tangent_eta = ZeroVector(3);
1611 
1612  Matrix j_node = ZeroMatrix(dimension, local_space_dimension);
1613  this->Jacobian(j_node, IntegrationPointIndex, ThisMethod);
1614 
1615  // Using the Jacobian tangent directions
1616  if (dimension == 2) {
1617  tangent_eta[2] = 1.0;
1618  for (IndexType i_dim = 0; i_dim < dimension; i_dim++) {
1619  tangent_xi[i_dim] = j_node(i_dim, 0);
1620  }
1621  }
1622  else {
1623  for (IndexType i_dim = 0; i_dim < dimension; i_dim++) {
1624  tangent_xi[i_dim] = j_node(i_dim, 0);
1625  tangent_eta[i_dim] = j_node(i_dim, 1);
1626  }
1627  }
1628 
1629  array_1d<double, 3> normal;
1630  MathUtils<double>::CrossProduct(normal, tangent_xi, tangent_eta);
1631  return normal;
1632  }
1633 
1640  const CoordinatesArrayType& rPointLocalCoordinates) const
1641  {
1642  array_1d<double, 3> normal = Normal(rPointLocalCoordinates);
1643  const double norm_normal = norm_2(normal);
1644  if (norm_normal > std::numeric_limits<double>::epsilon()) normal /= norm_normal;
1645  else KRATOS_ERROR << "ERROR: The normal norm is zero or almost zero. Norm. normal: " << norm_normal << std::endl;
1646  return normal;
1647  }
1648 
1658  IndexType IntegrationPointIndex) const
1659  {
1660  return UnitNormal(IntegrationPointIndex, mpGeometryData->DefaultIntegrationMethod());
1661  }
1662 
1672  IndexType IntegrationPointIndex,
1673  IntegrationMethod ThisMethod) const
1674  {
1675  array_1d<double, 3> normal_vector = Normal(IntegrationPointIndex, ThisMethod);
1676  const double norm_normal = norm_2(normal_vector);
1677  if (norm_normal > std::numeric_limits<double>::epsilon())
1678  normal_vector /= norm_normal;
1679  else
1680  KRATOS_ERROR
1681  << "ERROR: The normal norm is zero or almost zero: "
1682  << norm_normal << std::endl;
1683  return normal_vector;
1684  }
1685 
1689 
1704  double Quality(const QualityCriteria qualityCriteria) const {
1705  double quality = 0.0f;
1706 
1707  if(qualityCriteria == QualityCriteria::INRADIUS_TO_CIRCUMRADIUS) {
1708  quality = InradiusToCircumradiusQuality();
1709  } else if(qualityCriteria == QualityCriteria::AREA_TO_LENGTH) {
1710  quality = AreaToEdgeLengthRatio();
1711  } else if(qualityCriteria == QualityCriteria::SHORTEST_ALTITUDE_TO_LENGTH) {
1713  } else if(qualityCriteria == QualityCriteria::INRADIUS_TO_LONGEST_EDGE) {
1714  quality = InradiusToLongestEdgeQuality();
1715  } else if(qualityCriteria == QualityCriteria::SHORTEST_TO_LONGEST_EDGE) {
1716  quality = ShortestToLongestEdgeQuality();
1717  } else if(qualityCriteria == QualityCriteria::REGULARITY) {
1718  quality = RegularityQuality();
1719  } else if(qualityCriteria == QualityCriteria::VOLUME_TO_SURFACE_AREA) {
1720  quality = VolumeToSurfaceAreaQuality();
1721  } else if(qualityCriteria == QualityCriteria::VOLUME_TO_EDGE_LENGTH) {
1722  quality = VolumeToEdgeLengthQuality();
1723  } else if(qualityCriteria == QualityCriteria::VOLUME_TO_AVERAGE_EDGE_LENGTH) {
1724  quality = VolumeToAverageEdgeLength();
1725  } else if(qualityCriteria == QualityCriteria::VOLUME_TO_RMS_EDGE_LENGTH) {
1726  quality = VolumeToRMSEdgeLength();
1727  } else if(qualityCriteria == QualityCriteria::MIN_DIHEDRAL_ANGLE) {
1728  quality = MinDihedralAngle();
1729  } else if (qualityCriteria == QualityCriteria::MAX_DIHEDRAL_ANGLE) {
1730  quality = MaxDihedralAngle();
1731  } else if(qualityCriteria == QualityCriteria::MIN_SOLID_ANGLE) {
1732  quality = MinSolidAngle();
1733  }
1734 
1735  return quality;
1736  }
1737 
1743  virtual inline void ComputeDihedralAngles(Vector& rDihedralAngles ) const
1744  {
1745  KRATOS_ERROR << "Called the virtual function for ComputeDihedralAngles " << *this << std::endl;
1746  }
1747 
1753  virtual inline void ComputeSolidAngles(Vector& rSolidAngles ) const
1754  {
1755  KRATOS_ERROR << "Called the virtual function for ComputeDihedralAngles " << *this << std::endl;
1756  }
1757 
1761 
1768  const PointsArrayType& Points() const
1769  {
1770  return mPoints;
1771  }
1772 
1780  {
1781  return mPoints;
1782  }
1783 
1790  const typename TPointType::Pointer pGetPoint( const int Index ) const
1791  {
1792  KRATOS_TRY
1793  return mPoints( Index );
1794  KRATOS_CATCH(mPoints)
1795  }
1796 
1803  typename TPointType::Pointer pGetPoint( const int Index )
1804  {
1805  KRATOS_TRY
1806  return mPoints( Index );
1807  KRATOS_CATCH(mPoints);
1808  }
1809 
1816  TPointType const& GetPoint( const int Index ) const
1817  {
1818  KRATOS_TRY
1819  return mPoints[Index];
1820  KRATOS_CATCH( mPoints);
1821  }
1822 
1823 
1830  TPointType& GetPoint( const int Index )
1831  {
1832  KRATOS_TRY
1833  return mPoints[Index];
1834  KRATOS_CATCH(mPoints);
1835  }
1836 
1842  virtual Matrix& PointsLocalCoordinates( Matrix& rResult ) const
1843  {
1844  KRATOS_ERROR << "Calling base class 'PointsLocalCoordinates' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
1845  return rResult;
1846  }
1847 
1855  CoordinatesArrayType& rResult,
1856  const CoordinatesArrayType& rPoint
1857  ) const
1858  {
1859  KRATOS_ERROR_IF(WorkingSpaceDimension() != LocalSpaceDimension()) << "ERROR:: Attention, the Point Local Coordinates must be specialized for the current geometry" << std::endl;
1860 
1862 
1863  rResult.clear();
1864 
1865  Vector DeltaXi = ZeroVector( LocalSpaceDimension() );
1866 
1867  CoordinatesArrayType CurrentGlobalCoords( ZeroVector( 3 ) );
1868 
1869  static constexpr double MaxNormPointLocalCoordinates = 30.0;
1870  static constexpr std::size_t MaxIteratioNumberPointLocalCoordinates = 1000;
1871  static constexpr double MaxTolerancePointLocalCoordinates = 1.0e-8;
1872 
1873  //Newton iteration:
1874  for(std::size_t k = 0; k < MaxIteratioNumberPointLocalCoordinates; k++) {
1875  CurrentGlobalCoords.clear();
1876  DeltaXi.clear();
1877 
1878  GlobalCoordinates( CurrentGlobalCoords, rResult );
1879  noalias( CurrentGlobalCoords ) = rPoint - CurrentGlobalCoords;
1880  InverseOfJacobian( J, rResult );
1881  for(unsigned int i = 0; i < WorkingSpaceDimension(); i++) {
1882  for(unsigned int j = 0; j < WorkingSpaceDimension(); j++) {
1883  DeltaXi[i] += J(i,j)*CurrentGlobalCoords[j];
1884  }
1885  rResult[i] += DeltaXi[i];
1886  }
1887 
1888  const double norm2DXi = norm_2(DeltaXi);
1889 
1890  if(norm2DXi > MaxNormPointLocalCoordinates) {
1891  KRATOS_WARNING("Geometry") << "Computation of local coordinates failed at iteration " << k << std::endl;
1892  break;
1893  }
1894 
1895  if(norm2DXi < MaxTolerancePointLocalCoordinates) {
1896  break;
1897  }
1898  }
1899 
1900  return rResult;
1901  }
1902 
1906 
1918  virtual bool IsInside(
1919  const CoordinatesArrayType& rPointGlobalCoordinates,
1920  CoordinatesArrayType& rResult,
1921  const double Tolerance = std::numeric_limits<double>::epsilon()
1922  ) const
1923  {
1925  rResult,
1926  rPointGlobalCoordinates);
1927 
1928  if (IsInsideLocalSpace(rResult, Tolerance) == 0) {
1929  return false;
1930  }
1931  return true;
1932  }
1933 
1946  virtual int IsInsideLocalSpace(
1947  const CoordinatesArrayType& rPointLocalCoordinates,
1948  const double Tolerance = std::numeric_limits<double>::epsilon()
1949  ) const
1950  {
1951  KRATOS_ERROR << "Calling IsInsideLocalSpace from base class."
1952  << " Please check the definition of derived class. "
1953  << *this << std::endl;
1954  return 0;
1955  }
1956 
1960 
1961  /* @brief Provides spans in local paramater coordinates of the geometry
1962  * according to its direction from LocalDirectionIndex.
1963  * For NurbsSurface this is equivalent to the knot vector per direction,
1964  * whereby NurbsCurve also provide its knot vector.
1965  * Linear geometries shall provide the delimiters, which might be -1 and 1
1966  * in standard cases.
1967  * Qudartic geometries, may provide additionally the middle point.
1968  *
1969  * @param resulting vector of span intervals.
1970  * @param LocalDirectionIndex of chosen direction, for curves always 0.
1971  */
1972  virtual void SpansLocalSpace(
1973  std::vector<double>& rSpans,
1974  IndexType LocalDirectionIndex = 0) const
1975  {
1976  KRATOS_ERROR <<
1977  "Calling SpansLocalSpace of geometry base class. Please check derived definitions. "
1978  << *this << std::endl;
1979  }
1980 
1984 
1995  bool HasIntegrationMethod( IntegrationMethod ThisMethod ) const
1996  {
1997  return ( mpGeometryData->HasIntegrationMethod( ThisMethod ) );
1998  }
1999 
2005  {
2006  return mpGeometryData->DefaultIntegrationMethod();
2007  }
2008 
2011  {
2013  }
2014 
2023  virtual bool IsSymmetric() const
2024  {
2025  return false;
2026  }
2027 
2031 
2041  {
2042  const SizeType dimension = this->LocalSpaceDimension();
2043  if (dimension == 3) {
2044  return this->GenerateFaces();
2045  } else if (dimension == 2) {
2046  return this->GenerateEdges();
2047  } else { // Let's assume is one
2048  return this->GeneratePoints();
2049  }
2050  }
2051 
2055 
2062  virtual GeometriesArrayType GeneratePoints() const
2063  {
2064  GeometriesArrayType points;
2065 
2066  const auto& p_points = this->Points();
2067  for (IndexType i_point = 0; i_point < p_points.size(); ++i_point) {
2068  PointsArrayType point_array;
2069  point_array.push_back(p_points(i_point));
2070  auto p_point_geometry = Kratos::make_shared<Geometry<TPointType>>(point_array);
2071  points.push_back(p_point_geometry);
2072  }
2073 
2074  return points;
2075  }
2076 
2080 
2092  virtual SizeType EdgesNumber() const
2093  {
2094  KRATOS_ERROR << "Calling base class EdgesNumber method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
2095  }
2096 
2106  KRATOS_DEPRECATED_MESSAGE("This is legacy version (use GenerateEdges instead)") virtual GeometriesArrayType Edges( void )
2107  {
2108  return this->GenerateEdges();
2109  }
2110 
2119  virtual GeometriesArrayType GenerateEdges() const
2120  {
2121  KRATOS_ERROR << "Calling base class Edges method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
2122  }
2123 
2134  // Commented for possible change in Edge interface of geometry. Pooyan. // NOTE: We should rethink this because is aligned with the current PR
2135 // virtual Pointer Edge(const PointsArrayType& EdgePoints)
2136 // {
2137 // KRATOS_ERROR << "Calling base class Edge method instead of derived class one. Please check the definition of derived class." << *this << std::endl;
2138 //
2139 // }
2140 
2144 
2152  virtual SizeType FacesNumber() const
2153  {
2154  KRATOS_ERROR << "Calling base class FacesNumber method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
2155  }
2156 
2166  KRATOS_DEPRECATED_MESSAGE("This is legacy version (use GenerateFaces instead)") virtual GeometriesArrayType Faces( void )
2167  {
2168  const SizeType dimension = this->LocalSpaceDimension();
2169  if (dimension == 3) {
2170  return this->GenerateFaces();
2171  } else {
2172  return this->GenerateEdges();
2173  }
2174  }
2175 
2184  virtual GeometriesArrayType GenerateFaces() const
2185  {
2186  KRATOS_ERROR << "Calling base class GenerateFaces method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
2187  }
2188 
2189  //Connectivities of faces required
2190  virtual void NumberNodesInFaces (DenseVector<unsigned int>& rNumberNodesInFaces) const
2191  {
2192  KRATOS_ERROR << "Calling base class NumberNodesInFaces method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
2193  }
2194 
2195  virtual void NodesInFaces (DenseMatrix<unsigned int>& rNodesInFaces) const
2196  {
2197  KRATOS_ERROR << "Calling base class NodesInFaces method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
2198  }
2199 
2200 
2209  // Commented for possible change in Edge interface of geometry. Pooyan. // NOTE: We should rethink this because is aligned with the current PR
2210 // virtual Pointer Edge(IndexType EdgeIndex)
2211 // {
2212 // KRATOS_ERROR << "Calling base class Edge method instead of derived class one. Please check the definition of derived class." << *this << std::endl;
2213 
2214 // }
2215 
2222  // Commented for possible change in Edge interface of geometry. Pooyan. // NOTE: We should rethink this because is aligned with the current PR
2223 // virtual NormalType NormalEdge(const PointsArrayType& EdgePoints)
2224 // {
2225 // KRATOS_ERROR << "Calling base class NormalEdge method instead of derived class one. Please check the definition of derived class." << *this << std::endl
2226 
2227 // return NormalType();
2228 // }
2229 
2237  // Commented for possible change in Edge interface of geometry. Pooyan. // NOTE: We should rethink this because is aligned with the current PR
2238 // virtual NormalType NormalEdge(IndexType EdgeIndex)
2239 // {
2240 // KRATOS_ERROR << "Calling base class NormalEdge method instead of derived class one. Please check the definition of derived class." << *this << std::endl;
2241 
2242 // return NormalType();
2243 // }
2244 
2248 
2258  {
2259  return mpGeometryData->IntegrationPoints().size();
2260  }
2261 
2271  {
2272  return mpGeometryData->IntegrationPointsNumber( ThisMethod );
2273  }
2274 
2275 
2285  {
2286  return mpGeometryData->IntegrationPoints();
2287  }
2288 
2298  {
2299  return mpGeometryData->IntegrationPoints( ThisMethod );
2300  }
2301 
2302  /* Creates integration points according to its quadrature rule.
2303  * @return integration points.
2304  */
2306  IntegrationPointsArrayType& rIntegrationPoints,
2307  IntegrationInfo& rIntegrationInfo) const
2308  {
2309  IntegrationMethod integration_method = rIntegrationInfo.GetIntegrationMethod(0);
2310  for (IndexType i = 1; i < LocalSpaceDimension(); ++i) {
2311  KRATOS_ERROR_IF(integration_method != rIntegrationInfo.GetIntegrationMethod(i))
2312  << "Default creation of integration points only valid if integration method is not varying per direction." << std::endl;
2313  }
2314  rIntegrationPoints = IntegrationPoints(integration_method);
2315  }
2316 
2320 
2321  /* @brief This method creates a list of quadrature point geometries
2322  * from a list of integration points.
2323  *
2324  * @param rResultGeometries list of quadrature point geometries.
2325  * @param rIntegrationPoints list of integration points.
2326  * @param NumberOfShapeFunctionDerivatives the number of evaluated
2327  * derivatives of shape functions at the quadrature point geometries.
2328  *
2329  * @see quadrature_point_geometry.h
2330  */
2332  GeometriesArrayType& rResultGeometries,
2333  IndexType NumberOfShapeFunctionDerivatives,
2334  const IntegrationPointsArrayType& rIntegrationPoints,
2335  IntegrationInfo& rIntegrationInfo)
2336  {
2337  KRATOS_ERROR << "Calling CreateQuadraturePointGeometries from geometry base class."
2338  << " Please check the definition of derived class. "
2339  << *this << std::endl;
2340  }
2341 
2342  /* @brief This method creates a list of quadrature point geometries
2343  * from a list of integration points. It creates the list of
2344  * integration points byitself.
2345  *
2346  * @param rResultGeometries list of quadrature point geometries.
2347  * @param NumberOfShapeFunctionDerivatives the number of evaluated
2348  * derivatives of shape functions at the quadrature point geometries.
2349  *
2350  * @see quadrature_point_geometry.h
2351  */
2353  GeometriesArrayType& rResultGeometries,
2354  IndexType NumberOfShapeFunctionDerivatives,
2355  IntegrationInfo& rIntegrationInfo)
2356  {
2358  CreateIntegrationPoints(IntegrationPoints, rIntegrationInfo);
2359 
2361  rResultGeometries,
2362  NumberOfShapeFunctionDerivatives,
2364  rIntegrationInfo);
2365  }
2366 
2370 
2378  CoordinatesArrayType& rResult,
2379  CoordinatesArrayType const& LocalCoordinates
2380  ) const
2381  {
2382  noalias( rResult ) = ZeroVector( 3 );
2383 
2384  Vector N( this->size() );
2385  ShapeFunctionsValues( N, LocalCoordinates );
2386 
2387  for ( IndexType i = 0 ; i < this->size() ; i++ )
2388  noalias( rResult ) += N[i] * (*this)[i];
2389 
2390  return rResult;
2391  }
2392 
2400  CoordinatesArrayType& rResult,
2401  IndexType IntegrationPointIndex
2402  ) const
2403  {
2404  this->GlobalCoordinates(rResult, IntegrationPointIndex, GetDefaultIntegrationMethod());
2405  }
2406 
2415  CoordinatesArrayType& rResult,
2416  IndexType IntegrationPointIndex,
2417  const IntegrationMethod ThisMethod
2418  ) const
2419  {
2420  noalias(rResult) = ZeroVector(3);
2421 
2422  const Matrix& N = this->ShapeFunctionsValues(ThisMethod);
2423 
2424  for (IndexType i = 0; i < this->size(); i++)
2425  noalias(rResult) += N(IntegrationPointIndex, i) * (*this)[i];
2426  }
2427 
2436  CoordinatesArrayType& rResult,
2437  CoordinatesArrayType const& LocalCoordinates,
2438  Matrix& DeltaPosition
2439  ) const
2440  {
2441  constexpr std::size_t dimension = 3;
2442  noalias( rResult ) = ZeroVector( 3 );
2443  if (DeltaPosition.size2() != 3)
2444  DeltaPosition.resize(DeltaPosition.size1(), dimension,false);
2445 
2446  Vector N( this->size() );
2447  ShapeFunctionsValues( N, LocalCoordinates );
2448 
2449  for ( IndexType i = 0 ; i < this->size() ; i++ )
2450  noalias( rResult ) += N[i] * ((*this)[i] + row(DeltaPosition, i));
2451 
2452  return rResult;
2453  }
2454 
2474  std::vector<CoordinatesArrayType>& rGlobalSpaceDerivatives,
2475  const CoordinatesArrayType& rLocalCoordinates,
2476  const SizeType DerivativeOrder) const
2477  {
2478  if (DerivativeOrder == 0)
2479  {
2480  if (rGlobalSpaceDerivatives.size() != 1)
2481  rGlobalSpaceDerivatives.resize(1);
2482 
2483  this->GlobalCoordinates(
2484  rGlobalSpaceDerivatives[0],
2485  rLocalCoordinates);
2486  }
2487  else if (DerivativeOrder == 1)
2488  {
2489  const double local_space_dimension = LocalSpaceDimension();
2490  const SizeType points_number = this->size();
2491 
2492  if (rGlobalSpaceDerivatives.size() != 1 + local_space_dimension)
2493  rGlobalSpaceDerivatives.resize(1 + local_space_dimension);
2494 
2495  this->GlobalCoordinates(
2496  rGlobalSpaceDerivatives[0],
2497  rLocalCoordinates);
2498 
2499  Matrix shape_functions_gradients(points_number, local_space_dimension);
2500  this->ShapeFunctionsLocalGradients(shape_functions_gradients, rLocalCoordinates);
2501 
2502  for (IndexType i = 0; i < points_number; ++i) {
2503  const array_1d<double, 3>& r_coordinates = (*this)[i].Coordinates();
2504  for (IndexType k = 0; k < WorkingSpaceDimension(); ++k) {
2505  const double value = r_coordinates[k];
2506  for (IndexType m = 0; m < local_space_dimension; ++m) {
2507  rGlobalSpaceDerivatives[m + 1][k] += value * shape_functions_gradients(i, m);
2508  }
2509  }
2510  }
2511 
2512  return;
2513  }
2514  else
2515  {
2516  KRATOS_ERROR << "Calling GlobalDerivatives within geometry.h."
2517  << " Please check the definition within derived class. "
2518  << *this << std::endl;
2519  }
2520  }
2521 
2534  std::vector<CoordinatesArrayType>& rGlobalSpaceDerivatives,
2535  IndexType IntegrationPointIndex,
2536  const SizeType DerivativeOrder) const
2537  {
2538  if (DerivativeOrder == 0)
2539  {
2540  if (rGlobalSpaceDerivatives.size() != 1)
2541  rGlobalSpaceDerivatives.resize(1);
2542 
2544  rGlobalSpaceDerivatives[0],
2545  IntegrationPointIndex);
2546  }
2547  else if (DerivativeOrder == 1)
2548  {
2549  const double local_space_dimension = LocalSpaceDimension();
2550  const SizeType points_number = this->size();
2551 
2552  if (rGlobalSpaceDerivatives.size() != 1 + local_space_dimension)
2553  rGlobalSpaceDerivatives.resize(1 + local_space_dimension);
2554 
2555  this->GlobalCoordinates(
2556  rGlobalSpaceDerivatives[0],
2557  IntegrationPointIndex);
2558 
2559  for (IndexType k = 0; k < local_space_dimension; ++k)
2560  {
2561  rGlobalSpaceDerivatives[1 + k] = ZeroVector(3);
2562  }
2563 
2564  const Matrix& r_shape_functions_gradient_in_integration_point = this->ShapeFunctionLocalGradient(IntegrationPointIndex);
2565 
2566  for (IndexType i = 0; i < points_number; ++i) {
2567  const array_1d<double, 3>& r_coordinates = (*this)[i].Coordinates();
2568  for (IndexType k = 0; k < WorkingSpaceDimension(); ++k) {
2569  const double value = r_coordinates[k];
2570  for (IndexType m = 0; m < local_space_dimension; ++m) {
2571  rGlobalSpaceDerivatives[m + 1][k] += value * r_shape_functions_gradient_in_integration_point(i, m);
2572  }
2573  }
2574  }
2575  }
2576  else
2577  {
2578  KRATOS_ERROR << "Calling GlobalDerivatives within geometry.h."
2579  << " Please check the definition within derived class. "
2580  << *this << std::endl;
2581  }
2582  }
2583 
2587 
2617  KRATOS_DEPRECATED_MESSAGE("This method is deprecated. Use either \'ProjectionPointLocalToLocalSpace\' or \'ProjectionPointGlobalToLocalSpace\' instead.")
2618  virtual int ProjectionPoint(
2619  const CoordinatesArrayType& rPointGlobalCoordinates,
2620  CoordinatesArrayType& rProjectedPointGlobalCoordinates,
2621  CoordinatesArrayType& rProjectedPointLocalCoordinates,
2622  const double Tolerance = std::numeric_limits<double>::epsilon()
2623  ) const
2624  {
2625  KRATOS_ERROR << "Calling ProjectionPoint within geometry base class."
2626  << " Please check the definition within derived class. "
2627  << *this << std::endl;
2628  }
2629 
2647  const CoordinatesArrayType& rPointLocalCoordinates,
2648  CoordinatesArrayType& rProjectionPointLocalCoordinates,
2649  const double Tolerance = std::numeric_limits<double>::epsilon()
2650  ) const
2651  {
2652  KRATOS_ERROR << "Calling ProjectionPointLocalToLocalSpace within geometry base class."
2653  << " Please check the definition within derived class. "
2654  << *this << std::endl;
2655  }
2656 
2674  const CoordinatesArrayType& rPointGlobalCoordinates,
2675  CoordinatesArrayType& rProjectionPointLocalCoordinates,
2676  const double Tolerance = std::numeric_limits<double>::epsilon()
2677  ) const
2678  {
2679  KRATOS_ERROR << "Calling ProjectionPointGlobalToLocalSpace within geometry base class."
2680  << " Please check the definition within derived class. "
2681  << *this << std::endl;
2682  }
2683 
2703  KRATOS_DEPRECATED_MESSAGE("This method is deprecated. Use either \'ClosestPointLocalToLocalSpace\' or \'ClosestPointGlobalToLocalSpace\' instead. Please note that \'rClosestPointGlobalCoordinates\' returns unmodified original value.")
2704  virtual int ClosestPoint(
2705  const CoordinatesArrayType& rPointGlobalCoordinates,
2706  CoordinatesArrayType& rClosestPointGlobalCoordinates,
2707  CoordinatesArrayType& rClosestPointLocalCoordinates,
2708  const double Tolerance = std::numeric_limits<double>::epsilon()
2709  ) const
2710  {
2711  return ClosestPointGlobalToLocalSpace(rPointGlobalCoordinates, rClosestPointLocalCoordinates, Tolerance);
2712  }
2713 
2734  KRATOS_DEPRECATED_MESSAGE("This method is deprecated. Use either \'ClosestPointLocalToLocalSpace\' or \'ClosestPointGlobalToLocalSpace\' instead.")
2735  virtual int ClosestPoint(
2736  const CoordinatesArrayType& rPointGlobalCoordinates,
2737  CoordinatesArrayType& rClosestPointGlobalCoordinates,
2738  const double Tolerance = std::numeric_limits<double>::epsilon()
2739  ) const
2740  {
2741  CoordinatesArrayType local_coordinates(ZeroVector(3));
2742  const int result = ClosestPointGlobalToLocalSpace(rPointGlobalCoordinates, local_coordinates, Tolerance);
2743 
2744  if (result == 1) {
2745  this->GlobalCoordinates(rClosestPointGlobalCoordinates, local_coordinates);
2746  }
2747 
2748  return result;
2749  }
2750 
2771  KRATOS_DEPRECATED_MESSAGE("This method is deprecated. Use either \'ClosestPointLocalToLocalSpace\' or \'ClosestPointGlobalToLocalSpace\' instead.")
2773  const CoordinatesArrayType& rPointGlobalCoordinates,
2774  CoordinatesArrayType& rClosestPointLocalCoordinates,
2775  const double Tolerance = std::numeric_limits<double>::epsilon()
2776  ) const
2777  {
2778  return ClosestPointGlobalToLocalSpace(rPointGlobalCoordinates, rClosestPointLocalCoordinates, Tolerance);
2779  }
2780 
2793  const CoordinatesArrayType& rPointLocalCoordinates,
2794  CoordinatesArrayType& rClosestPointLocalCoordinates,
2795  const double Tolerance = std::numeric_limits<double>::epsilon()
2796  ) const
2797  {
2798  // 1. Make projection on geometry
2799  const int projection_result = ProjectionPointLocalToLocalSpace(
2800  rPointLocalCoordinates,
2801  rClosestPointLocalCoordinates,
2802  Tolerance);
2803 
2804  if (projection_result == 1) {
2805  // 2. If projection converged check if solution lays
2806  // within the boundaries of this geometry
2807  // Returns either 0, 1 or 2
2808  // Or -1 if IsInsideLocalSpace failed
2809  return IsInsideLocalSpace(
2810  rClosestPointLocalCoordinates,
2811  Tolerance);
2812  } else {
2813  // Projection failed
2814  return -1;
2815  }
2816  }
2817 
2830  const CoordinatesArrayType& rPointGlobalCoordinates,
2831  CoordinatesArrayType& rClosestPointLocalCoordinates,
2832  const double Tolerance = std::numeric_limits<double>::epsilon()
2833  ) const
2834  {
2835  // 1. Make projection on geometry
2836  const int projection_result = ProjectionPointGlobalToLocalSpace(
2837  rPointGlobalCoordinates,
2838  rClosestPointLocalCoordinates,
2839  Tolerance);
2840 
2841  if (projection_result == 1) {
2842  // 2. If projection converged check if solution lays
2843  // within the boundaries of this geometry
2844  // Returns either 0, 1 or 2
2845  // Or -1 if IsInsideLocalSpace failed
2846  return IsInsideLocalSpace(
2847  rClosestPointLocalCoordinates,
2848  Tolerance);
2849  } else {
2850  // Projection failed
2851  return -1;
2852  }
2853  }
2854 
2867  virtual double CalculateDistance(
2868  const CoordinatesArrayType& rPointGlobalCoordinates,
2869  const double Tolerance = std::numeric_limits<double>::epsilon()
2870  ) const
2871  {
2872  CoordinatesArrayType local_coordinates(ZeroVector(3));
2873  if (ClosestPointGlobalToLocalSpace(rPointGlobalCoordinates, local_coordinates, Tolerance) < 1) {
2874  // If projection fails, double::max will be returned
2876  }
2877 
2878  // Global coordinates of projected point
2879  CoordinatesArrayType global_coordinates(ZeroVector(3));
2880  this->GlobalCoordinates(global_coordinates, local_coordinates);
2881 
2882  // Distance to projected point
2883  return norm_2(rPointGlobalCoordinates - global_coordinates);
2884  }
2885 
2889 
2902  {
2903  Jacobian( rResult, mpGeometryData->DefaultIntegrationMethod() );
2904  return rResult;
2905  }
2906 
2922  IntegrationMethod ThisMethod ) const
2923  {
2924  if( rResult.size() != this->IntegrationPointsNumber( ThisMethod ) )
2925  rResult.resize( this->IntegrationPointsNumber( ThisMethod ), false );
2926 
2927  for ( unsigned int pnt = 0; pnt < this->IntegrationPointsNumber( ThisMethod ); pnt++ ) {
2928  this->Jacobian( rResult[pnt], pnt, ThisMethod);
2929  }
2930 
2931  return rResult;
2932  }
2933 
2951  virtual JacobiansType& Jacobian( JacobiansType& rResult, IntegrationMethod ThisMethod, Matrix & DeltaPosition ) const
2952  {
2953  if( rResult.size() != this->IntegrationPointsNumber( ThisMethod ) )
2954  rResult.resize( this->IntegrationPointsNumber( ThisMethod ), false );
2955 
2956  for ( unsigned int pnt = 0; pnt < this->IntegrationPointsNumber( ThisMethod ); pnt++ ) {
2957  this->Jacobian( rResult[pnt], pnt, ThisMethod, DeltaPosition);
2958  }
2959  return rResult;
2960  }
2961 
2976  Matrix& Jacobian( Matrix& rResult, IndexType IntegrationPointIndex ) const
2977  {
2978  Jacobian( rResult, IntegrationPointIndex, mpGeometryData->DefaultIntegrationMethod() );
2979  return rResult;
2980  }
2981 
2999  virtual Matrix& Jacobian( Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const
3000  {
3001  const SizeType working_space_dimension = this->WorkingSpaceDimension();
3002  const SizeType local_space_dimension = this->LocalSpaceDimension();
3003  if(rResult.size1() != working_space_dimension || rResult.size2() != local_space_dimension)
3004  rResult.resize( working_space_dimension, local_space_dimension, false );
3005 
3006  const Matrix& r_shape_functions_gradient_in_integration_point = ShapeFunctionsLocalGradients( ThisMethod )[ IntegrationPointIndex ];
3007 
3008  rResult.clear();
3009  const SizeType points_number = this->PointsNumber();
3010  for (IndexType i = 0; i < points_number; ++i ) {
3011  const array_1d<double, 3>& r_coordinates = (*this)[i].Coordinates();
3012  for(IndexType k = 0; k< working_space_dimension; ++k) {
3013  const double value = r_coordinates[k];
3014  for(IndexType m = 0; m < local_space_dimension; ++m) {
3015  rResult(k,m) += value * r_shape_functions_gradient_in_integration_point(i,m);
3016  }
3017  }
3018  }
3019 
3020  return rResult;
3021  }
3022 
3043  virtual Matrix& Jacobian( Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod, const Matrix& rDeltaPosition ) const
3044  {
3045  const SizeType working_space_dimension = this->WorkingSpaceDimension();
3046  const SizeType local_space_dimension = this->LocalSpaceDimension();
3047  if(rResult.size1() != working_space_dimension || rResult.size2() != local_space_dimension)
3048  rResult.resize( working_space_dimension, local_space_dimension, false );
3049 
3050  const Matrix& r_shape_functions_gradient_in_integration_point = ShapeFunctionsLocalGradients( ThisMethod )[ IntegrationPointIndex ];
3051 
3052  rResult.clear();
3053  const SizeType points_number = this->PointsNumber();
3054  for (IndexType i = 0; i < points_number; ++i ) {
3055  const array_1d<double, 3>& r_coordinates = (*this)[i].Coordinates();
3056  for(IndexType k = 0; k< working_space_dimension; ++k) {
3057  const double value = r_coordinates[k] - rDeltaPosition(i,k);
3058  for(IndexType m = 0; m < local_space_dimension; ++m) {
3059  rResult(k,m) += value * r_shape_functions_gradient_in_integration_point(i,m);
3060  }
3061  }
3062  }
3063 
3064  return rResult;
3065  }
3066 
3078  virtual Matrix& Jacobian( Matrix& rResult, const CoordinatesArrayType& rCoordinates ) const
3079  {
3080  const SizeType working_space_dimension = this->WorkingSpaceDimension();
3081  const SizeType local_space_dimension = this->LocalSpaceDimension();
3082  const SizeType points_number = this->PointsNumber();
3083  if(rResult.size1() != working_space_dimension || rResult.size2() != local_space_dimension)
3084  rResult.resize( working_space_dimension, local_space_dimension, false );
3085 
3086  Matrix shape_functions_gradients(points_number, local_space_dimension);
3087  ShapeFunctionsLocalGradients( shape_functions_gradients, rCoordinates );
3088 
3089  rResult.clear();
3090  for (IndexType i = 0; i < points_number; ++i ) {
3091  const array_1d<double, 3>& r_coordinates = (*this)[i].Coordinates();
3092  for(IndexType k = 0; k< working_space_dimension; ++k) {
3093  const double value = r_coordinates[k];
3094  for(IndexType m = 0; m < local_space_dimension; ++m) {
3095  rResult(k,m) += value * shape_functions_gradients(i,m);
3096  }
3097  }
3098  }
3099 
3100  return rResult;
3101  }
3102 
3118  virtual Matrix& Jacobian( Matrix& rResult, const CoordinatesArrayType& rCoordinates, Matrix& rDeltaPosition ) const
3119  {
3120  const SizeType working_space_dimension = this->WorkingSpaceDimension();
3121  const SizeType local_space_dimension = this->LocalSpaceDimension();
3122  const SizeType points_number = this->PointsNumber();
3123  if(rResult.size1() != working_space_dimension || rResult.size2() != local_space_dimension)
3124  rResult.resize( working_space_dimension, local_space_dimension, false );
3125 
3126  Matrix shape_functions_gradients(points_number, local_space_dimension);
3127  ShapeFunctionsLocalGradients( shape_functions_gradients, rCoordinates );
3128 
3129  rResult.clear();
3130  for (IndexType i = 0; i < points_number; ++i ) {
3131  const array_1d<double, 3>& r_coordinates = (*this)[i].Coordinates();
3132  for(IndexType k = 0; k< working_space_dimension; ++k) {
3133  const double value = r_coordinates[k] - rDeltaPosition(i,k);
3134  for(IndexType m = 0; m < local_space_dimension; ++m) {
3135  rResult(k,m) += value * shape_functions_gradients(i,m);
3136  }
3137  }
3138  }
3139 
3140  return rResult;
3141  }
3142 
3155  {
3156  DeterminantOfJacobian( rResult, mpGeometryData->DefaultIntegrationMethod() );
3157  return rResult;
3158  }
3159 
3171  virtual Vector& DeterminantOfJacobian( Vector& rResult, IntegrationMethod ThisMethod ) const
3172  {
3173  if( rResult.size() != this->IntegrationPointsNumber( ThisMethod ) )
3174  rResult.resize( this->IntegrationPointsNumber( ThisMethod ), false );
3175 
3177  for ( unsigned int pnt = 0; pnt < this->IntegrationPointsNumber( ThisMethod ); pnt++ ) {
3178  this->Jacobian( J, pnt, ThisMethod);
3179  rResult[pnt] = MathUtils<double>::GeneralizedDet(J);
3180  }
3181  return rResult;
3182  }
3183 
3200  double DeterminantOfJacobian( IndexType IntegrationPointIndex ) const
3201  {
3202  return DeterminantOfJacobian( IntegrationPointIndex, mpGeometryData->DefaultIntegrationMethod() );
3203  }
3204 
3223  virtual double DeterminantOfJacobian( IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const
3224  {
3226  this->Jacobian( J, IntegrationPointIndex, ThisMethod);
3228  }
3229 
3230 
3243  virtual double DeterminantOfJacobian( const CoordinatesArrayType& rPoint ) const
3244  {
3246  this->Jacobian( J, rPoint);
3248  }
3249 
3250 
3263  {
3264  InverseOfJacobian( rResult, mpGeometryData->DefaultIntegrationMethod() );
3265  return rResult;
3266  }
3267 
3282  virtual JacobiansType& InverseOfJacobian( JacobiansType& rResult, IntegrationMethod ThisMethod ) const
3283  {
3284  Jacobian(rResult, ThisMethod); //this will be overwritten
3285 
3286  double detJ;
3287  Matrix Jinv(this->LocalSpaceDimension(), this->WorkingSpaceDimension());
3288  for ( unsigned int pnt = 0; pnt < this->IntegrationPointsNumber( ThisMethod ); pnt++ ) {
3289  MathUtils<double>::GeneralizedInvertMatrix(rResult[pnt], Jinv, detJ);
3290  noalias(rResult[pnt]) = Jinv;
3291  }
3292  return rResult;
3293  }
3294 
3309  Matrix& InverseOfJacobian( Matrix& rResult, IndexType IntegrationPointIndex ) const
3310  {
3311  InverseOfJacobian( rResult, IntegrationPointIndex, mpGeometryData->DefaultIntegrationMethod() );
3312  return rResult;
3313  }
3314 
3332  virtual Matrix& InverseOfJacobian( Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const
3333  {
3334  Jacobian(rResult,IntegrationPointIndex, ThisMethod); //this will be overwritten
3335 
3336  double detJ;
3337  Matrix Jinv(this->WorkingSpaceDimension(), this->WorkingSpaceDimension());
3338 
3339  MathUtils<double>::GeneralizedInvertMatrix(rResult, Jinv, detJ);
3340  noalias(rResult) = Jinv;
3341 
3342  return rResult;
3343  }
3344 
3356  virtual Matrix& InverseOfJacobian( Matrix& rResult, const CoordinatesArrayType& rCoordinates ) const
3357  {
3358  Jacobian(rResult,rCoordinates); //this will be overwritten
3359 
3360  double detJ;
3361  Matrix Jinv(this->WorkingSpaceDimension(), this->WorkingSpaceDimension());
3362 
3363  MathUtils<double>::GeneralizedInvertMatrix(rResult, Jinv, detJ);
3364  noalias(rResult) = Jinv;
3365 
3366  return rResult;
3367  }
3368 
3369 
3370 
3374 
3394  {
3395  return mpGeometryData->ShapeFunctionsValues();
3396  }
3397 
3412  virtual Vector& ShapeFunctionsValues (Vector &rResult, const CoordinatesArrayType& rCoordinates) const
3413  {
3414  KRATOS_ERROR << "Calling base class ShapeFunctionsValues method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3415  return rResult;
3416  }
3417 
3438  const Matrix& ShapeFunctionsValues( IntegrationMethod ThisMethod ) const
3439  {
3440  return mpGeometryData->ShapeFunctionsValues( ThisMethod );
3441  }
3442 
3465  double ShapeFunctionValue( IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex ) const
3466  {
3467  return mpGeometryData->ShapeFunctionValue( IntegrationPointIndex, ShapeFunctionIndex );
3468  }
3469 
3492  double ShapeFunctionValue( IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex, IntegrationMethod ThisMethod ) const
3493  {
3494  return mpGeometryData->ShapeFunctionValue( IntegrationPointIndex, ShapeFunctionIndex, ThisMethod );
3495  }
3496 
3512  virtual double ShapeFunctionValue( IndexType ShapeFunctionIndex, const CoordinatesArrayType& rCoordinates ) const
3513  {
3514  KRATOS_ERROR << "Calling base class ShapeFunctionValue method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3515 
3516  return 0;
3517  }
3518 
3540  {
3541  return mpGeometryData->ShapeFunctionsLocalGradients();
3542  }
3543 
3566  {
3567  return mpGeometryData->ShapeFunctionsLocalGradients( ThisMethod );
3568  }
3569 
3592  const Matrix& ShapeFunctionLocalGradient( IndexType IntegrationPointIndex ) const
3593  {
3594  return mpGeometryData->ShapeFunctionLocalGradient( IntegrationPointIndex );
3595  }
3596 
3620  const Matrix& ShapeFunctionLocalGradient(IndexType IntegrationPointIndex , IntegrationMethod ThisMethod) const
3621  {
3622  return mpGeometryData->ShapeFunctionLocalGradient(IntegrationPointIndex, ThisMethod);
3623  }
3624 
3625  const Matrix& ShapeFunctionLocalGradient(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex, IntegrationMethod ThisMethod) const
3626  {
3627  return mpGeometryData->ShapeFunctionLocalGradient(IntegrationPointIndex, ShapeFunctionIndex, ThisMethod);
3628  }
3629 
3630 
3642  virtual Matrix& ShapeFunctionsLocalGradients( Matrix& rResult, const CoordinatesArrayType& rPoint ) const
3643  {
3644  KRATOS_ERROR << "Calling base class ShapeFunctionsLocalGradients method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3645  return rResult;
3646  }
3647 
3648  /*
3649  * @brief access to the shape function derivatives.
3650  * @param DerivativeOrderIndex defines the wanted order of the derivative
3651  * 0 is NOT accessible
3652  * @param IntegrationPointIndex the corresponding contorl point of this geometry
3653  * @return the shape function derivative matrix.
3654  * The matrix is structured: (derivative dN_de / dN_du , the corresponding node)
3655  */
3657  IndexType DerivativeOrderIndex,
3658  IndexType IntegrationPointIndex,
3659  IntegrationMethod ThisMethod) const
3660  {
3661  return mpGeometryData->ShapeFunctionDerivatives(
3662  DerivativeOrderIndex, IntegrationPointIndex, ThisMethod);
3663  }
3664 
3665  /*
3666  * @brief access to the shape function derivatives.
3667  * @param DerivativeOrderIndex defines the wanted order of the derivative
3668  * 0 is NOT accessible
3669  * @param IntegrationPointIndex the corresponding contorl point of this geometry
3670  * @return the shape function derivative matrix.
3671  * The matrix is structured: (derivative dN_de / dN_du , the corresponding node)
3672  */
3674  IndexType DerivativeOrderIndex,
3675  IndexType IntegrationPointIndex) const
3676  {
3677  return mpGeometryData->ShapeFunctionDerivatives(
3678  DerivativeOrderIndex, IntegrationPointIndex, GetDefaultIntegrationMethod());
3679  }
3680 
3689  {
3690  KRATOS_ERROR << "Calling base class ShapeFunctionsSecondDerivatives method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3691  return rResult;
3692  }
3693 
3702  {
3703  KRATOS_ERROR << "Calling base class ShapeFunctionsThirdDerivatives method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3704  return rResult;
3705  }
3706 
3707 
3709  {
3711  }
3712 
3714  ShapeFunctionsGradientsType& rResult,
3715  IntegrationMethod ThisMethod ) const
3716  {
3717  //check that current geometry can perform this operation
3719  << "\'ShapeFunctionsIntegrationPointsGradients\' is not defined for current geometry type as gradients are only defined in the local space." << std::endl;
3720 
3721  const unsigned int integration_points_number = this->IntegrationPointsNumber( ThisMethod );
3722 
3723  if ( integration_points_number == 0 )
3724  KRATOS_ERROR << "This integration method is not supported" << *this << std::endl;
3725 
3726  if ( rResult.size() != integration_points_number )
3727  rResult.resize( this->IntegrationPointsNumber( ThisMethod ), false );
3728 
3729  //calculating the local gradients
3730  const ShapeFunctionsGradientsType& DN_De = ShapeFunctionsLocalGradients( ThisMethod );
3731 
3732  //loop over all integration points
3733  Matrix Jinv(this->LocalSpaceDimension(), this->WorkingSpaceDimension());
3734  for ( unsigned int pnt = 0; pnt < integration_points_number; pnt++ ) {
3735  if (rResult[pnt].size1() != (*this).size() || rResult[pnt].size2() != this->LocalSpaceDimension())
3736  rResult[pnt].resize( (*this).size(), this->LocalSpaceDimension(), false );
3737  this->InverseOfJacobian(Jinv,pnt, ThisMethod);
3738  noalias(rResult[pnt]) = prod( DN_De[pnt], Jinv );
3739  }
3740  }
3741 
3743  ShapeFunctionsGradientsType& rResult,
3744  Vector& rDeterminantsOfJacobian,
3745  IntegrationMethod ThisMethod ) const
3746  {
3747  //check that current geometry can perform this operation
3749  << "\'ShapeFunctionsIntegrationPointsGradients\' is not defined for current geometry type as gradients are only defined in the local space." << std::endl;
3750 
3751  const unsigned int integration_points_number = this->IntegrationPointsNumber( ThisMethod );
3752 
3753  if ( integration_points_number == 0 )
3754  KRATOS_ERROR << "This integration method is not supported " << *this << std::endl;
3755 
3756  if ( rResult.size() != integration_points_number )
3757  rResult.resize( this->IntegrationPointsNumber( ThisMethod ), false );
3758  if (rDeterminantsOfJacobian.size() != integration_points_number)
3759  rDeterminantsOfJacobian.resize(this->IntegrationPointsNumber(ThisMethod), false);
3760 
3761  //calculating the local gradients
3762  const ShapeFunctionsGradientsType& DN_De = ShapeFunctionsLocalGradients( ThisMethod );
3763 
3764  //loop over all integration points
3766  Matrix Jinv(this->LocalSpaceDimension(), this->WorkingSpaceDimension());
3767  double DetJ;
3768  for ( unsigned int pnt = 0; pnt < integration_points_number; pnt++ ) {
3769  if (rResult[pnt].size1() != (*this).size() || rResult[pnt].size2() != this->LocalSpaceDimension())
3770  rResult[pnt].resize( (*this).size(), this->LocalSpaceDimension(), false );
3771  this->Jacobian(J,pnt, ThisMethod);
3773  noalias(rResult[pnt]) = prod( DN_De[pnt], Jinv );
3774  rDeterminantsOfJacobian[pnt] = DetJ;
3775  }
3776  }
3777 
3778  KRATOS_DEPRECATED_MESSAGE("This is signature of \'ShapeFunctionsIntegrationPointsGradients\' is legacy (use any of the alternatives without shape functions calculation).")
3780  ShapeFunctionsGradientsType& rResult,
3781  Vector& rDeterminantsOfJacobian,
3782  IntegrationMethod ThisMethod,
3783  Matrix& ShapeFunctionsIntegrationPointsValues) const
3784  {
3785 
3786  ShapeFunctionsIntegrationPointsGradients(rResult, rDeterminantsOfJacobian, ThisMethod);
3787  ShapeFunctionsIntegrationPointsValues = ShapeFunctionsValues(ThisMethod);
3788  }
3789 
3790  virtual int Check() const
3791  {
3792  KRATOS_TRY
3793 
3794  return 0;
3795 
3796  KRATOS_CATCH("")
3797  }
3798 
3802 
3804  virtual std::string Info() const
3805  {
3806  std::stringstream buffer;
3807  buffer << "Geometry # "
3808  << std::to_string(mId) << ": "
3809  << LocalSpaceDimension() << "-dimensional geometry in "
3810  << WorkingSpaceDimension() << "D space";
3811 
3812  return buffer.str();
3813  }
3814 
3816  virtual std::string Name() const {
3817  std::string geometryName = "BaseGeometry";
3818  KRATOS_ERROR << "Base geometry does not have a name." << std::endl;
3819  return geometryName;
3820  }
3821 
3823  virtual void PrintInfo(std::ostream& rOStream) const
3824  {
3825  rOStream << Info();
3826  }
3827 
3829  virtual void PrintName(std::ostream& rOstream) const {
3830  rOstream << Name() << std::endl;
3831  }
3832 
3834  virtual void PrintData(std::ostream& rOStream) const
3835  {
3836  if (mpGeometryData) {
3837  mpGeometryData->PrintData(rOStream);
3838  }
3839 
3840  rOStream << std::endl;
3841  rOStream << std::endl;
3842 
3843  for (unsigned int i = 0; i < this->size(); ++i) {
3844  rOStream << "\tPoint " << i + 1 << "\t : ";
3845  if (mPoints(i) != nullptr) {
3846  mPoints[i].PrintData(rOStream);
3847  } else {
3848  rOStream << "point is empty (nullptr)." << std::endl;
3849  }
3850  rOStream << std::endl;
3851  }
3852 
3853  if (AllPointsAreValid()) {
3854  rOStream << "\tCenter\t : ";
3855  Center().PrintData(rOStream);
3856  }
3857 
3858  rOStream << std::endl;
3859  rOStream << std::endl;
3860  }
3861 
3862 
3866 
3868 
3869 protected:
3872 
3878  void SetGeometryData(GeometryData const* pGeometryData)
3879  {
3880  mpGeometryData = pGeometryData;
3881  }
3882 
3886 
3888 
3899  virtual double InradiusToCircumradiusQuality() const {
3900  KRATOS_ERROR << "Calling base class 'InradiusToCircumradiusQuality' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3901  return 0.0;
3902  }
3903 
3914  virtual double AreaToEdgeLengthRatio() const {
3915  KRATOS_ERROR << "Calling base class 'AreaToEdgeLengthRatio' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3916  return 0.0;
3917  }
3918 
3929  virtual double ShortestAltitudeToEdgeLengthRatio() const {
3930  KRATOS_ERROR << "Calling base class 'ShortestAltitudeToEdgeLengthRatio' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3931  return 0.0;
3932  }
3933 
3944  virtual double InradiusToLongestEdgeQuality() const {
3945  KRATOS_ERROR << "Calling base class 'InradiusToLongestEdgeQuality' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3946  return 0.0;
3947  }
3948 
3959  virtual double ShortestToLongestEdgeQuality() const {
3960  KRATOS_ERROR << "Calling base class 'ShortestToLongestEdgeQuality' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3961  return 0.0;
3962  }
3963 
3975  virtual double RegularityQuality() const {
3976  KRATOS_ERROR << "Calling base class 'RegularityQuality' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3977  return 0.0;
3978  }
3979 
3991  virtual double VolumeToSurfaceAreaQuality() const {
3992  KRATOS_ERROR << "Calling base class 'VolumeToSurfaceAreaQuality' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
3993  return 0.0;
3994  }
3995 
4007  virtual double VolumeToEdgeLengthQuality() const {
4008  KRATOS_ERROR << "Calling base class 'VolumeToEdgeLengthQuality' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
4009  return 0.0;
4010  }
4011 
4023  virtual double VolumeToAverageEdgeLength() const {
4024  KRATOS_ERROR << "Calling base class 'VolumeToAverageEdgeLength' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
4025  return 0.0;
4026  }
4027 
4040  virtual double VolumeToRMSEdgeLength() const {
4041  KRATOS_ERROR << "Calling base class 'VolumeToRMSEdgeLength' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
4042  return 0.0;
4043  }
4044 
4051  virtual double MinDihedralAngle() const {
4052  KRATOS_ERROR << "Calling base class 'MinDihedralAngle' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
4053  return 0.0;
4054  }
4055 
4062  virtual double MaxDihedralAngle() const {
4063  KRATOS_ERROR << "Calling base class 'MaxDihedralAngle' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
4064  return 0.0;
4065  }
4066 
4073  virtual double MinSolidAngle() const {
4074  KRATOS_ERROR << "Calling base class 'MinSolidAngle' method instead of derived class one. Please check the definition of derived class. " << *this << std::endl;
4075  return 0.0;
4076  }
4077 
4081 
4085 
4093  bool AllPointsAreValid() const
4094  {
4095  return std::none_of(mPoints.ptr_begin(), mPoints.ptr_end(), [](const auto& pPoint){return pPoint == nullptr;});
4096  }
4097 
4101 
4107 private:
4110 
4111  IndexType mId;
4112 
4113  GeometryData const* mpGeometryData;
4114 
4115  static const GeometryDimension msGeometryDimension;
4116 
4117  PointsArrayType mPoints;
4118 
4119  DataValueContainer mData;
4120 
4121 
4125 
4127  IndexType GenerateSelfAssignedId() const
4128  {
4129  // Create id hash from provided name.
4130  IndexType id = reinterpret_cast<IndexType>(this);
4131 
4132  // Sets second bit to zero.
4133  SetIdSelfAssigned(id);
4134 
4135  // Sets first bit to zero.
4136  SetIdNotGeneratedFromString(id);
4137 
4138  return id;
4139  }
4140 
4142  static inline bool IsIdGeneratedFromString(IndexType Id)
4143  {
4144  return Id & (IndexType(1) << (sizeof(IndexType) * 8 - 1));
4145  }
4146 
4148  static inline void SetIdGeneratedFromString(IndexType& Id)
4149  {
4150  Id |= (IndexType(1) << (sizeof(IndexType) * 8 - 1));
4151  }
4152 
4154  static inline void SetIdNotGeneratedFromString(IndexType& Id)
4155  {
4156  Id &= ~(IndexType(1) << (sizeof(IndexType) * 8 - 1));
4157  }
4158 
4160  static inline bool IsIdSelfAssigned(IndexType Id)
4161  {
4162  return Id & (IndexType(1) << (sizeof(IndexType) * 8 - 2));
4163  }
4164 
4166  static inline void SetIdSelfAssigned(IndexType& Id)
4167  {
4168  Id |= (IndexType(1) << (sizeof(IndexType) * 8 - 2));
4169  }
4170 
4172  static inline void SetIdNotSelfAssigned(IndexType& Id)
4173  {
4174  Id &= ~(IndexType(1) << (sizeof(IndexType) * 8 - 2));
4175  }
4176 
4180 
4181  friend class Serializer;
4182 
4183  virtual void save( Serializer& rSerializer ) const
4184  {
4185  rSerializer.save("Id", mId);
4186  rSerializer.save( "Points", mPoints);
4187  rSerializer.save("Data", mData);
4188  }
4189 
4190  virtual void load( Serializer& rSerializer )
4191  {
4192  rSerializer.load("Id", mId);
4193  rSerializer.load( "Points", mPoints );
4194  rSerializer.load("Data", mData);
4195  }
4196 
4200 
4202  void SetIdWithoutCheck(const IndexType Id)
4203  {
4204  mId = Id;
4205  }
4206 
4207  static const GeometryData& GeometryDataInstance()
4208  {
4209  IntegrationPointsContainerType integration_points = {};
4210  ShapeFunctionsValuesContainerType shape_functions_values = {};
4211  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients = {};
4212  static GeometryData s_geometry_data(
4215  integration_points,
4216  shape_functions_values,
4217  shape_functions_local_gradients);
4218 
4219  return s_geometry_data;
4220  }
4221 
4222 
4226 
4227 
4231 
4232 
4236 
4237  template<class TOtherPointType> friend class Geometry;
4238 
4242 
4243 
4245 
4246 }; // Class Geometry
4247 
4249 
4252 
4253 
4257 
4258 
4260 template<class TPointType>
4261 inline std::istream& operator >> ( std::istream& rIStream,
4262  Geometry<TPointType>& rThis );
4263 
4265 template<class TPointType>
4266 inline std::ostream& operator << ( std::ostream& rOStream,
4267  const Geometry<TPointType>& rThis )
4268 {
4269  rThis.PrintInfo( rOStream );
4270  rOStream << std::endl;
4271  rThis.PrintData( rOStream );
4272 
4273  return rOStream;
4274 }
4275 
4277 
4278 template<class TPointType>
4279 const GeometryDimension Geometry<TPointType>::msGeometryDimension(3, 3);
4280 
4281 } // namespace Kratos.
Container for storing data values associated with variables.
Definition: data_value_container.h:63
bool Has(const Variable< TDataType > &rThisVariable) const
Checks if the data container has a value associated with a given variable.
Definition: data_value_container.h:382
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
Definition: geometry_data.h:60
GeometryShapeFunctionContainer< IntegrationMethod >::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry_data.h:202
const ShapeFunctionsGradientsType & ShapeFunctionsLocalGradients() const
Definition: geometry_data.h:607
double ShapeFunctionValue(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex) const
Definition: geometry_data.h:550
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex) const
Definition: geometry_data.h:660
KratosGeometryType
Definition: geometry_data.h:110
SizeType LocalSpaceDimension() const
Definition: geometry_data.h:387
SizeType IntegrationPointsNumber() const
Definition: geometry_data.h:430
IntegrationMethod
Definition: geometry_data.h:76
bool HasIntegrationMethod(IntegrationMethod ThisMethod) const
Definition: geometry_data.h:407
SizeType WorkingSpaceDimension() const
Definition: geometry_data.h:374
const Matrix & ShapeFunctionsValues() const
Definition: geometry_data.h:497
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry_data.h:731
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry_data.h:457
KratosGeometryFamily
Definition: geometry_data.h:91
const Matrix & ShapeFunctionDerivatives(IndexType DerivativeOrderIndex, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry_data.h:705
IntegrationMethod DefaultIntegrationMethod() const
Definition: geometry_data.h:425
Definition: geometry_dimension.h:42
Geometry base class.
Definition: geometry.h:71
virtual GeometriesArrayType GenerateEdges() const
This method gives you all edges of this geometry.
Definition: geometry.h:2119
virtual GeometriesArrayType GenerateFaces() const
Returns all faces of the current geometry.
Definition: geometry.h:2184
virtual int ProjectionPoint(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rProjectedPointGlobalCoordinates, CoordinatesArrayType &rProjectedPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Projects a certain point on the geometry, or finds the closest point, depending on the provided initi...
Definition: geometry.h:2618
TPointType & operator[](const SizeType &i)
Definition: geometry.h:441
virtual Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const
Definition: geometry.h:3412
virtual void Calculate(const Variable< int > &rVariable, int &rOutput) const
Calculate with int.
Definition: geometry.h:698
virtual void Assign(const Variable< bool > &rVariable, const bool Input)
Assign with bool.
Definition: geometry.h:649
virtual int ClosestPointGlobalToLocalSpace(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rClosestPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Calculates the closes point projection This method calculates the closest point projection of a point...
Definition: geometry.h:2829
SizeType PointsNumber() const
Definition: geometry.h:528
PointPointerType & operator()(const SizeType &i)
Definition: geometry.h:451
virtual double InradiusToCircumradiusQuality() const
Quality functions.
Definition: geometry.h:3899
PointsArrayType::ptr_const_iterator ptr_const_iterator
Definition: geometry.h:217
void SetValue(const TVariableType &rThisVariable, typename TVariableType::Type const &rValue)
Definition: geometry.h:617
virtual int IsInsideLocalSpace(const CoordinatesArrayType &rPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Checks if given point in local space coordinates of this geometry is inside the geometry boundaries.
Definition: geometry.h:1946
const PointPointerType ConstPointPointerType
Definition: geometry.h:207
PointerVector< GeometryType > GeometriesArrayType
Definition: geometry.h:127
void push_back(PointPointerType x)
Definition: geometry.h:548
virtual void SetGeometryShapeFunctionContainer(const GeometryShapeFunctionContainer< GeometryData::IntegrationMethod > &rGeometryShapeFunctionContainer)
Definition: geometry.h:951
virtual bool HasGeometryPart(const IndexType Index) const
Use to check if certain Indexed object is within the geometry parts of this geometry.
Definition: geometry.h:1155
TPointType PointType
Definition: geometry.h:131
static bool HasSameGeometryType(const GeometryType &rLHS, const GeometryType &rRHS)
Checks if two GeometryType have the same geometry type.
Definition: geometry.h:762
void GlobalCoordinates(CoordinatesArrayType &rResult, IndexType IntegrationPointIndex) const
Definition: geometry.h:2399
virtual Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rCoordinates, Matrix &rDeltaPosition) const
Definition: geometry.h:3118
virtual void Calculate(const Variable< Matrix > &rVariable, Matrix &rOutput) const
Calculate with Matrix.
Definition: geometry.h:728
void SetId(const IndexType Id)
Sets Id of this Geometry.
Definition: geometry.h:982
virtual double MinSolidAngle() const
Definition: geometry.h:4073
virtual void BoundingBox(TPointType &rLowPoint, TPointType &rHighPoint) const
Calculates the boundingbox of the geometry.
Definition: geometry.h:1484
virtual void Assign(const Variable< Vector > &rVariable, const Vector &rInput)
Assign with Vector.
Definition: geometry.h:679
virtual Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const
Definition: geometry.h:3642
virtual bool IsSymmetric() const
Definition: geometry.h:2023
virtual Matrix & InverseOfJacobian(Matrix &rResult, const CoordinatesArrayType &rCoordinates) const
Definition: geometry.h:3356
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry.h:3834
Pointer Create(const std::string &rNewGeometryName, PointsArrayType const &rThisPoints) const
Creates a new geometry pointer.
Definition: geometry.h:855
SizeType size() const
Definition: geometry.h:518
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
virtual double MaxEdgeLength() const
Definition: geometry.h:1404
static IndexType GenerateId(const std::string &rName)
Gets the corresponding hash-Id to a string name.
Definition: geometry.h:1004
virtual ShapeFunctionsThirdDerivativesType & ShapeFunctionsThirdDerivatives(ShapeFunctionsThirdDerivativesType &rResult, const CoordinatesArrayType &rPoint) const
Definition: geometry.h:3701
friend class Geometry
Definition: geometry.h:4237
bool IsIdSelfAssigned()
Returns if id was generated by itself.
Definition: geometry.h:976
virtual int ProjectionPointLocalToLocalSpace(const CoordinatesArrayType &rPointLocalCoordinates, CoordinatesArrayType &rProjectionPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Projects a point onto the geometry Projects a certain point on the geometry, or finds the closest poi...
Definition: geometry.h:2646
virtual double Length() const
Definition: geometry.h:1332
GeometryData::ShapeFunctionsSecondDerivativesType ShapeFunctionsSecondDerivativesType
Definition: geometry.h:195
virtual CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, CoordinatesArrayType const &LocalCoordinates) const
Definition: geometry.h:2377
virtual void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult, IntegrationMethod ThisMethod) const
Definition: geometry.h:3713
DenseVector< double > NormalType
Definition: geometry.h:203
virtual double InradiusToLongestEdgeQuality() const
Definition: geometry.h:3944
virtual Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const
Creates a new geometry pointer.
Definition: geometry.h:841
void swap(GeometryType &rOther)
Definition: geometry.h:543
virtual void GlobalSpaceDerivatives(std::vector< CoordinatesArrayType > &rGlobalSpaceDerivatives, IndexType IntegrationPointIndex, const SizeType DerivativeOrder) const
This method maps from dimension space to working space and computes the number of derivatives at the ...
Definition: geometry.h:2533
PointsArrayType::iterator iterator
PointsArrayType typedefs.
Definition: geometry.h:213
virtual void Assign(const Variable< array_1d< double, 6 >> &rVariable, const array_1d< double, 6 > &rInput)
Assign with array_1d<double, 6>
Definition: geometry.h:674
const_iterator end() const
Definition: geometry.h:477
virtual double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rCoordinates) const
Definition: geometry.h:3512
virtual int Check() const
Definition: geometry.h:3790
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
virtual double Inradius() const
Definition: geometry.h:1441
virtual GeometriesArrayType GenerateBoundariesEntities() const
This method gives you all boundaries entities of this geometry.
Definition: geometry.h:2040
DataValueContainer & GetData()
Definition: geometry.h:591
virtual array_1d< double, 3 > Normal(const CoordinatesArrayType &rPointLocalCoordinates) const
It returns a vector that is normal to its corresponding geometry in the given local point.
Definition: geometry.h:1543
ConstPointReferenceType front() const
Definition: geometry.h:502
virtual GeometryType & GetGeometryParent(IndexType Index) const
Some geometries require relations to other geometries. This is the case for e.g. quadrature points....
Definition: geometry.h:1029
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
SizeType IntegrationPointsNumber(IntegrationMethod ThisMethod) const
Definition: geometry.h:2270
Geometry(IndexType GeometryId, const PointsArrayType &ThisPoints, GeometryData const *pThisGeometryData=&GeometryDataInstance())
Definition: geometry.h:314
virtual double MinEdgeLength() const
Definition: geometry.h:1391
void clear()
Definition: geometry.h:553
static bool IsSame(const GeometryType &rLHS, const GeometryType &rRHS)
Checks if two GeometryType are the same.
Definition: geometry.h:781
const ShapeFunctionsGradientsType & ShapeFunctionsLocalGradients(IntegrationMethod ThisMethod) const
Definition: geometry.h:3565
virtual void PrintName(std::ostream &rOstream) const
Print name.
Definition: geometry.h:3829
virtual JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const
Definition: geometry.h:2921
virtual void Assign(const Variable< array_1d< double, 2 >> &rVariable, const array_1d< double, 2 > &rInput)
Assign with array_1d<double, 2>
Definition: geometry.h:664
virtual double CalculateDistance(const CoordinatesArrayType &rPointGlobalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Computes the distance between an point in global coordinates and the closest point of this geometry....
Definition: geometry.h:2867
void SetGeometryData(GeometryData const *pGeometryData)
updates the pointer to GeometryData of the respective geometry.
Definition: geometry.h:3878
SizeType LocalSpaceDimension() const
Definition: geometry.h:1300
PointPointerContainerType & GetContainer()
‍** Gives a reference to underly normal container. *‍/
Definition: geometry.h:573
virtual double MinDihedralAngle() const
Definition: geometry.h:4051
double ShapeFunctionValue(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex, IntegrationMethod ThisMethod) const
Definition: geometry.h:3492
virtual bool HasIntersection(const GeometryType &ThisGeometry) const
Definition: geometry.h:1453
TPointType & PointReferenceType
Definition: geometry.h:208
virtual void Calculate(const Variable< bool > &rVariable, bool &rOutput) const
Calculate with bool.
Definition: geometry.h:693
virtual double MaxDihedralAngle() const
Definition: geometry.h:4062
Geometry(const PointsArrayType &ThisPoints, GeometryData const *pThisGeometryData=&GeometryDataInstance())
Definition: geometry.h:305
const Matrix & ShapeFunctionsValues() const
Definition: geometry.h:3393
const_iterator begin() const
Definition: geometry.h:469
Geometry(const std::string &GeometryName, const PointsArrayType &ThisPoints, GeometryData const *pThisGeometryData=&GeometryDataInstance())
Definition: geometry.h:324
virtual void RemoveGeometryPart(const IndexType Index)
Removes a geometry part.
Definition: geometry.h:1142
virtual void Assign(const Variable< double > &rVariable, const double Input)
Assign with double.
Definition: geometry.h:659
virtual Pointer Create(const GeometryType &rGeometry) const
Creates a new geometry pointer.
Definition: geometry.h:870
virtual SizeType NumberOfGeometryParts() const
Definition: geometry.h:1164
virtual double AreaToEdgeLengthRatio() const
Definition: geometry.h:3914
std::size_t SizeType
Definition: geometry.h:144
virtual void RemoveGeometryPart(GeometryType::Pointer pGeometry)
Removes a geometry part.
Definition: geometry.h:1132
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
virtual void ComputeDihedralAngles(Vector &rDihedralAngles) const
Definition: geometry.h:1743
std::size_t IndexType
Definition: geometry.h:137
std::array< Matrix, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Definition: geometry.h:172
virtual double VolumeToEdgeLengthQuality() const
Definition: geometry.h:4007
virtual JacobiansType & InverseOfJacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const
Definition: geometry.h:3282
virtual const GeometryType::Pointer pGetGeometryPart(const IndexType Index) const
Used for composite geometries. It returns the const pointer of a geometry part, corresponding to the ...
Definition: geometry.h:1098
ConstPointReferenceType back() const
Definition: geometry.h:512
bool HasIntegrationMethod(IntegrationMethod ThisMethod) const
Definition: geometry.h:1995
Geometry< TPointType > GeometryType
This Geometry type.
Definition: geometry.h:78
virtual JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod, Matrix &DeltaPosition) const
Definition: geometry.h:2951
double DeterminantOfJacobian(IndexType IntegrationPointIndex) const
Definition: geometry.h:3200
virtual GeometryType & GetGeometryPart(const IndexType Index)
Used for composite geometries. It returns the the geometry part, corresponding to the Index.
Definition: geometry.h:1060
virtual int ClosestPointLocalToLocalSpace(const CoordinatesArrayType &rPointLocalCoordinates, CoordinatesArrayType &rClosestPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Calculates the closes point projection This method calculates the closest point projection of a point...
Definition: geometry.h:2792
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
ptr_const_iterator ptr_begin() const
Definition: geometry.h:485
virtual Pointer Create(const IndexType NewGeometryId, const GeometryType &rGeometry) const
Creates a new geometry pointer.
Definition: geometry.h:898
virtual std::string Info() const
Return geometry information as a string.
Definition: geometry.h:3804
Vector & DeterminantOfJacobian(Vector &rResult) const
Definition: geometry.h:3154
double ShapeFunctionValue(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex) const
Definition: geometry.h:3465
bool empty() const
Definition: geometry.h:799
bool IsIdGeneratedFromString()
Returns if id was generated from a geometry name.
Definition: geometry.h:970
static bool HasSameType(const GeometryType &rLHS, const GeometryType &rRHS)
Checks if two GeometryType have the same type.
Definition: geometry.h:740
Geometry(const Geometry &rOther)
Copy constructor.
Definition: geometry.h:343
JacobiansType & InverseOfJacobian(JacobiansType &rResult) const
Definition: geometry.h:3262
virtual void SetGeometryPart(const IndexType Index, GeometryType::Pointer pGeometry)
Allows to exchange certain geometries.
Definition: geometry.h:1109
virtual void Calculate(const Variable< array_1d< double, 2 >> &rVariable, array_1d< double, 2 > &rOutput) const
Calculate with array_1d<double, 2>
Definition: geometry.h:708
virtual double RegularityQuality() const
Definition: geometry.h:3975
virtual int ClosestPoint(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rClosestPointGlobalCoordinates, CoordinatesArrayType &rClosestPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Returns all coordinates of the closest point on the geometry given to an arbitrary point in global co...
Definition: geometry.h:2704
static bool HasSameGeometryType(const GeometryType *rLHS, const GeometryType *rRHS)
Checks if two GeometryType have the same geometry type (pointer version)
Definition: geometry.h:770
PointsArrayType::const_iterator const_iterator
Definition: geometry.h:214
virtual SizeType PolynomialDegree(IndexType LocalDirectionIndex) const
Return polynomial degree of the geometry in a certain direction.
Definition: geometry.h:1310
virtual double ShortestAltitudeToEdgeLengthRatio() const
Definition: geometry.h:3929
virtual void SetGeometryParent(GeometryType *pGeometryParent)
Some geometries require relations to other geometries. This is the case for e.g. quadrature points....
Definition: geometry.h:1042
virtual void CreateQuadraturePointGeometries(GeometriesArrayType &rResultGeometries, IndexType NumberOfShapeFunctionDerivatives, const IntegrationPointsArrayType &rIntegrationPoints, IntegrationInfo &rIntegrationInfo)
Definition: geometry.h:2331
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex, IndexType ShapeFunctionIndex, IntegrationMethod ThisMethod) const
Definition: geometry.h:3625
ptr_const_iterator ptr_end() const
Definition: geometry.h:493
virtual ~Geometry()
Destructor. Do nothing!!!
Definition: geometry.h:374
virtual Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod, const Matrix &rDeltaPosition) const
Definition: geometry.h:3043
virtual GeometryType::Pointer pGetGeometryPart(const IndexType Index)
Used for composite geometries. It returns the pointer of a geometry part, corresponding to the Index.
Definition: geometry.h:1084
virtual void NodesInFaces(DenseMatrix< unsigned int > &rNodesInFaces) const
Definition: geometry.h:2195
static bool IsSame(const GeometryType *rLHS, const GeometryType *rRHS)
Checks if two GeometryType are the same (pointer version)
Definition: geometry.h:792
virtual double ShortestToLongestEdgeQuality() const
Definition: geometry.h:3959
ConstPointPointerType & operator()(const SizeType &i) const
Definition: geometry.h:456
virtual double AverageEdgeLength() const
Definition: geometry.h:1417
virtual int ClosestPointLocalCoordinates(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rClosestPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Returns local coordinates of the closest point on the geometry given to an arbitrary point in global ...
Definition: geometry.h:2772
const PointPointerContainerType & GetContainer() const
Definition: geometry.h:579
virtual void SpansLocalSpace(std::vector< double > &rSpans, IndexType LocalDirectionIndex=0) const
Definition: geometry.h:1972
virtual double VolumeToRMSEdgeLength() const
Definition: geometry.h:4040
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: geometry.h:3823
TPointType const & operator[](const SizeType &i) const
Definition: geometry.h:446
GeometryData const & GetGeometryData() const
GeometryData contains all information about dimensions and has a set of precomputed values for integr...
Definition: geometry.h:942
virtual bool IsInside(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Checks if given point in global space coordinates is inside the geometry boundaries....
Definition: geometry.h:1918
virtual double Volume() const
This method calculate and return volume of this geometry.
Definition: geometry.h:1358
virtual void Calculate(const Variable< Vector > &rVariable, Vector &rOutput) const
Calculate with Vector.
Definition: geometry.h:723
KRATOS_DEPRECATED_MESSAGE("This is legacy version (use GenerateFaces instead)") virtual GeometriesArrayType Faces(void)
Returns all faces of the current geometry.
Definition: geometry.h:2166
Geometry(const std::string &GeometryName)
Standard Constructor with a Name.
Definition: geometry.h:241
const TPointType & ConstPointReferenceType
Definition: geometry.h:209
void reserve(int dim)
Definition: geometry.h:558
virtual CoordinatesArrayType & PointLocalCoordinates(CoordinatesArrayType &rResult, const CoordinatesArrayType &rPoint) const
Returns the local coordinates of a given arbitrary point.
Definition: geometry.h:1854
iterator begin()
Definition: geometry.h:465
PointerVector< TPointType > PointsArrayType
Definition: geometry.h:118
TPointType & GetPoint(const int Index)
Definition: geometry.h:1830
virtual void CreateQuadraturePointGeometries(GeometriesArrayType &rResultGeometries, IndexType NumberOfShapeFunctionDerivatives, IntegrationInfo &rIntegrationInfo)
Definition: geometry.h:2352
virtual Matrix & InverseOfJacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry.h:3332
virtual array_1d< double, 3 > UnitNormal(IndexType IntegrationPointIndex) const
It returns the normalized normal vector in the given integration point.
Definition: geometry.h:1657
virtual int ProjectionPointGlobalToLocalSpace(const CoordinatesArrayType &rPointGlobalCoordinates, CoordinatesArrayType &rProjectionPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const
Projects a point onto the geometry Projects a certain point on the geometry, or finds the closest poi...
Definition: geometry.h:2673
DenseVector< Matrix > JacobiansType
Definition: geometry.h:183
virtual double DeterminantOfJacobian(const CoordinatesArrayType &rPoint) const
Definition: geometry.h:3243
SizeType max_size() const
Definition: geometry.h:538
virtual GeometriesArrayType GeneratePoints() const
This method gives you all points of this geometry.
Definition: geometry.h:2062
const Matrix & ShapeFunctionDerivatives(IndexType DerivativeOrderIndex, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry.h:3656
const PointsArrayType & Points() const
Definition: geometry.h:1768
virtual array_1d< double, 3 > Normal(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
It returns the vector, which is normal to its corresponding geometry in the given integration point.
Definition: geometry.h:1596
PointsArrayType::difference_type difference_type
Definition: geometry.h:218
Geometry()
Standard Constructor. Generates self assigned id.
Definition: geometry.h:227
virtual void NumberNodesInFaces(DenseVector< unsigned int > &rNumberNodesInFaces) const
Definition: geometry.h:2190
static constexpr IndexType BACKGROUND_GEOMETRY_INDEX
Definition: geometry.h:220
QualityCriteria
Definition: geometry.h:86
double Quality(const QualityCriteria qualityCriteria) const
Definition: geometry.h:1704
IntegrationMethod GetDefaultIntegrationMethod() const
Definition: geometry.h:2004
KRATOS_CLASS_POINTER_DEFINITION(Geometry)
Pointer definition of Geometry.
virtual void ComputeSolidAngles(Vector &rSolidAngles) const
Definition: geometry.h:1753
PointsArrayType & Points()
Definition: geometry.h:1779
virtual SizeType PointsNumberInDirection(IndexType LocalDirectionIndex) const
Returns number of points per direction.
Definition: geometry.h:533
virtual double VolumeToSurfaceAreaQuality() const
Definition: geometry.h:3991
void SetData(DataValueContainer const &rThisData)
Definition: geometry.h:601
virtual const GeometryType & GetGeometryPart(const IndexType Index) const
Used for composite geometries. It returns the the geometry part, corresponding to the Index.
Definition: geometry.h:1072
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
Geometry(IndexType GeomertyId)
Standard Constructor with a geometry Id.
Definition: geometry.h:234
std::array< IntegrationPointsArrayType, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry.h:167
ptr_iterator ptr_begin()
Definition: geometry.h:481
void GlobalCoordinates(CoordinatesArrayType &rResult, IndexType IntegrationPointIndex, const IntegrationMethod ThisMethod) const
This method provides the global coordinates to the corresponding integration point.
Definition: geometry.h:2414
virtual Matrix & PointsLocalCoordinates(Matrix &rResult) const
Definition: geometry.h:1842
iterator end()
Definition: geometry.h:473
std::vector< PointPointerType > PointPointerContainerType
Definition: geometry.h:210
LumpingMethods
This defines the different methods to compute the lumping methods.
Definition: geometry.h:109
void ClonePoints()
Definition: geometry.h:926
Geometry & operator=(Geometry< TOtherPointType > const &rOther)
Definition: geometry.h:420
int capacity()
Definition: geometry.h:563
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex) const
Definition: geometry.h:3592
Matrix & InverseOfJacobian(Matrix &rResult, IndexType IntegrationPointIndex) const
Definition: geometry.h:3309
virtual SizeType EdgesNumber() const
This method gives you number of all edges of this geometry.
Definition: geometry.h:2092
void SetId(const std::string &rName)
Sets Id with the use of the name of this geometry.
Definition: geometry.h:998
GeometryData::ShapeFunctionsThirdDerivativesType ShapeFunctionsThirdDerivativesType
Definition: geometry.h:199
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult) const
Definition: geometry.h:3708
virtual array_1d< double, 3 > UnitNormal(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
It returns the normalized normal vector in the given integration point.
Definition: geometry.h:1671
virtual void Assign(const Variable< array_1d< double, 3 >> &rVariable, const array_1d< double, 3 > &rInput)
Assign with array_1d<double, 3>
Definition: geometry.h:669
virtual double Circumradius() const
Definition: geometry.h:1429
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometry.h:627
virtual Vector & DeterminantOfJacobian(Vector &rResult, IntegrationMethod ThisMethod) const
Definition: geometry.h:3171
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
virtual SizeType FacesNumber() const
Returns the number of faces of the current geometry.
Definition: geometry.h:2152
TVariableType::Type const & GetValue(const TVariableType &rThisVariable) const
Definition: geometry.h:633
PointReferenceType front()
Definition: geometry.h:497
static bool HasSameType(const GeometryType *rLHS, const GeometryType *rRHS)
Checks if two GeometryType have the same type (pointer version)
Definition: geometry.h:751
Geometry(Geometry< TOtherPointType > const &rOther)
Copy constructor with TOtherPointType.
Definition: geometry.h:365
virtual void CreateIntegrationPoints(IntegrationPointsArrayType &rIntegrationPoints, IntegrationInfo &rIntegrationInfo) const
Definition: geometry.h:2305
virtual double VolumeToAverageEdgeLength() const
Definition: geometry.h:4023
GeometryData::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: geometry.h:189
virtual void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult, Vector &rDeterminantsOfJacobian, IntegrationMethod ThisMethod) const
Definition: geometry.h:3742
const ShapeFunctionsGradientsType & ShapeFunctionsLocalGradients() const
Definition: geometry.h:3539
ptr_iterator ptr_end()
Definition: geometry.h:489
virtual Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry.h:2999
virtual IndexType AddGeometryPart(GeometryType::Pointer pGeometry)
Allows to enhance the coupling geometry, with another geometry.
Definition: geometry.h:1122
virtual void Assign(const Variable< Matrix > &rVariable, const Matrix &rInput)
Assign with Matrix.
Definition: geometry.h:684
const Matrix & ShapeFunctionsValues(IntegrationMethod ThisMethod) const
Definition: geometry.h:3438
virtual GeometryData::KratosGeometryType GetGeometryType() const
Definition: geometry.h:381
virtual Pointer Create(PointsArrayType const &rThisPoints) const
Creates a new geometry pointer.
Definition: geometry.h:813
virtual Point Center() const
Definition: geometry.h:1514
PointsArrayType::ptr_iterator ptr_iterator
Definition: geometry.h:216
PointType::Pointer PointPointerType
data type stores in this container.
Definition: geometry.h:206
JacobiansType & Jacobian(JacobiansType &rResult) const
Definition: geometry.h:2901
PointType::CoordinatesArrayType CoordinatesArrayType
Definition: geometry.h:147
virtual Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rCoordinates) const
Definition: geometry.h:3078
virtual std::string Name() const
Returns name.
Definition: geometry.h:3816
IntegrationPoint< 3 > IntegrationPointType
Definition: geometry.h:154
PointReferenceType back()
Definition: geometry.h:507
virtual void Assign(const Variable< int > &rVariable, const int Input)
Assign with int.
Definition: geometry.h:654
virtual void Calculate(const Variable< array_1d< double, 3 >> &rVariable, array_1d< double, 3 > &rOutput) const
Calculate with array_1d<double, 3>
Definition: geometry.h:713
virtual bool HasIntersection(const Point &rLowPoint, const Point &rHighPoint) const
Definition: geometry.h:1467
virtual GeometryData::KratosGeometryFamily GetGeometryFamily() const
Definition: geometry.h:376
const Matrix & ShapeFunctionDerivatives(IndexType DerivativeOrderIndex, IndexType IntegrationPointIndex) const
Definition: geometry.h:3673
virtual IntegrationInfo GetDefaultIntegrationInfo() const
Provides the default integration per geometry.
Definition: geometry.h:2010
SizeType WorkingSpaceDimension() const
Definition: geometry.h:1287
virtual double DomainSize() const
This method calculate and return length, area or volume of this geometry depending to it's dimension.
Definition: geometry.h:1371
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
bool Has(const Variable< TDataType > &rThisVariable) const
Definition: geometry.h:609
const Matrix & ShapeFunctionLocalGradient(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry.h:3620
virtual double DeterminantOfJacobian(IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const
Definition: geometry.h:3223
virtual array_1d< double, 3 > Normal(IndexType IntegrationPointIndex) const
It returns the vector, which is normal to its corresponding geometry in the given integration point f...
Definition: geometry.h:1582
const IntegrationPointsArrayType & IntegrationPoints(IntegrationMethod ThisMethod) const
Definition: geometry.h:2297
virtual void Calculate(const Variable< double > &rVariable, double &rOutput) const
Calculate with double.
Definition: geometry.h:703
Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex) const
Definition: geometry.h:2976
SizeType IntegrationPointsNumber() const
Definition: geometry.h:2257
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
Pointer Create(const std::string &rNewGeometryName, const GeometryType &rGeometry) const
Creates a new geometry pointer.
Definition: geometry.h:914
virtual CoordinatesArrayType & GlobalCoordinates(CoordinatesArrayType &rResult, CoordinatesArrayType const &LocalCoordinates, Matrix &DeltaPosition) const
Definition: geometry.h:2435
virtual ShapeFunctionsSecondDerivativesType & ShapeFunctionsSecondDerivatives(ShapeFunctionsSecondDerivativesType &rResult, const CoordinatesArrayType &rPoint) const
Definition: geometry.h:3688
TPointType::Pointer pGetPoint(const int Index)
Definition: geometry.h:1803
virtual double Area() const
This method calculate and return area or surface area of this geometry depending to it's dimension.
Definition: geometry.h:1345
virtual void Calculate(const Variable< array_1d< double, 6 >> &rVariable, array_1d< double, 6 > &rOutput) const
Calculate with array_1d<double, 6>
Definition: geometry.h:718
DataValueContainer const & GetData() const
Definition: geometry.h:596
virtual void GlobalSpaceDerivatives(std::vector< CoordinatesArrayType > &rGlobalSpaceDerivatives, const CoordinatesArrayType &rLocalCoordinates, const SizeType DerivativeOrder) const
This method maps from dimension space to working space and computes the number of derivatives at the ...
Definition: geometry.h:2473
virtual Vector & LumpingFactors(Vector &rResult, const LumpingMethods LumpingMethod=LumpingMethods::ROW_SUM) const
Lumping factors for the calculation of the lumped mass matrix.
Definition: geometry.h:1181
Definition: geometry_shape_function_container.h:60
Integration information for the creation of integration points.
Definition: integration_info.h:35
IntegrationMethod GetIntegrationMethod(IndexType DimensionIndex) const
Definition: integration_info.cpp:140
Short class definition.
Definition: integration_point.h:52
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
void clear()
Definition: amatrix_interface.h:284
static void GeneralizedInvertMatrix(const TMatrix1 &rInputMatrix, TMatrix2 &rInvertedMatrix, double &rInputMatrixDet, const double Tolerance=ZeroTolerance)
It inverts non square matrices (https://en.wikipedia.org/wiki/Inverse_element#Matrices)
Definition: math_utils.h:274
static T CrossProduct(const T &a, const T &b)
Performs the vector product of the two input vectors a,b.
Definition: math_utils.h:762
static double GeneralizedDet(const TMatrixType &rA)
Calculates the determinant of any matrix (no check performed on matrix size)
Definition: math_utils.h:634
Point class.
Definition: point.h:59
CoordinatesArrayType const & Coordinates() const
Definition: point.h:215
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: point.h:242
void clear()
Definition: pointer_vector.h:309
TContainerType::const_iterator ptr_const_iterator
Definition: pointer_vector.h:96
void swap(PointerVector &rOther)
Definition: pointer_vector.h:265
size_type size() const
Definition: pointer_vector.h:255
int capacity()
Definition: pointer_vector.h:324
ptr_iterator ptr_end()
Definition: pointer_vector.h:209
iterator end()
Definition: pointer_vector.h:177
size_type max_size() const
Definition: pointer_vector.h:260
void reserve(size_type dim)
Definition: pointer_vector.h:319
boost::indirect_iterator< typename TContainerType::const_iterator > const_iterator
Definition: pointer_vector.h:90
reference front()
Definition: pointer_vector.h:234
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector.h:89
reference back()
Definition: pointer_vector.h:244
TContainerType::iterator ptr_iterator
Definition: pointer_vector.h:95
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: pointer_vector.h:374
TContainerType::difference_type difference_type
Definition: pointer_vector.h:99
iterator begin()
Definition: pointer_vector.h:169
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
TContainerType & GetContainer()
Definition: pointer_vector.h:334
bool empty() const
Definition: pointer_vector.h:349
ptr_iterator ptr_begin()
Definition: pointer_vector.h:201
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
Short class definition.
Definition: array_1d.h:61
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
#define KRATOS_WARNING(label)
Definition: logger.h:265
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
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
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
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
int domain_size
Definition: face_heat.py:4
def Index()
Definition: hdf5_io_tools.py:38
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
def load(f)
Definition: ode_solve.py:307
tuple const
Definition: ode_solve.py:403
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
float temp
Definition: rotating_cone.py:85
int m
Definition: run_marine_rain_substepping.py:8
J
Definition: sensitivityMatrix.py:58
N
Definition: sensitivityMatrix.py:29
x
Definition: sensitivityMatrix.py:49
int dim
Definition: sensitivityMatrix.py:25
namespace
Definition: array_1d.h:793
integer i
Definition: TensorModule.f:17