G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsPeriodicOverlap< T > Class Template Reference

Detailed Description

template<class T>
class gismo::gsPeriodicOverlap< T >

A class for computing periodic parametrizations of closed (cylinder-like) surface meshes. The result will be periodic in the u-direction and the parameter domain will be [0, 1]^2. An alternative implementation is given in gsPeriodicOverlap.

This is the implementation used in the paper L. Groiss, B. Juettler, D. Mokris: 27 variants of Tutte's theorem for plane near-triangulations and an application to periodic spline surface fitting, CAGD, 2021.

Main idea

The user prescribes the u-values of the points on the lower and upper boundaries (i.e., v = 0 and v = 1, respectively). In addition, they are required to provide an overlap mesh: an edge-connected chain of triangles connecting the periodic interface on the bottom and top side of the mesh, which serves as an initial guess for the periodic interface. The triangles corresponding to the overlap are repeated, which allows ``unwrapping" the mesh as.

The equations for the inner vertices (depicted with empty circles in the figure below) are assembled by the methods of the parent class. The vertices from the overlap are set to have their u-coordinate smaller or greater by one than that of their twin, depending on whether they are on the left or the right hand side of the overlap (empty and full squares, respectively).

gsPeriodicOverlap-scheme.png

Inherits gsPeriodicParametrization< T >.

Public Member Functions

void compute ()
 Computes the periodic parametrization.
 
gsMesh< T > createFlatMesh () const
 
gsMatrix< T > createUVmatrix ()
 
gsMatrix< T > createXYZmatrix ()
 
 gsPeriodicOverlap (const gsMesh< T > &mesh, const gsMatrix< T > &verticesV0, const gsMatrix< T > &paramsV0, const gsMatrix< T > &verticesV1, const gsMatrix< T > &paramsV1, const gsMesh< T > &overlap, const gsOptionList &list=gsPeriodicParametrization< T >::defaultOptions())
 
void restrictMatrices (gsMatrix< T > &uv, const gsMatrix< T > &xyz, real_t uMin=0, real_t uMax=1) const
 
void writeTexturedMesh (std::string filename) const
 

Static Public Member Functions

static gsOptionList defaultOptions ()
 Returns the list of default options for gsParametrization.
 

Protected Member Functions

void calculate (const size_t paraMethod)
 
void constructAndSolveEquationSystem (const Neighbourhood &neighbourhood, const size_t n, const size_t N)
 Analogous to the overloaded function from the parent class.
 
void constructTwins ()
 Construct the twins.
 
void constructTwinsBetween (size_t &currentNrAllVertices, std::list< size_t > vertexIndices, size_t from, size_t to, bool rightHandSide)
 
void constructTwinsBetween (size_t &currentNrAllVertices, std::list< size_t > vertexIndices, gsVertexHandle from, gsVertexHandle to, bool rightHandSide)
 
gsMesh< T > createExtendedFlatMesh (const std::vector< size_t > &right, const std::vector< size_t > &left) const
 
size_t findTwin (size_t vertexId) const
 Finds the twin of the vertex nr. vertexId in the mesh.
 
const Point2DgetParameterPoint (size_t vertexIndex) const
 Get parameter point Returns the parameter point with given vertex index. More...
 
void initParameterPoints ()
 
void updateLambdasWithTwins (std::vector< T > &lambdas, size_t vertexId) const
 

Protected Attributes

const std::vector< size_t > m_indicesV0
 indices of the vertices with v=0
 
const std::vector< size_t > m_indicesV1
 indicesV1 indices of the vertices with v=1
 
const gsHalfEdgeMesh< T > m_mesh
 mesh information
 
const gsHalfEdgeMesh< T > m_overlapHEM
 The mesh of the overlap, cf. the introduction to the class.
 
VectorType m_parameterPoints
 parameter points
 
const gsMatrix< T > m_paramsV0
 u-parameters of the vertices with v=0
 
const gsMatrix< T > m_paramsV1
 u-parameters of the vertices with v=1
 
std::vector< std::pair< size_t,
size_t > > 
m_twins
 

Constructor & Destructor Documentation

gsPeriodicOverlap ( const gsMesh< T > &  mesh,
const gsMatrix< T > &  verticesV0,
const gsMatrix< T > &  paramsV0,
const gsMatrix< T > &  verticesV1,
const gsMatrix< T > &  paramsV1,
const gsMesh< T > &  overlap,
const gsOptionList list = gsPeriodicParametrization<T>::defaultOptions() 
)
inlineexplicit

