G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsPeriodicStitch.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <gsIO/gsOptionList.h>
19 
20 namespace gismo
21 {
22 
60 template <class T>
61 class GISMO_EXPORT gsPeriodicStitch : public gsPeriodicParametrization<T>
62 {
63 
64 public:
65 
66  typedef memory::shared_ptr<gsPeriodicStitch<T> > uPtr;
67 
68 protected:
69 
77  {
78  public:
80 
88  explicit Neighbourhood(const gsHalfEdgeMesh<T> &meshInfo,
89  const std::vector<size_t>& stitchIndices,
90  gsSparseMatrix<int>& corrections,
91  const size_t parametrizationMethod = 2);
92 
93  protected:
99  std::vector<size_t> computeCorrections(const std::vector<size_t>& stitchIndices,
100  const LocalNeighbourhood& localNeighbourhood) const;
101  };
102 
103 public:
104 
114  explicit gsPeriodicStitch(const gsMesh<T> &mesh,
115  const gsMatrix<T>& verticesV0,
116  const gsMatrix<T>& paramsV0,
117  const gsMatrix<T>& verticesV1,
118  const gsMatrix<T>& paramsV1,
119  const gsMatrix<T>& stitchVertices,
121  : gsPeriodicParametrization<T>(mesh, verticesV0, paramsV0, verticesV1, paramsV1, list),
122  m_stitchIndices(this->indices(stitchVertices))
123  {
124  // Note: m_corrections gets filled later.
125  }
126 
128  void compute();
129 
130 protected:
135  void calculate(const size_t paraMethod);
136 
140  void constructAndSolveEquationSystem(const Neighbourhood &neighbourhood,
141  const size_t n,
142  const size_t N);
143 
144 public:
145 
151  {
152  gsMesh<T> unfolded = createUnfoldedFlatMesh();
153  typename gsPeriodicParametrization<T>::FlatMesh display(unfolded);
154  return display.createRestrictedFlatMesh();
155  }
156 
157 protected:
163  gsMesh<T> createUnfoldedFlatMesh() const;
164 
170  bool isOnStitch(size_t vertexIndex) const
171  {
172  return (std::find(m_stitchIndices.begin(), m_stitchIndices.end(), vertexIndex)
173  != m_stitchIndices.end());
174  }
175 
182  bool edgeIsInCorrections(index_t beg, index_t end) const
183  {
184  return ((m_corrections(beg, end) == 1) ||
185  (m_corrections(beg, end) == -1) ||
186  (m_corrections(end, beg) == 1) ||
187  (m_corrections(end, beg) == -1));
188  // Actually, the first two conditions should be enough.
189  }
190 
191 protected:
192 
199 
200  const std::vector<size_t> m_stitchIndices;
201 };
202 
203 } // namespace gismo
204 
205 #ifndef GISMO_BUILD_LIB
206 #include GISMO_HPP_HEADER(gsPeriodicStitch.hpp)
207 #endif
Class that maintains parametrization This class Parametrization stores the mesh information and the t...
Definition: gsParametrization.h:46
gsPeriodicStitch(const gsMesh< T > &mesh, const gsMatrix< T > &verticesV0, const gsMatrix< T > &paramsV0, const gsMatrix< T > &verticesV1, const gsMatrix< T > &paramsV1, const gsMatrix< T > &stitchVertices, const gsOptionList &list=gsParametrization< T >::defaultOptions())
Definition: gsPeriodicStitch.h:114
Definition: gsPeriodicStitch.h:76
gsSparseMatrix< int > m_corrections
Definition: gsPeriodicStitch.h:198
Class that maintains the local neighbourhood properties.
Definition: gsParametrization.h:127
#define index_t
Definition: gsConfig.h:32
gsMesh< T > createRestrictedFlatMesh() const
Trims the mesh to [0, 1]^2.
Definition: gsPeriodicParametrization.hpp:154
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
const std::vector< size_t > m_stitchIndices
indices of the vertices on the stitch
Definition: gsPeriodicStitch.h:200
Provides a list of labeled parameters/options that can be set and accessed easily.
Definition: gsPeriodicStitch.h:61
Nested class for plotting flat meshes restricted to [0, 1]^2.
Definition: gsPeriodicParametrization.h:32
gsMesh< T > createFlatMesh() const
Definition: gsPeriodicStitch.h:150
bool edgeIsInCorrections(index_t beg, index_t end) const
Definition: gsPeriodicStitch.h:182
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
bool isOnStitch(size_t vertexIndex) const
Definition: gsPeriodicStitch.h:170
Abstract class with the functionality common to gsPeriodicStitch and gsPeriodicOverlap.
gsHalfEdgeMesh is a gsMesh implementation that handles Halfedges
Definition: gsHalfEdgeMesh.h:46