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

Detailed Description

template<class T>
class gismo::gsPeriodicStitch< 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. This class is an alternative to gsPeriodicOverlap. The idea is adapted from

Tong, Y., Alliez, P., Cohen-Steiner, D., Desbrun, M.: Designing quadrangulations with discrete harmonic forms, in: Sheffer, A., Polthier, K. (Eds.), Symposium on Geometry Processing, Eurographics. pp. 201–210, 2006,

where it was used constructing discrete harmonic mappings on arbitrary topology.

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 a stitch: a list of vertices forming a simple polyline connecting the vertices with the highest u-value on v=0 and v=1, which serves as a first guess for the location of the periodic interface.

The equations for the inner vertices (depicted with empty circles in the figure below) are assembled by the methods of the parent class. For vertices on the stitch (full squares) the u-coordinate of their neighbours to the right (empty squares) is temporarily increased by one; similarly, when computing the empty-squared neighbours, the u-coordinate from the full-square neighbours is decreased by one.

gsPeriodicParametrizationStitch.png

Inherits gsPeriodicParametrization< T >.

+ Collaboration diagram for gsPeriodicStitch< T >:

Classes

class  Neighbourhood
 

Public Member Functions

void compute ()
 Computes the periodic parametrization.
 
gsMesh< T > createFlatMesh () const
 
gsMatrix< T > createUVmatrix ()
 
gsMatrix< T > createXYZmatrix ()
 
 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())
 
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)
 
void constructAndSolveEquationSystem (const Neighbourhood &neighbourhood, const size_t n, const size_t N)
 Constructs linear equation system and solves it. More...
 
gsMesh< T > createUnfoldedFlatMesh () const
 
bool edgeIsInCorrections (index_t beg, index_t end) const
 
const Point2DgetParameterPoint (size_t vertexIndex) const
 Get parameter point Returns the parameter point with given vertex index. More...
 
void initParameterPoints ()
 
bool isOnStitch (size_t vertexIndex) const
 

Protected Attributes

gsSparseMatrix< int > m_corrections
 
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
 
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
 
const std::vector< size_t > m_stitchIndices
 indices of the vertices on the stitch
 

Constructor & Destructor Documentation

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() 
)
inlineexplicit

Constructor

Parameters
meshthe surface mesh to be parametrized
verticesV0matrix with three rows containing the vertices with v=0
paramsV0matrix with one row containing the u-parameters of vertices with v=0
verticesV1matrix with three rows containing the vertices with v=1
paramsV1matrix with one row containing the u-parameters of vertices with v=1
stitchVerticesmatrix with three rows containing the vertices on the stitch
listlist of the method options

Member Function Documentation

void calculate ( const size_t  paraMethod)
protected

Calculation itself

Parameters
paraMethodparametrization method (cf. gsParametrization<T>)

Solve.

void constructAndSolveEquationSystem ( const Neighbourhood neighbourhood,
const size_t  n,
const size_t  N 
)
protected

Similar to constructAndSolveEquationSystem but works for periodic meshes using the corrections.

void constructAndSolveEquationSystem ( const Neighbourhood neighbourhood,
const size_t  n,
const size_t  N 
)
protectedinherited

Constructs linear equation system and solves it.

The last step in Floater's algorithm is solving the linear equation system to obtain the parameter values for the inner vertices of the triangle mesh. This method constructs the above-mentioned system using information from neighbourhood. The matrix is given by a(i,i) = 1 a(i,j) = -lambda(i,j) for j!=i and the right hand side is calculated using the boundary parameters found beforehand. The parameter values are multiplied with corresponding lambda values and summed up. In the last step the system is solved and the parameter points are stored in m_parameterPoints.

Parameters
[in]neighbourhoodconst Neighbourhood& - neighbourhood information of the mesh
[in]nconst int - number of inner vertices and therefore size of the square matrix
[in]Nconst int - number of the vertices and therefore N-n is the size of the right-hand-side vector
gsMesh<T> createFlatMesh ( ) const
inlinevirtual

Creates a flat mesh out of a periodic parametrization created by a the stitch method. The mesh is then restricted to [0, 1]^2.

Reimplemented from gsParametrization< T >.

gsMesh< T > createUnfoldedFlatMesh ( ) const
protected

Creates an unfolded mesh in the sense that the vertices on the stitch are present twice, once in their original parameters and once with u decreased by one.

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
bool edgeIsInCorrections ( index_t  beg,
index_t  end 
) const
inlineprotected

Query, whether an edge between vertices with indices beg and end corrects a stitch vertex with its neighbour to the right (i.e., whether it connects and empty square and full square vertex in the figure documenting this class).

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.

bool isOnStitch ( size_t  vertexIndex) const
inlineprotected

Query, whether the vertex with index vertexIndex (in the numbering of Floater's paper, i.e., starting from 1) is on the stitch or not.

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 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

gsSparseMatrix<int> m_corrections
protected

Slot (i, j) is equal to 1 iff vertex with id i-1 is on a stitch and vertex with id j-1 is among its neighbours across the interface. Slot (j, i) is then set to -1.