KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
line_3d_n.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: Klaus B. Sautter
11 
12 
13 #if !defined(KRATOS_LINE_3D_N_H_INCLUDED )
14 #define KRATOS_LINE_3D_N_H_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "geometries/geometry.h"
23 
24 
25 namespace Kratos
26 {
27 
30 
34 
38 
42 
46 
52 template<class TPointType>
53 
54 class Line3DN : public Geometry<TPointType>
55 {
56 public:
60 
63 
66 
70 
75 
78  typedef TPointType PointType;
79 
84  typedef typename BaseType::IndexType IndexType;
85 
86 
91  typedef typename BaseType::SizeType SizeType;
92 
97 
103 
110 
116 
121 
126 
132 
138 
142 
147 
151 
152 // Line3DN( const PointType& FirstPoint, const PointType& SecondPoint, const PointType& ThirdPoint )
153 // : BaseType( PointsArrayType(), &msGeometryData )
154 // {
155 // BaseType::Points().push_back( typename PointType::Pointer( new PointType( FirstPoint ) ) );
156 // BaseType::Points().push_back( typename PointType::Pointer( new PointType( SecondPoint ) ) );
157 // BaseType::Points().push_back( typename PointType::Pointer( new PointType( ThirdPoint ) ) );
158 // }
159 
160  /* Line3DN( typename PointType::Pointer pFirstPoint, typename PointType::Pointer pSecondPoint,
161  typename PointType::Pointer pThirdPoint )
162  : BaseType( PointsArrayType(), &msGeometryData )
163  {
164  BaseType::Points().push_back( pFirstPoint );
165  BaseType::Points().push_back( pSecondPoint );
166  BaseType::Points().push_back( pThirdPoint );
167  } */
168 
169  Line3DN( const PointsArrayType& ThisPoints )
170  : BaseType( ThisPoints, &msGeometryData )
171  {
172  //if ( BaseType::PointsNumber() != 3 )
173  // KRATOS_ERROR << "Invalid points number. Expected 3, given " << BaseType::PointsNumber() << std::endl;
174  }
175 
183  Line3DN( Line3DN const& rOther )
184  : BaseType( rOther )
185  {
186  }
187 
198  template<class TOtherPointType> Line3DN( Line3DN<TOtherPointType> const& rOther )
199  : BaseType( rOther )
200  {
201  }
202 
204  ~Line3DN() override {}
205 
206 /* GeometryData::KratosGeometryFamily GetGeometryFamily() const override
207  {
208  return GeometryData::Kratos_Linear;
209  }
210 
211  GeometryData::KratosGeometryType GetGeometryType() const override
212  {
213  return GeometryData::Kratos_Line3DN;
214  } */
215 
219 
230  Line3DN& operator=( const Line3DN& rOther )
231  {
232  BaseType::operator=( rOther );
233  return *this;
234  }
235 
244  template<class TOtherPointType>
246  {
247  BaseType::operator=( rOther );
248  return *this;
249  }
250 
254 
255  typename BaseType::Pointer Create( PointsArrayType const& ThisPoints ) const override
256  {
257  // line 3 conectivities order 1-3-2
258  return typename BaseType::Pointer( new Line3DN( ThisPoints ) );
259  }
260 
261  // Geometry< Point<3> >::Pointer Clone() const override
262  // {
263  // Geometry< Point<3> >::PointsArrayType NewPoints;
264 
265  // //making a copy of the nodes TO POINTS (not Nodes!!!)
266  // for ( IndexType i = 0 ; i < this->size() ; i++ )
267  // {
268  // NewPoints.push_back(Kratos::make_shared< Point<3> >(( *this )[i]));
269  // }
270 
271  // //creating a geometry with the new points
272  // Geometry< Point<3> >::Pointer p_clone( new Line3DN< Point<3> >( NewPoints ) );
273 
274  // return p_clone;
275  // }
276 
277  //lumping factors for the calculation of the lumped mass matrix
279  const typename BaseType::LumpingMethods LumpingMethod) const override
280  {
281  KRATOS_ERROR << "'LumpingFactors' not available for arbitrarty noded line" << std::endl;
282  return rResult;
283  }
284 
288 
301  double Length() const override
302  {
303  const int number_points = BaseType::PointsNumber();
304  const TPointType& point0 = BaseType::GetPoint(0);
305  const TPointType& point1 = BaseType::GetPoint(number_points-1);
306  const double lx = point0.X() - point1.X();
307  const double ly = point0.Y() - point1.Y();
308  const double lz = point0.Z() - point1.Z();
309 
310  const double length = lx * lx + ly * ly + lz * lz;
311 
312  return sqrt( length );
313  }
314 
326  double Area() const override
327  {
328  return Length();
329  }
330 
331 
342  double DomainSize() const override
343  {
344  KRATOS_ERROR << "'DomainSize' not available for arbitrarty noded line" << std::endl;
345  return 0.0;
346  }
347 
356  bool IsInside(
357  const CoordinatesArrayType& rPoint,
358  CoordinatesArrayType& rResult,
359  const double Tolerance = std::numeric_limits<double>::epsilon()
360  ) const override
361  {
362  KRATOS_ERROR << "'IsInside' not available for arbitrarty noded line" << std::endl;
363  return false;
364  }
365 
369 
384  JacobiansType& Jacobian( JacobiansType& rResult, IntegrationMethod ThisMethod ) const override
385  {
386  KRATOS_ERROR << "'Jacobian' not available for arbitrarty noded line" << std::endl;
387  return rResult;
388  }
389 
390 
408  JacobiansType& Jacobian( JacobiansType& rResult, IntegrationMethod ThisMethod, Matrix & DeltaPosition ) const override
409  {
410  KRATOS_ERROR << "'Jacobian' not available for arbitrarty noded line" << std::endl;
411  return rResult;
412  }
413 
430  Matrix& Jacobian( Matrix& rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod ) const override
431  {
432  KRATOS_ERROR << "'Jacobian' not available for arbitrarty noded line" << std::endl;
433  return rResult;
434  }
435 
447  Matrix& Jacobian( Matrix& rResult, const CoordinatesArrayType& rPoint ) const override
448  {
449  KRATOS_ERROR << "'Jacobian' not available for arbitrarty noded line" << std::endl;
450  return rResult;
451  }
452 
464  Vector& DeterminantOfJacobian( Vector& rResult, IntegrationMethod ThisMethod ) const override
465  {
466  KRATOS_ERROR << "Jacobian is not square" << std::endl;
467  return rResult;
468  }
469 
499  JacobiansType& InverseOfJacobian( JacobiansType& rResult, IntegrationMethod ThisMethod ) const override
500  {
501  KRATOS_ERROR << "Jacobian is not square" << std::endl;
502  return rResult;
503  }
504 
522  Matrix& InverseOfJacobian( Matrix& rResult, IndexType IntegrationPointIndex,
523  IntegrationMethod ThisMethod ) const override
524  {
525  KRATOS_ERROR << "Jacobian is not square" << std::endl;
526  return rResult;
527  }
528 
540  Matrix& InverseOfJacobian( Matrix& rResult, const CoordinatesArrayType& rPoint ) const override
541  {
542  KRATOS_ERROR << "Jacobian is not square" << std::endl;
543  return rResult;
544  }
545 
546 
550  SizeType EdgesNumber() const override
551  {
552  return 0;
553  }
554 
555  SizeType FacesNumber() const override
556  {
557  return 0;
558  }
559 
563 
564  double ShapeFunctionValue( IndexType ShapeFunctionIndex,
565  const CoordinatesArrayType& rPoint ) const override
566  {
567  KRATOS_ERROR << "'ShapeFunctionValue' not available for arbitrarty noded line" << std::endl;
568  return 0;
569  }
570 
571 
572 
574  {
575  KRATOS_ERROR << "Jacobian is not square" << std::endl;
576  }
577 
578 
582 
589  std::string Info() const override
590  {
591  return "1 dimensional line with n nodes in 3D space";
592  }
593 
600  void PrintInfo( std::ostream& rOStream ) const override
601  {
602  rOStream << "1 dimensional line with n nodes in 3D space";
603  }
604 
613  void PrintData( std::ostream& rOStream ) const override
614  {
615  BaseType::PrintData( rOStream );
616  }
617 
623  IntegrationMethod ThisMethod )
624  {
625  KRATOS_ERROR << "'ShapeFunctionsLocalGradients' not available for arbitrarty noded line" << std::endl;
626  ShapeFunctionsGradientsType Result( 0 );
627  return Result;
628  }
629 
635  {
636  KRATOS_ERROR << "'ShapeFunctionsLocalGradients' not available for arbitrarty noded line" << std::endl;
637  ShapeFunctionsGradientsType Result( 0 );
638  return Result;
639  }
640 
650  const CoordinatesArrayType& rPoint ) const override
651  {
652  KRATOS_ERROR << "'ShapeFunctionsLocalGradients' not available for arbitrarty noded line" << std::endl;
653  return( rResult );
654  }
655 
661  Matrix& PointsLocalCoordinates( Matrix& rResult ) const override
662  {
663  KRATOS_ERROR << "'PointsLocalCoordinates' not available for arbitrarty noded line" << std::endl;
664  return rResult;
665  }
666 
676  {
677  KRATOS_ERROR << "'ShapeFunctionsGradients' not available for arbitrarty noded line" << std::endl;
678  return rResult;
679  }
680 
684 
685 
687 
688 protected:
691 
692 
696 
697 
701 
702 
706 
707 
711 
712 
716 
717 
721 
722 
724 
725 private:
728 
729  static const GeometryData msGeometryData;
730 
731  static const GeometryDimension msGeometryDimension;
732 
736 
737 
741 
742  friend class Serializer;
743 
744  void save( Serializer& rSerializer ) const override
745  {
747  }
748 
749  void load( Serializer& rSerializer ) override
750  {
752  }
753 
754  Line3DN(): BaseType( PointsArrayType(), &msGeometryData ) {}
755 
756 
760 
761 
765 
766  static Matrix CalculateShapeFunctionsIntegrationPointsValues( typename BaseType::IntegrationMethod ThisMethod )
767  {
768  KRATOS_ERROR << "'CalculateShapeFunctionsIntegrationPointsValues' not available for arbitrarty noded line" << std::endl;
769  Matrix N( 0, 3 );
770  return N;
771  }
772 
773  static ShapeFunctionsGradientsType CalculateShapeFunctionsIntegrationPointsLocalGradients(
774  typename BaseType::IntegrationMethod ThisMethod )
775  {
776  //KRATOS_ERROR << "'CalculateShapeFunctionsIntegrationPointsLocalGradients' not available for arbitrarty noded line" << std::endl;
777  ShapeFunctionsGradientsType DN_De( 0 );
778  return DN_De;
779  }
780 
781  static const IntegrationPointsContainerType AllIntegrationPoints()
782  {
783  //KRATOS_ERROR << "'AllIntegrationPoints' not available for arbitrarty noded line" << std::endl;
784  IntegrationPointsContainerType integration_points;
785  return integration_points;
786  }
787 
788  static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues()
789  {
790  //KRATOS_ERROR << "'AllIntegrationPoints' not available for arbitrarty noded line" << std::endl;
791  ShapeFunctionsValuesContainerType shape_functions_values;
792  return shape_functions_values;
793  }
794 
795  static const ShapeFunctionsLocalGradientsContainerType AllShapeFunctionsLocalGradients()
796  {
797  //KRATOS_ERROR << "'AllShapeFunctionsLocalGradients' not available for arbitrarty noded line" << std::endl;
798  ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients;
799  return shape_functions_local_gradients;
800  }
801 
805 
806 
810 
811 
815 
816  template<class TOtherPointType> friend class Line3DN;
817 
821 
823 
824 }; // Class Geometry
825 
827 
830 
831 
835 
836 
838 template<class TPointType>
839 inline std::istream& operator >> ( std::istream& rIStream,
840  Line3DN<TPointType>& rThis );
841 
843 template<class TPointType>
844 inline std::ostream& operator << ( std::ostream& rOStream,
845  const Line3DN<TPointType>& rThis )
846 {
847  rThis.PrintInfo( rOStream );
848  rOStream << std::endl;
849  rThis.PrintData( rOStream );
850 
851  return rOStream;
852 }
853 
855 
856 
857 template<class TPointType>
858 const GeometryData Line3DN<TPointType>::msGeometryData(
861  Line3DN<TPointType>::AllIntegrationPoints(),
862  Line3DN<TPointType>::AllShapeFunctionsValues(),
863  AllShapeFunctionsLocalGradients() );
864 
865 
866 template<class TPointType>
867 const GeometryDimension Line3DN<TPointType>::msGeometryDimension(3, 1);
868 
869 } // namespace Kratos.
870 
871 #endif // KRATOS_LINE_3D_3_H_INCLUDED defined
Definition: geometry_data.h:60
IntegrationMethod
Definition: geometry_data.h:76
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
std::size_t SizeType
Definition: geometry.h:144
std::size_t IndexType
Definition: geometry.h:137
std::array< Matrix, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> ShapeFunctionsValuesContainerType
Definition: geometry.h:172
std::array< IntegrationPointsArrayType, static_cast< int >GeometryData::IntegrationMethod::NumberOfIntegrationMethods)> IntegrationPointsContainerType
Definition: geometry.h:167
LumpingMethods
This defines the different methods to compute the lumping methods.
Definition: geometry.h:109
TPointType const & GetPoint(const int Index) const
Definition: geometry.h:1816
GeometryData::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: geometry.h:177
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
Short class definition.
Definition: integration_point.h:52
Definition: amatrix_interface.h:41
A arbitrary node 3D line geometry with quadratic shape functions.
Definition: line_3d_n.h:55
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients(IntegrationMethod ThisMethod)
Definition: line_3d_n.h:622
JacobiansType & InverseOfJacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_3d_n.h:499
friend class Line3DN
Definition: line_3d_n.h:816
Line3DN & operator=(Line3DN< TOtherPointType > const &rOther)
Definition: line_3d_n.h:245
BaseType::NormalType NormalType
Definition: line_3d_n.h:141
Matrix & Jacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_3d_n.h:430
Line3DN(Line3DN< TOtherPointType > const &rOther)
Definition: line_3d_n.h:198
BaseType::CoordinatesArrayType CoordinatesArrayType
Definition: line_3d_n.h:146
Line3DN(const PointsArrayType &ThisPoints)
Definition: line_3d_n.h:169
double Area() const override
Definition: line_3d_n.h:326
Line3DN(Line3DN const &rOther)
Definition: line_3d_n.h:183
Matrix & InverseOfJacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_3d_n.h:540
double Length() const override
Definition: line_3d_n.h:301
BaseType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: line_3d_n.h:109
double ShapeFunctionValue(IndexType ShapeFunctionIndex, const CoordinatesArrayType &rPoint) const override
Definition: line_3d_n.h:564
void PrintData(std::ostream &rOStream) const override
Definition: line_3d_n.h:613
BaseType::ShapeFunctionsLocalGradientsContainerType ShapeFunctionsLocalGradientsContainerType
Definition: line_3d_n.h:125
Geometry< TPointType > BaseType
Geometry as base class.
Definition: line_3d_n.h:62
Matrix & Jacobian(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_3d_n.h:447
BaseType::Pointer Create(PointsArrayType const &ThisPoints) const override
Creates a new geometry pointer.
Definition: line_3d_n.h:255
~Line3DN() override
Destructor. Do nothing!!!
Definition: line_3d_n.h:204
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_3d_n.h:573
BaseType::PointsArrayType PointsArrayType
Definition: line_3d_n.h:96
std::string Info() const override
Definition: line_3d_n.h:589
BaseType::SizeType SizeType
Definition: line_3d_n.h:91
Vector & LumpingFactors(Vector &rResult, const typename BaseType::LumpingMethods LumpingMethod) const override
Lumping factors for the calculation of the lumped mass matrix.
Definition: line_3d_n.h:278
BaseType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType
Definition: line_3d_n.h:137
double DomainSize() const override
Definition: line_3d_n.h:342
BaseType::ShapeFunctionsValuesContainerType ShapeFunctionsValuesContainerType
Definition: line_3d_n.h:120
BaseType::JacobiansType JacobiansType
Definition: line_3d_n.h:131
SizeType FacesNumber() const override
Returns the number of faces of the current geometry.
Definition: line_3d_n.h:555
Matrix & PointsLocalCoordinates(Matrix &rResult) const override
Definition: line_3d_n.h:661
BaseType::IntegrationPointsContainerType IntegrationPointsContainerType
Definition: line_3d_n.h:115
BaseType::IndexType IndexType
Definition: line_3d_n.h:84
KRATOS_CLASS_POINTER_DEFINITION(Line3DN)
Pointer definition of Line3DN.
virtual Matrix & ShapeFunctionsGradients(Matrix &rResult, CoordinatesArrayType &rPoint)
Definition: line_3d_n.h:675
bool IsInside(const CoordinatesArrayType &rPoint, CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) const override
Returns whether given arbitrary point is inside the Geometry and the respective local point for the g...
Definition: line_3d_n.h:356
Line3DN & operator=(const Line3DN &rOther)
Definition: line_3d_n.h:230
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod) const override
Definition: line_3d_n.h:384
SizeType EdgesNumber() const override
Definition: line_3d_n.h:550
Matrix & ShapeFunctionsLocalGradients(Matrix &rResult, const CoordinatesArrayType &rPoint) const override
Definition: line_3d_n.h:649
BaseType::GeometriesArrayType GeometriesArrayType
Definition: line_3d_n.h:74
Vector & DeterminantOfJacobian(Vector &rResult, IntegrationMethod ThisMethod) const override
Definition: line_3d_n.h:464
BaseType::IntegrationPointType IntegrationPointType
Definition: line_3d_n.h:102
void PrintInfo(std::ostream &rOStream) const override
Definition: line_3d_n.h:600
Matrix & InverseOfJacobian(Matrix &rResult, IndexType IntegrationPointIndex, IntegrationMethod ThisMethod) const override
Definition: line_3d_n.h:522
GeometryData::IntegrationMethod IntegrationMethod
Definition: line_3d_n.h:69
TPointType PointType
Definition: line_3d_n.h:78
JacobiansType & Jacobian(JacobiansType &rResult, IntegrationMethod ThisMethod, Matrix &DeltaPosition) const override
Definition: line_3d_n.h:408
virtual ShapeFunctionsGradientsType ShapeFunctionsLocalGradients()
Definition: line_3d_n.h:634
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Short class definition.
Definition: array_1d.h:61
#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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
const GeometryData Line3DN< TPointType >::msGeometryData & msGeometryDimension(), Line3DN< 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
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
N
Definition: sensitivityMatrix.py:29