Constructor

Parameters
meshthe surface mesh to be parametrized
verticesV0vertices on the bottom (i.e., v = 0) boundary
paramsV0their prescribed parameters
verticessV1vertices on the upper (i.e., v = 1) boundary
paramsV1their prescribed parameters
overlapedge-connected chain of triangles connecting the bottom and top boundary and forming the first guess of the periodic interface
listlist of the method options

Member Function Documentation

void calculate ( const size_t  paraMethod)
protected

Analogous to the calculate method of the parent class.

Parameters
paraMethodwhich parametrization method to use
indicesV0indices of the vertices on the bottom (i.e., v = 0) boundary
indicesV1indices of the vertices on the upper (i.e., v = 1) boundary
void constructTwinsBetween ( size_t &  currentNrAllVertices,
std::list< size_t >  vertexIndices,
size_t  from,
size_t  to,
bool  rightHandSide 
)
protected

Helper function to constructTwins. Constructs twins on the left or right side of the overlap.

Parameters
currentNrAllVerticesnumber of input vertices plus the number of twins constructed so far
vertexIndicesindices of the boundary vertices of the overlap mesh
fromthe index (in the overlap mesh) of the starting vertex of the side
tothe index of the end vertex of the side
rightHandSideflag to decide, whether we are working on the right hand side (true) or left hand side (false) of the overlap.
void constructTwinsBetween ( size_t &  currentNrAllVertices,
std::list< size_t >  vertexIndices,
gsVertexHandle  from,
gsVertexHandle  to,
bool  rightHandSide 
)
inlineprotected

Helper function to constructTwins, preprocesses the inputs for the overloaded method by finding the indices of the vertices from and to.

gsMesh< T > createExtendedFlatMesh ( const std::vector< size_t > &  right,
const std::vector< size_t > &  left 
) const
protected

Creates a flat (i.e., 2D) mesh with the overlap triangles on both sides of the parametric domain.

Parameters
leftIndices of the vertices on the left boundary of the overlap mesh (using the same indexing as the twins).
rightIndices of the vertices on the right boundary of the overlap mesh (using the same indexing as the twins).
gsMesh< T > createFlatMesh ( ) const
virtual

Creates a flat (i.e., 2D) mesh out of a periodic parametrization created by the overlap method.

Parameters
restrictIf set to true, the mesh is restricted to [0, 1]^2.

Reimplemented from gsParametrization< T >.

gsMatrix< T > createUVmatrix ( )
inherited

Parametric Coordinates u,v from 0..1

Returns
gsMatrix< T > createXYZmatrix ( )
inherited

Corresponding mapped values in R3 to parametric coordinates.

Returns
const gsParametrization< T >::Point2D & getParameterPoint ( size_t  vertexIndex) const
protectedinherited

Get parameter point Returns the parameter point with given vertex index.

Parameters
[in]vertexIndexint - vertex index
Returns
two-dimensional parameter point
void initParameterPoints ( )
protectedinherited

Prepares m_parameterPoints for a computation of a periodic parametrization. Important: Neighbourhood has to be constructed before calling this function.

void restrictMatrices ( gsMatrix< T > &  uv,
const gsMatrix< T > &  xyz,
real_t  uMin = 0,
real_t  uMax = 1 
) const
inherited

Moves the u-coordinates of parameters outside the interval [uMin, uMax] to inside the interval. Note: it modifies uv!

Parameters
uvMatrix of the parameters, one column per point
xyzMatrix of the coordinates, one column per point
uMinminimal desired u
uMaxmaximal desired u
void updateLambdasWithTwins ( std::vector< T > &  lambdas,
size_t  vertexId 
) const
protected

Helper function to constructAndSolveEquationSystem with twins. Takes the coefficients computed by the standard method and shifts them to the twins.

Parameters
lambdasthe coefficients of the linear combination for the current vertex
vertexthe id of the current vertex
void writeTexturedMesh ( std::string  filename) const
inherited

Writes m_mesh into filename.vtk with the vertices coloured according to the parameters.

Parameters
filenameThe name of the output file (without extension).

Member Data Documentation

std::vector<std::pair<size_t, size_t> > m_twins
protected

Every twin pair is a pair of vertices with (almost) the same coordinates. The first in the pair has the u-coordinate smaller by one than the second.