27 #include "utilities/geometry_utilities.h"
57 template<
class TPo
intType>
158 typename PointType::Pointer pPoint1,
159 typename PointType::Pointer pPoint2,
160 typename PointType::Pointer pPoint3,
161 typename PointType::Pointer pPoint4,
162 typename PointType::Pointer pPoint5)
174 :
BaseType( ThisPoints, &msGeometryData )
183 ) :
BaseType( GeometryId, rThisPoints, &msGeometryData)
190 const std::string& rGeometryName,
192 ) :
BaseType(rGeometryName, rThisPoints, &msGeometryData)
267 template<
class TOtherPo
intType>
290 return typename BaseType::Pointer(
new Pyramid3D5( NewGeometryId, rThisPoints ) );
304 auto p_geometry =
typename BaseType::Pointer(
new Pyramid3D5( NewGeometryId, rGeometry.
Points() ) );
305 p_geometry->SetData(rGeometry.
GetData());
456 const double Tolerance = std::numeric_limits<double>::epsilon()
459 if ( std::abs( rPointLocalCoordinates[0] ) <= (1.0 + Tolerance) ) {
460 if ( std::abs( rPointLocalCoordinates[1] ) <= (1.0 + Tolerance) ) {
461 if ( std::abs( rPointLocalCoordinates[2] ) <= (1.0 + Tolerance) ) {
462 if ( (std::abs(rPointLocalCoordinates[0]) +
463 std::abs(rPointLocalCoordinates[1]) +
464 rPointLocalCoordinates[2]) <= (1.0 + Tolerance) ) {
481 if ( rResult.size1() != 5 || rResult.size2() != 3 )
482 rResult.
resize( 5, 3,
false );
484 rResult( 0, 0 ) = -1.0;
485 rResult( 0, 1 ) = -1.0;
486 rResult( 0, 2 ) = -1.0;
488 rResult( 1, 0 ) = +1.0;
489 rResult( 1, 1 ) = -1.0;
490 rResult( 1, 2 ) = -1.0;
492 rResult( 2, 0 ) = +1.0;
493 rResult( 2, 1 ) = +1.0;
494 rResult( 2, 2 ) = -1.0;
496 rResult( 3, 0 ) = -1.0;
497 rResult( 3, 1 ) = +1.0;
498 rResult( 3, 2 ) = -1.0;
500 rResult( 4, 0 ) = 0.0;
501 rResult( 4, 1 ) = 0.0;
502 rResult( 4, 2 ) = +1.0;
524 if(rResult.size() != 5) rResult.
resize(5,
false);
526 for (std::size_t
i=0;
i<5; ++
i) {
545 return ShapeFunctionValueImpl(ShapeFunctionIndex, rPoint);
562 const std::size_t integration_points_number = integration_points.size();
564 const std::size_t points_number = 5;
566 Matrix shape_function_values( integration_points_number, points_number );
569 for (std::size_t pnt = 0; pnt<integration_points_number; ++pnt) {
570 for (std::size_t
i=0;
i<points_number; ++
i) {
571 shape_function_values( pnt,
i ) = ShapeFunctionValueImpl(
i, integration_points[pnt]);
575 return shape_function_values;
590 if(rResult.size1() != this->PointsNumber() || rResult.size2() != this->LocalSpaceDimension())
611 rResult.
resize( 5, 3,
false );
614 rResult( 0, 0 ) = (-0.125) * ( 1 - rPoint[1] ) * ( 1 - rPoint[2] ) ;
615 rResult( 0, 1 ) = (-0.125) * ( 1 - rPoint[0] ) * ( 1 - rPoint[2] ) ;
616 rResult( 0, 2 ) = (-0.125) * ( 1 - rPoint[0] ) * ( 1 - rPoint[1] ) ;
618 rResult( 1, 0 ) = (+0.125) * ( 1 - rPoint[1] ) * ( 1 - rPoint[2] ) ;
619 rResult( 1, 1 ) = (-0.125) * ( 1 + rPoint[0] ) * ( 1 - rPoint[2] ) ;
620 rResult( 1, 2 ) = (-0.125) * ( 1 + rPoint[0] ) * ( 1 - rPoint[1] ) ;
622 rResult( 2, 0 ) = (+0.125) * ( 1 + rPoint[1] ) * ( 1 - rPoint[2] ) ;
623 rResult( 2, 1 ) = (+0.125) * ( 1 + rPoint[0] ) * ( 1 - rPoint[2] ) ;
624 rResult( 2, 2 ) = (-0.125) * ( 1 + rPoint[0] ) * ( 1 + rPoint[1] ) ;
626 rResult( 3, 0 ) = (-0.125) * ( 1 + rPoint[1] ) * ( 1 - rPoint[2] ) ;
627 rResult( 3, 1 ) = (+0.125) * ( 1 - rPoint[0] ) * ( 1 - rPoint[2] ) ;
628 rResult( 3, 2 ) = (-0.125) * ( 1 - rPoint[0] ) * ( 1 + rPoint[1] ) ;
630 rResult( 4, 0 ) = 0.00 ;
631 rResult( 4, 1 ) = 0.00 ;
632 rResult( 4, 2 ) = +0.50 ;
651 const std::size_t integration_points_number = integration_points.size();
657 for (std::size_t pnt = 0; pnt<integration_points_number; ++pnt) {
661 return d_shape_f_values;
682 const double Tolerance = std::numeric_limits<double>::epsilon()
686 const Point point(rPointGlobalCoordinates);
690 if (this->
IsInside(rPointGlobalCoordinates, aux_coordinates, Tolerance)) {
695 std::array<double, 5> distances;
701 const auto min = std::min_element(distances.begin(), distances.end());
715 std::string
Info()
const override
717 return "3 dimensional pyramid with 5 nodes in 3D space";
760 void save(
Serializer& rSerializer )
const override
778 static double ShapeFunctionValueImpl(
782 switch ( ShapeFunctionIndex )
785 return( (0.125) * (1 - rPoint[0]) * (1 - rPoint[1]) * (1 - rPoint[2]) );
787 return( (0.125) * (1 + rPoint[0]) * (1 - rPoint[1]) * (1 - rPoint[2]) );
789 return( (0.125) * (1 + rPoint[0]) * (1 + rPoint[1]) * (1 - rPoint[2]) );
791 return( (0.125) * (1 - rPoint[0]) * (1 + rPoint[1]) * (1 - rPoint[2]) );
793 return( (0.5) * (1 + rPoint[2]) );
795 KRATOS_ERROR <<
"Wrong index of shape function:" << ShapeFunctionIndex << std::endl;
806 Quadrature < PyramidGaussLegendreIntegrationPoints1,
807 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
808 Quadrature < PyramidGaussLegendreIntegrationPoints2,
809 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
810 Quadrature < PyramidGaussLegendreIntegrationPoints3,
811 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
812 Quadrature < PyramidGaussLegendreIntegrationPoints4,
813 3, IntegrationPoint<3> >::GenerateIntegrationPoints(),
814 Quadrature < PyramidGaussLegendreIntegrationPoints5,
815 3, IntegrationPoint<3> >::GenerateIntegrationPoints()
818 return integration_points;
833 return shape_functions_values;
848 return shape_functions_local_gradients;
882 template<
class TPo
intType>
887 template<
class TPo
intType>
892 rOStream << std::endl;
899 template<
class TPo
intType>
const
900 GeometryData Pyramid3D5<TPointType>::msGeometryData(
903 Pyramid3D5<TPointType>::AllIntegrationPoints(),
904 Pyramid3D5<TPointType>::AllShapeFunctionsValues(),
905 AllShapeFunctionsLocalGradients()
908 template<
class TPo
intType>
const
Definition: geometry_data.h:60
KratosGeometryType
Definition: geometry_data.h:110
IntegrationMethod
Definition: geometry_data.h:76
KratosGeometryFamily
Definition: geometry_data.h:91
Definition: geometry_dimension.h:42
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: geometry.h:3834
Geometry & operator=(const Geometry &rOther)
Definition: geometry.h:400
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
DataValueContainer & GetData()
Definition: geometry.h:591
SizeType LocalSpaceDimension() const
Definition: geometry.h:1300
std::size_t SizeType
Definition: geometry.h:144
const TPointType::Pointer pGetPoint(const int Index) const
Definition: geometry.h:1790
std::size_t IndexType
Definition: geometry.h:137
std::array< Matrix, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Definition: geometry.h:172
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
const PointsArrayType & Points() const
Definition: geometry.h:1768
std::array< IntegrationPointsArrayType, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry.h:167
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
static double PointDistanceToTriangle3D(const Point &rTrianglePoint1, const Point &rTrianglePoint2, const Point &rTrianglePoint3, const Point &rPoint)
This function calculates the distance of a 3D point to a 3D triangle.
Definition: geometry_utilities.cpp:172
static double PointDistanceToQuadrilateral3D(const Point &rQuadrilateralPoint1, const Point &rQuadrilateralPoint2, const Point &rQuadrilateralPoint3, const Point &rQuadrilateralPoint4, const Point &rPoint)
This function calculates the distance of a 3D point to a 3D quadrilateral.
Definition: geometry_utilities.cpp:376
Short class definition.
Definition: integration_point.h:52
static double ComputeVolume3DGeometry(const Geometry< TPointType > &rGeometry)
This method calculates and returns the volume of the geometry from a 3D geometry.
Definition: integration_utilities.h:168
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
An two node 3D line geometry with linear shape functions.
Definition: line_3d_2.h:64
Point class.
Definition: point.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void reserve(size_type dim)
Definition: pointer_vector.h:319
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
A five node pyramid geometry with linear shape functions.
Definition: pyramid_3d_5.h:59
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: pyramid_3d_5.h:144
Pyramid3D5(Pyramid3D5 const &rOther)
Definition: pyramid_3d_5.h:205
GeometryData::KratosGeometryType GetGeometryType() const override
Definition: pyramid_3d_5.h:231
Pyramid3D5(typename PointType::Pointer pPoint1, typename PointType::Pointer pPoint2, typename PointType::Pointer pPoint3, typename PointType::Pointer pPoint4, typename PointType::Pointer pPoint5)
Definition: pyramid_3d_5.h:157
Pyramid3D5(const PointsArrayType &ThisPoints)
Definition: pyramid_3d_5.h:173
friend class Pyramid3D5
Definition: pyramid_3d_5.h:865
double CalculateDistance(const CoordinatesArrayType &rPointGlobalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Computes the distance between an point in global coordinates and the closest point of this geometry....
Definition: pyramid_3d_5.h:680
GeometriesArrayType GenerateEdges() const override
This method gives you all edges of this geometry.
Definition: pyramid_3d_5.h:336
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
Definition: pyramid_3d_5.h:542
BaseType::IntegrationPointType IntegrationPointType
Definition: pyramid_3d_5.h:107
Pyramid3D5 & operator=(const Pyramid3D5 &rOther)
Definition: pyramid_3d_5.h:250
Pyramid3D5 & operator=(Pyramid3D5< TOtherPointType > const &rOther)
Definition: pyramid_3d_5.h:268
Triangle3D3< TPointType > FaceType1
Definition: pyramid_3d_5.h:72
Quadrilateral3D4< TPointType > FaceType2
Definition: pyramid_3d_5.h:73
GeometriesArrayType GenerateFaces() const override
Returns all faces of the current geometry.
Definition: pyramid_3d_5.h:386
static ShapeFunctionsGradientsType CalculateShapeFunctionsIntegrationPointsLocalGradients(typename BaseType::IntegrationMethod ThisMethod)
Definition: pyramid_3d_5.h:646
BaseType::SizeType SizeType
Definition: pyramid_3d_5.h:96
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: pyramid_3d_5.h:479
Pyramid3D5(const IndexType GeometryId, const PointsArrayType &rThisPoints)
Constructor with Geometry Id.
Definition: pyramid_3d_5.h:180
GeometryData::KratosGeometryFamily GetGeometryFamily() const override
Definition: pyramid_3d_5.h:226
BaseType::IndexType IndexType
Definition: pyramid_3d_5.h:90
static Matrix CalculateShapeFunctionsIntegrationPointsValues(typename BaseType::IntegrationMethod ThisMethod)
Definition: pyramid_3d_5.h:557
BaseType::PointsArrayType PointsArrayType
Definition: pyramid_3d_5.h:101
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: pyramid_3d_5.h:120
Pyramid3D5(Pyramid3D5< TOtherPointType > const &rOther)
Definition: pyramid_3d_5.h:221
static Matrix & CalculateShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint)
Definition: pyramid_3d_5.h:606
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: pyramid_3d_5.h:114
double Volume() const override
Definition: pyramid_3d_5.h:423
SizeType EdgesNumber() const override
This method gives you number of all edges of this geometry.
Definition: pyramid_3d_5.h:323
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: pyramid_3d_5.h:132
int IsInsideLocalSpace(const CoordinatesArrayType &rPointLocalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Checks if given point in local space coordinates of this geometry is inside the geometry boundaries.
Definition: pyramid_3d_5.h:454
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: pyramid_3d_5.h:585
Pyramid3D5(const std::string &rGeometryName, const PointsArrayType &rThisPoints)
Constructor with Geometry Name.
Definition: pyramid_3d_5.h:189
BaseType::GeometriesArrayType GeometriesArrayType
Definition: pyramid_3d_5.h:150
void PrintInfo(std::ostream &rOStream) const override
Definition: pyramid_3d_5.h:726
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: pyramid_3d_5.h:125
SizeType FacesNumber() const override
Returns the number of faces of the current geometry.
Definition: pyramid_3d_5.h:373
Vector & ShapeFunctionsValues(Vector &rResult, const CoordinatesArrayType &rCoordinates) const override
Definition: pyramid_3d_5.h:522
Geometry< TPointType > BaseType
Geometry as base class.
Definition: pyramid_3d_5.h:66
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: pyramid_3d_5.h:139
BaseType::Pointer Create(const IndexType NewGeometryId, PointsArrayType const &rThisPoints) const override
Creates a new geometry pointer.
Definition: pyramid_3d_5.h:285
Line3D2< TPointType > EdgeType
Definition: pyramid_3d_5.h:71
TPointType PointType
Definition: pyramid_3d_5.h:84
std::string Info() const override
Definition: pyramid_3d_5.h:715
void PrintData(std::ostream &rOStream) const override
Definition: pyramid_3d_5.h:739
KRATOS_CLASS_POINTER_DEFINITION(Pyramid3D5)
Pointer definition of Pyramid3D5.
double DomainSize() const override
Definition: pyramid_3d_5.h:439
GeometryData::IntegrationMethod IntegrationMethod
Definition: pyramid_3d_5.h:80
BaseType::Pointer Create(const IndexType NewGeometryId, const BaseType &rGeometry) const override
Creates a new geometry pointer.
Definition: pyramid_3d_5.h:299
A four node 3D quadrilateral geometry with bi-linear shape functions.
Definition: quadrilateral_3d_4.h:76
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
A three node 3D triangle geometry with linear shape functions.
Definition: triangle_3d_3.h:77
Short class definition.
Definition: array_1d.h:61
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
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
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
const GeometryData Pyramid3D5< TPointType >::msGeometryData & msGeometryDimension(), Pyramid3D5< TPointType >::AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients()
Definition: brep_curve.h:483
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
const GeometryData BrepCurve< TContainerPointType, TContainerPointEmbeddedType >::msGeometryData & msGeometryDimension
Definition: brep_curve.h:483
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307
integer i
Definition: TensorModule.f:17