21 calculate(this->m_options.getInt(
"parametrizationMethod"));
27 size_t n = this->m_mesh.getNumberOfInnerVertices();
28 size_t N = this->m_mesh.getNumberOfVertices();
32 this->initParameterPoints();
38 constructAndSolveEquationSystem(neighbourhood, n, N);
46 std::list<size_t> vertexIndices,
47 size_t from,
size_t to,
54 while(vertexIndices.front() != from)
56 vertexIndices.push_back(vertexIndices.front());
57 vertexIndices.pop_front();
63 for(std::list<size_t>::const_iterator it=vertexIndices.begin();
64 it == vertexIndices.begin() || *std::prev(it) != to;
67 size_t twin = findTwin(*it);
69 m_twins.push_back(std::pair<size_t, size_t>(twin, ++currentNrAllVertices));
71 m_twins.push_back(std::pair<size_t, size_t>(++currentNrAllVertices, twin));
80 gsVertexHandle uMinv0 = this->m_mesh.getVertex(this->m_indicesV0.front());
83 gsVertexHandle uMaxv0 = this->m_mesh.getVertex(this->m_indicesV0.back());
86 gsVertexHandle uMinv1 = this->m_mesh.getVertex(this->m_indicesV1.front());
89 gsVertexHandle uMaxv1 = this->m_mesh.getVertex(this->m_indicesV1.back());
91 const std::list<size_t> vertexIndices = m_overlapHEM.getBoundaryVertexIndices();
92 size_t currentNrAllVertices = this->m_mesh.getNumberOfVertices();
95 constructTwinsBetween(currentNrAllVertices, vertexIndices, uMinv1, uMinv0,
true);
98 constructTwinsBetween(currentNrAllVertices, vertexIndices, uMaxv0, uMaxv1,
false);
106 size_t numTwins = m_twins.size();
112 std::vector<T> lambdas;
115 for (
size_t i = 0; i < n; i++)
118 updateLambdasWithTwins(lambdas, i+1);
120 for (
size_t j = 0; j < N + numTwins; j++)
121 LHS(i, j) = ( i==j ? (T)(1) : -lambdas[j] );
125 for (
size_t i=n; i<N; i++)
128 RHS.row(i) = this->m_parameterPoints[i];
132 for (
size_t i=N; i<N+numTwins; i++)
134 size_t first = m_twins[i-N].first-1;
135 size_t second = m_twins[i-N].second-1;
137 LHS(i, first) = (T)( 1);
138 LHS(i, second) = (T)(-1);
144 gsEigen::PartialPivLU<typename gsMatrix<T>::Base> LU = LHS.partialPivLu();
146 for (
size_t i = 0; i < N; i++)
148 this->m_parameterPoints[i] << sol(i, 0), sol(i, 1);
154 size_t vertexId)
const
156 lambdas.reserve(lambdas.size() + m_twins.size());
157 for(
size_t i=0; i<m_twins.size(); i++)
158 lambdas.push_back(0);
162 bool isRight =
false;
164 for(
auto it=m_twins.begin(); it!=m_twins.end(); ++it)
166 if(it->first == vertexId)
171 else if(it->second == vertexId)
179 for(
size_t i=0; i<m_twins.size(); i++)
181 size_t first=m_twins[i].first-1;
182 size_t second=m_twins[i].second-1;
185 if(isRight && first > second && lambdas[second] != 0)
187 lambdas[first] = lambdas[second];
191 else if(isLeft && first < second && lambdas[first] != 0)
193 lambdas[second] = lambdas[first];
204 std::vector<size_t> left, right;
205 for(
auto it=m_twins.begin(); it!=m_twins.end(); ++it)
207 if(it->first < it->second)
208 left.push_back(it->first);
210 right.push_back(it->second);
219 const std::vector<size_t>& left)
const
224 midMesh.reserve(3 * this->m_mesh.getNumberOfTriangles(), this->m_mesh.getNumberOfTriangles(), 0);
226 for (
size_t i = 0; i < this->m_mesh.getNumberOfTriangles(); i++)
231 std::vector<size_t> lVert, rVert;
232 for (
size_t j = 1; j <= 3; ++j)
234 vInd[j-1] = this->m_mesh.getGlobalVertexIndex(j, i);
235 if(std::find(right.begin(), right.end(), vInd[j-1]) != right.end())
236 rVert.push_back(j-1);
237 if(std::find(left.begin(), left.end(), vInd[j-1]) != left.end())
238 lVert.push_back(j-1);
242 if(lVert.size() > 0 && rVert.size() > 0 && lVert.size() + rVert.size() == 3)
247 for (
size_t j=0; j<3; ++j)
250 if(std::find(rVert.begin(), rVert.end(), j) != rVert.end())
252 mvLft[j] = midMesh.addVertex(vertex[0], vertex[1]);
253 mvRgt[j] = midMesh.addVertex(vertex[0]+(T)(1), vertex[1]);
257 mvLft[j] = midMesh.addVertex(vertex[0]-(T)(1), vertex[1]);
258 mvRgt[j] = midMesh.addVertex(vertex[0], vertex[1]);
261 midMesh.addFace(mvLft[0], mvLft[1], mvLft[2]);
262 midMesh.addFace(mvRgt[0], mvRgt[1], mvRgt[2]);
268 for (
size_t j=0; j<3; ++j)
271 mv[j] = midMesh.addVertex(vertex[0], vertex[1]);
273 midMesh.addFace(mv[0], mv[1], mv[2]);
gsMesh< T > createExtendedFlatMesh(const std::vector< size_t > &right, const std::vector< size_t > &left) const
Definition: gsPeriodicOverlap.hpp:218
Class that maintains neighbourhood information of triangle mesh. Represents the neighbourhood propert...
Definition: gsParametrization.h:285
const Point2D & getParameterPoint(size_t vertexIndex) const
Get parameter point Returns the parameter point with given vertex index.
Definition: gsParametrization.hpp:157
gsMesh< T > createRestrictedFlatMesh() const
Trims the mesh to [0, 1]^2.
Definition: gsPeriodicParametrization.hpp:154
void constructTwins()
Construct the twins.
Definition: gsPeriodicOverlap.hpp:77
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
gsMesh & cleanMesh()
reorders the vertices of all faces of an .stl mesh, such that only 1 vertex is used instead of #(adja...
Definition: gsMesh.hpp:250
const std::vector< T > & getLambdas(const size_t i) const
Get vector of lambdas.
Definition: gsParametrization.hpp:279
gsMesh< T > createFlatMesh() const
Definition: gsPeriodicOverlap.hpp:201
void constructTwinsBetween(size_t ¤tNrAllVertices, std::list< size_t > vertexIndices, size_t from, size_t to, bool rightHandSide)
Definition: gsPeriodicOverlap.hpp:45
void compute()
Computes the periodic parametrization.
Definition: gsPeriodicOverlap.hpp:19
void constructAndSolveEquationSystem(const Neighbourhood &neighbourhood, const size_t n, const size_t N)
Analogous to the overloaded function from the parent class.
Definition: gsPeriodicOverlap.hpp:102
Nested class for plotting flat meshes restricted to [0, 1]^2.
Definition: gsPeriodicParametrization.h:32
A Point in T^d, with an index number.
Definition: gsPoint.h:26
void updateLambdasWithTwins(std::vector< T > &lambdas, size_t vertexId) const
Definition: gsPeriodicOverlap.hpp:153
void calculate(const size_t paraMethod)
Definition: gsPeriodicOverlap.hpp:25
gsVertex class that represents a 3D vertex for a gsMesh.
Definition: gsVertex.h:26