G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsPeriodicStitch.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <gsIO/gsOptionList.h>
19
20namespace gismo
21{
22
60template <class T>
61class GISMO_EXPORT gsPeriodicStitch : public gsPeriodicParametrization<T>
62{
63
64public:
65
66 typedef memory::shared_ptr<gsPeriodicStitch<T> > uPtr;
67
68protected:
69
76 class Neighbourhood : public gsParametrization<T>::Neighbourhood
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
103public:
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
130protected:
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
144public:
145
151 {
152 gsMesh<T> unfolded = createUnfoldedFlatMesh();
153 typename gsPeriodicParametrization<T>::FlatMesh display(unfolded);
154 return display.createRestrictedFlatMesh();
155 }
156
157protected:
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
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
191protected:
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
gsHalfEdgeMesh is a gsMesh implementation that handles Halfedges
Definition gsHalfEdgeMesh.h:47
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class Representing a triangle mesh with 3D vertices.
Definition gsMesh.h:32
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
Class that maintains the local neighbourhood properties.
Definition gsParametrization.h:128
Class that maintains parametrization This class Parametrization stores the mesh information and the t...
Definition gsParametrization.h:47
Nested class for plotting flat meshes restricted to [0, 1]^2.
Definition gsPeriodicParametrization.h:33
gsMesh< T > createRestrictedFlatMesh() const
Trims the mesh to [0, 1]^2.
Definition gsPeriodicParametrization.hpp:154
Definition gsPeriodicStitch.h:77
Definition gsPeriodicStitch.h:62
gsMesh< T > createFlatMesh() const
Definition gsPeriodicStitch.h:150
const std::vector< size_t > m_stitchIndices
indices of the vertices on the stitch
Definition gsPeriodicStitch.h:200
bool edgeIsInCorrections(index_t beg, index_t end) const
Definition gsPeriodicStitch.h:182
bool isOnStitch(size_t vertexIndex) const
Definition gsPeriodicStitch.h:170
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
gsSparseMatrix< int > m_corrections
Definition gsPeriodicStitch.h:198
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
#define index_t
Definition gsConfig.h:32
Provides a list of labeled parameters/options that can be set and accessed easily.
Abstract class with the functionality common to gsPeriodicStitch and gsPeriodicOverlap.
The G+Smo namespace, containing all definitions for the library.