G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsPeriodicParametrization.h
Go to the documentation of this file.
1 
16 #pragma once
17 
19 
20 namespace gismo
21 {
22 
23 template <class T>
24 class gsPeriodicParametrization : public gsParametrization<T>
25 {
26 
27 public:
28 
29  typedef memory::shared_ptr<gsPeriodicParametrization<T> > uPtr;
30 
32  class FlatMesh
33  {
34  typedef typename gsMesh<T>::VertexHandle VertexHandle;
35  public:
36 
39  FlatMesh(const gsMesh<T>& unfolded)
40  : m_unfolded(unfolded)
41  {}
42 
45 
46  protected:
47 
50  real_t correspondingV(const VertexHandle& v0,
51  const VertexHandle& v1,
52  real_t u) const;
53 
59  const VertexHandle& v0,
60  const VertexHandle& v1,
61  const VertexHandle& v2) const;
62 
68  const VertexHandle& v0,
69  const VertexHandle& v1,
70  const VertexHandle& v2) const;
71 
74  const VertexHandle& v0,
75  const VertexHandle& v1,
76  const VertexHandle& v2) const;
77 
78  protected: // members
80  };
81 
82 public:
83 
92  gsPeriodicParametrization(const gsMesh<T>& mesh,
93  const gsMatrix<T>& verticesV0,
94  const gsMatrix<T>& paramsV0,
95  const gsMatrix<T>& verticesV1,
96  const gsMatrix<T>& paramsV1,
98  : gsParametrization<T>(mesh, list),
99  m_paramsV0(paramsV0), m_paramsV1(paramsV1),
100  m_indicesV0(this->indices(verticesV0)),
101  m_indicesV1(this->indices(verticesV1))
102  {
103  GISMO_ASSERT(this->m_paramsV0.rows() == 1, "one row expected in paramsV0");
104  GISMO_ASSERT(this->m_paramsV1.rows() == 1, "one row expected in paramsV1");
105 
106  GISMO_ASSERT(this->m_paramsV0.cols() == static_cast<index_t>(m_indicesV0.size()),
107  "paramsV0 and valuesV0 are required to have the same number of cols");
108  GISMO_ASSERT(this->m_paramsV1.cols() == static_cast<index_t>(m_indicesV1.size()),
109  "paramsV1 and valuesV1 are required to have the same number of cols");
110  }
111 
121  void restrictMatrices(gsMatrix<T>& uv, const gsMatrix<T>& xyz,
122  real_t uMin = 0, real_t uMax = 1) const;
123 
125  virtual void compute() = 0;
126 
127 protected:
128 
133  void initParameterPoints();
134 
135 protected: // members
136 
137  const gsMatrix<T> m_paramsV0;
138  const gsMatrix<T> m_paramsV1;
139  const std::vector<size_t> m_indicesV0;
140  const std::vector<size_t> m_indicesV1;
141 
142 };
143 
144 } // namespace gismo
145 
146 #ifndef GISMO_BUILD_LIB
147 #include GISMO_HPP_HEADER(gsPeriodicParametrization.hpp)
148 #endif
Class that maintains parametrization This class Parametrization stores the mesh information and the t...
Definition: gsParametrization.h:46
real_t correspondingV(const VertexHandle &v0, const VertexHandle &v1, real_t u) const
Definition: gsPeriodicParametrization.hpp:23
gsHalfEdgeMesh< T > m_unfolded
flat mesh possibly intersecting the domain boundaries
Definition: gsPeriodicParametrization.h:79
#define index_t
Definition: gsConfig.h:32
gsMesh< T > createRestrictedFlatMesh() const
Trims the mesh to [0, 1]^2.
Definition: gsPeriodicParametrization.hpp:154
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
void addOneFlatTriangleNotIntersectingBoundary(gsMesh< T > &mesh, const VertexHandle &v0, const VertexHandle &v1, const VertexHandle &v2) const
Adds a flat triangle and shifts it inside the domain if necessary.
Definition: gsPeriodicParametrization.hpp:109
Class that maintains parametrization.
FlatMesh(const gsMesh< T > &unfolded)
Definition: gsPeriodicParametrization.h:39
Nested class for plotting flat meshes restricted to [0, 1]^2.
Definition: gsPeriodicParametrization.h:32
void addThreeFlatTrianglesOneOut(gsMesh< T > &mesh, const VertexHandle &v0, const VertexHandle &v1, const VertexHandle &v2) const
Definition: gsPeriodicParametrization.hpp:38
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
gsHalfEdgeMesh is a gsMesh implementation that handles Halfedges
Definition: gsHalfEdgeMesh.h:46
void addThreeFlatTrianglesTwoOut(gsMesh< T > &mesh, const VertexHandle &v0, const VertexHandle &v1, const VertexHandle &v2) const
Definition: gsPeriodicParametrization.hpp:84
gsVertex class that represents a 3D vertex for a gsMesh.
Definition: gsVertex.h:26