NuTo
Numerics Tool
ElementIga.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
8 
9 namespace NuTo
10 {
11 template <int TDimParameter>
13 {
14 public:
15  ElementIga(const std::array<int, TDimParameter>& knotIDs, const Nurbs<TDimParameter>& NurbsGeometry)
16  : mKnotIDs(knotIDs)
17  , mNurbsGeometry(NurbsGeometry)
18  {
19  }
20 
23  {
24  Eigen::Matrix<double, TDimParameter, 1> coordinateTransformed;
25  std::array<Eigen::Vector2d, TDimParameter> knots = NurbsGeometry().GetKnotVectorElement(mKnotIDs);
26  for (int i = 0; i < TDimParameter; i++)
27  {
28  coordinateTransformed[i] = (knots[i](0) + 0.5 * (ipCoords(i) + 1) * (knots[i](1) - knots[i](0)));
29  }
30  return coordinateTransformed;
31  }
32 
35  virtual Eigen::VectorXd ExtractNodeValues(int instance = 0) const override
36  {
37  return NurbsGeometry().GetControlPointsElement(mKnotIDs, instance);
38  }
39 
40  Eigen::MatrixXd GetNMatrix(NaturalCoords ipCoords) const override
41  {
43  }
44 
45  Eigen::VectorXd GetShapeFunctions(NaturalCoords ipCoords) const override
46  {
47  return NurbsGeometry().BasisFunctionsAndDerivativesRational(0, Transformation(ipCoords));
48  }
49 
50  Eigen::MatrixXd GetDerivativeShapeFunctions(NaturalCoords ipCoords) const override
51  {
52  return NurbsGeometry().BasisFunctionsAndDerivativesRational(1, Transformation(ipCoords));
53  }
54 
55  int GetDofDimension() const override
56  {
57  return NurbsGeometry().GetDimension();
58  }
59 
60  Eigen::VectorXi GetDofNumbering() const override
61  {
62  throw NuTo::Exception(__PRETTY_FUNCTION__, "I honestly have no idea. Sorry.");
63  }
64 
65  int GetNumNodes() const override
66  {
67  return NurbsGeometry().GetNumControlPointsElement();
68  }
69 
70 private:
71  const Nurbs<TDimParameter>& NurbsGeometry() const
72  {
73  return mNurbsGeometry;
74  }
75 
76  std::array<int, TDimParameter> mKnotIDs;
77  std::reference_wrapper<const Nurbs<TDimParameter>> mNurbsGeometry;
78 };
79 } /* NuTo */
Eigen::VectorXd GetShapeFunctions(NaturalCoords ipCoords) const override
Definition: ElementIga.h:45
Base class for all exceptions thrown in NuTo.
Definition: Exception.h:9
int GetNumNodes() const override
Definition: ElementIga.h:65
Class for NURBS curves, with IGA specific functions. NURBS specific algorithms taken from Piegl...
Definition: Nurbs.h:18
Definition: ElementInterface.h:8
Eigen::MatrixXd GetNMatrix(NaturalCoords ipCoords) const override
Definition: ElementIga.h:40
ElementIga(const std::array< int, TDimParameter > &knotIDs, const Nurbs< TDimParameter > &NurbsGeometry)
Definition: ElementIga.h:15
virtual Eigen::VectorXd ExtractNodeValues(int instance=0) const override
extracts all node values of this element
Definition: ElementIga.h:35
int GetDofDimension() const override
Definition: ElementIga.h:55
Definition: ElementIga.h:12
Definition: Exception.h:6
Definition: SerializeStreamOut.h:9
Eigen::MatrixXd GetDerivativeShapeFunctions(NaturalCoords ipCoords) const override
Definition: ElementIga.h:50
Eigen::VectorXi GetDofNumbering() const override
extract the dof numbers from its nodes.
Definition: ElementIga.h:60
Eigen::MatrixXd N(const Eigen::VectorXd &shapeFunctions, int numNodes, int dim)
Definition: Matrix.h:8
Eigen::Matrix< double, TDimParameter, 1 > Transformation(Eigen::VectorXd ipCoords) const
transforms unit interval [-1, 1] to the interval [firstKnotCoordinate, secondKnotCoordinate] ...
Definition: ElementIga.h:22