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

Detailed Description

template<short_t d, class T>
class gismo::gsDPatchBase< d, T >

Constructs the D-Patch, from which the transformation matrix can be called.

Template Parameters
dparametric dimension
+ Inheritance diagram for gsDPatchBase< d, T >:
+ Collaboration diagram for gsDPatchBase< d, T >:

Public Types

typedef memory::shared_ptr
< gsDPatchBase
Ptr
 Shared pointer for gsDPatchBase.
 
typedef memory::unique_ptr
< gsDPatchBase
uPtr
 Unique pointer for gsDPatchBase.
 

Public Member Functions

virtual void compute ()
 Computes the construction.
 
virtual void cornerInfo () const
 Returns information for all the corners in the topology. More...
 
virtual void defaultOptions ()
 Sets the default options.
 
virtual gsGeometry< T > * exportPatch (index_t patch, bool computeCoefs=true)
 Exports a single modified patch with index patch. More...
 
virtual gsMultiPatch< T > exportToPatches (const gsMultiPatch< T > &patches)
 Exports the modified geometry to a gsMultiPatch object. More...
 
virtual const gsMultiPatch< T > & getGeometry () const
 Returns the multipatch that is used for the D-Patch.
 
virtual void globalBasis_into (gsMappedBasis< d, T > &mbasis) const
 Returns the basis that is used for the D-Patch. Could be THB refined.
 
virtual void globalGeometry_into (const gsMultiPatch< T > &patches, gsMappedSpline< d, T > &mspline)
 Returns the multipatch that is used for the D-Patch.
 
 gsDPatchBase ()
 Empty constructor.
 
 gsDPatchBase (const gsMultiBasis< T > &mb, const gsMultiPatch< T > &mp)
 Default constructor. More...
 
 gsDPatchBase (const gsMultiPatch< T > &mp)
 Default constructor. More...
 
virtual const gsMultiBasis< T > & localBasis () const
 Returns the basis that is used for the D-Patch. Could be THB refined.
 
virtual void localGeometry_into (gsMultiPatch< T > &localGeometry)
 Returns the modified geometry corresponding to the local basis.
 
virtual void mapperInfo () const
 Returns for each basis function if it is free or eliminated. More...
 
virtual const gsSparseMatrix< T > & matrix () const
 Returns the smoothing matrix. More...
 
virtual const void matrix_into (gsSparseMatrix< T > &matrix) const
 Returns the smoothing matrix into matrix. More...
 
virtual void sideInfo (patchSide side) const
 Returns information about a vertex. More...
 
virtual void sideInfo () const
 Returns information for all the sides in the topology. More...
 
virtual void vertexInfo (patchCorner corner) const
 Returns information about a vertex. More...
 

Protected Member Functions

virtual void _computeEVs ()=0
 Corrects the EVs.
 
virtual void _computeMapper ()
 Calculates the mapper. More...
 
virtual void _computeSmoothMatrix ()
 Calculates the smooth matrix.
 
virtual void _countDoFs ()
 Initializes the matrix, the basis and the mappers.
 
virtual void _getLowestCorners (std::vector< patchCorner > &pcorners, index_t n=3) const
 From a list of patchCorners pcorners, get the lowest n corners. More...
 
virtual void _getLowestIndices (std::vector< std::pair< index_t, index_t >> &indices, index_t n=3) const
 From a list of tuples (patch,index), get the lowest n tuples. More...
 
virtual const index_t _getValence (patchCorner corner) const
 Gets the valence. More...
 
virtual void _handleBoundary (patchSide side)
 Handles a boundary in the global matrix. More...
 
virtual void _handleInterface (boundaryInterface iface)
 Handles an interface in the global matrix. More...
 
virtual void _handleInterior ()
 Handles the interior in the global matrix. More...
 
virtual void _handleRegularCorner (patchCorner pcorner)
 Handles a regular corner. More...
 
virtual void _handleVertex (patchCorner pcorner)
 Handles a vertex in the global matrix. More...
 
virtual const index_t _indexFromSides (index_t index1, const patchSide side1, index_t index2, const patchSide side2)
 Computes the index of a basis function using sides as reference. More...
 
virtual const index_t _indexFromVert (const index_t index, const patchCorner corner, const patchSide side, const index_t offsets=0) const
 Computes the index of a basis function taking one corner and one side as reference. More...
 
virtual void _initBasis ()
 Initializes the basis.
 
virtual void _initChecks ()
 Prepares the THB basis if needed. More...
 
virtual void _initialize ()
 Initializes the class:

  • -.

 
virtual void _initMappers ()
 Initializes the matrix, the basis and the mappers.
 
virtual void _initMatrix ()
 Initializes the matrix.
 
virtual void _initTHB ()
 Initializes the matrix, the basis and the mappers.
 
virtual const bool _isInteriorVertex (patchCorner corner) const
 Determines whether the specified corner is interior vertex. More...
 
virtual void _makeTHB ()=0
 Prints which DoFs have been handled and which have been eliminated. More...
 
virtual void _performChecks (bool basis)
 Performs checks on sides, vertices and bases.
 
virtual gsMatrix< T > _preCoefficients (const gsMultiPatch< T > &patches)=0
 Computes the C1 coefficients for pre-multiplication to make the multipatch. More...
 
virtual void _removeLowestCorners (std::vector< patchCorner > &pcorners, index_t n=3) const
 From a list of patchCorners pcorners, remove all but the lowest n corners. More...
 
virtual void _removeLowestIndices (std::vector< std::pair< index_t, index_t >> &indices, index_t n=3) const
 From a list of tuples (patch,index), remove all but the lowest n tuples. More...
 
virtual void _resetChecks (bool basis)
 Resets checks on sides, vertices and bases.
 
virtual const index_t _sideIndex (index_t patch, boxSide bside) const
 Computes global index of the side. More...
 
virtual const index_t _sideIndex (patchSide pside) const
 Computes global index of the side. More...
 
virtual const std::pair
< index_t, bool > 
_vertexData (const patchCorner corner) const
 Returns the valence and whether a corner is interior or boundary. More...
 
virtual const index_t _vertIndex (index_t patch, boxCorner corner) const
 Computes global index of the corner. More...
 
virtual const index_t _vertIndex (patchCorner pcorner) const
 Computes global index of the corner. More...
 
virtual void _whichHandled ()
 Prints which DoFs have been handled and which have been eliminated.
 
virtual std::vector< bool > getSharpCorners (T tol=1e-2) const
 Checks if corners are sharp or not. More...
 

Constructor & Destructor Documentation

gsDPatchBase ( const gsMultiBasis< T > &  mb,
const gsMultiPatch< T > &  mp 
)
inline

Default constructor.

Parameters
mnMultiBasis
gsDPatchBase ( const gsMultiPatch< T > &  mp)
inline

Default constructor.

Parameters
mpMultipatch of the geometry

Member Function Documentation

void _computeMapper ( )
protectedvirtual

Calculates the mapper.

NOT PARALLEL YET

void _getLowestCorners ( std::vector< patchCorner > &  pcorners,
index_t  n = 3 
) const
protectedvirtual

From a list of patchCorners pcorners, get the lowest n corners.

Parameters
pcornersThe pcorners
[in]nThe number of corners
void _getLowestIndices ( std::vector< std::pair< index_t, index_t >> &  indices,
index_t  n = 3 
) const
protectedvirtual

From a list of tuples (patch,index), get the lowest n tuples.

Parameters
pcornersThe pcorners
[in]nThe number of corners
virtual const index_t _getValence ( patchCorner  corner) const
inlineprotectedvirtual

Gets the valence.

Parameters
[in]cornerThe corner
Returns
The valence.
void _handleBoundary ( patchSide  side)
protectedvirtual

Handles a boundary in the global matrix.

Handles all DoFs on the boundary with unit-weight, except the ones in the 0 and 1 rings around the vertices.

Parameters
[in]sideThe boundary side
void _handleInterface ( boundaryInterface  iface)
protectedvirtual

Handles an interface in the global matrix.

Gives all the DoFs that have offset 1 (orthogonal) from the interface weight 1.0 w.r.t itself. All the DoFs ON the interface (on both patches) will have weight 0.5 to the DoF with offset 1. This interface handling excludes the indices that are in the 0 and 1 ring around vertices.

Parameters
[in]ifaceThe interface
void _handleInterior ( )
protectedvirtual

Handles the interior in the global matrix.

Gives all left-over DoFs, which are in the interior, weight 1 w.r.t. itself

void _handleRegularCorner ( patchCorner  pcorner)
protectedvirtual

Handles a regular corner.

Parameters
[in]pcornerThe pcorner
void _handleVertex ( patchCorner  pcorner)
protectedvirtual

Handles a vertex in the global matrix.

We use the following notation convention (per patch!): b00 is the basis function at the vertex b10 is the basis function next to the vertex along the first interface that connects to the vertex b20 is the basis function next to b10 along the first interface that connects to the vertex etc.

b01 is the basis function next to the vertex along the second interface that connects to the vertex b02 is the basis function next to b01 along the second interface that connects to the vertex etc.

b11 is the basis function with offset 1 from both interfaces and from the vertex itself b22 is the basis function with offset 2 from both interfaces and from the vertex itself etc.

There are different options. a) Boundary vertices i) Valence 1: b00, b10, b01 and b00 all get weight 1.0 w.r.t the same basis function in the local basis ii) Valence 2: This case contains an interface between two patches. We use index k to denote the row basis functions along the interface. So k=0 corresponds to the basis functions on the boundary and k=1 corresponds to the basis functions with offset 1 from the boundaries. Using this convention, the functions bk1 in the local basis, are coupled to bk1 in the global basis with weight 1. The functions bk0 in the local basis (on the considered patch) are coupled to bk1 in the global basis with weight 0.5. The functions bk0 in the local basis (on the other patch) are coupled to bk1 (on the considered patch) in the global basis with weight 0.5. iii)Valence 3: In this case, the matched vertices on all the adjacent patches are treated in one go! Note that all the basis functions corresponding to the vertex (b00) on all patches are matched! We couple the b00 functions of all patches (in the local basis) with weight 1/4 to the b00 of the adjacent patch with the lowest number in the global basis. Then, the b11 on the considered patch is coupled with weight 1 to itself and with weight 0.25 to the b00s of the other patches. Then, we will handle the vertices where an interface and a boundary meet (there are two of these). For the patch corners that are on an interface, we find the b11 and b10 vertices (orthogonal to the interface) and we give all b10s weight 0.5 w.r.t. the b11s in the global basis (on both patches). Lastly, we add weight 0.5 for the b10s along the boundaries (so only for two patches) to the (matched) b00 basis function (all b00s refer to the same dof in the global basis). b) Interior vertices (all valences): i) b11 gets weight 1.0 w.r.t the same basis function in the local basis ii) all associated b00s in the local basis get weight 1/valence w.r.t. b11 in the global basis iii)the b10 and b01 in the local basis get weight 1/2 w.r.t. b11 in the global basis

Parameters
[in]pcornerThe patchcorner
const index_t _indexFromSides ( index_t  index1,
const patchSide  side1,
index_t  index2,
const patchSide  side2 
)
protectedvirtual

Computes the index of a basis function using sides as reference.

Parameters
[in]index1The index of the basis function parallel to the first side
[in]side1The first side
[in]index2The index of the basis function parallel to the second side
[in]side2The second side
Returns
Index that is index1 in direction of side1 and index2 in direction of side2
const index_t _indexFromVert ( const index_t  index,
const patchCorner  corner,
const patchSide  side,
const index_t  offsets = 0 
) const
protectedvirtual

Computes the index of a basis function taking one corner and one side as reference.

Parameters
[in]bases(optional) Multibasis to evaluate the index on
[in]indexOffset of the basis function parallel to the side side, measured from corner
[in]cornerThe corner to be measured from
[in]sideThe side which contains corner
[in]offsetThe offset from the side (orthogonal to the side)
Returns
Index of index places from corner along side, with offset offset and with offset levelOffset from the deepest level
void _initChecks ( )
protectedvirtual

Prepares the THB basis if needed.

This function constructs THB refinements on the places where they are needed, i.e. around EVs. It also constructs the transfer matrix (m_tMatrix) forms the transformation between the original B-spline basis and the THB-Spline basis. Computes D-Patch smoothing

Given a basis with THB refinement around the EVs, this function computes the D-Patch smoothing Makes the Pi matrix

This matrix is used to transform the coefficients of the D-Patch smoothing matrix

Parameters
[in]valenceThe valence
Returns
Matrix for smoothing around an EV} Initializes the matrix, the basis and the mappers
virtual const bool _isInteriorVertex ( patchCorner  corner) const
inlineprotectedvirtual

Determines whether the specified corner is interior vertex.

Parameters
[in]cornerThe corner
Returns
True if the specified corner is interior vertex, False otherwise.
virtual void _makeTHB ( )
protectedpure virtual

Prints which DoFs have been handled and which have been eliminated.

Makes a THB basis.

Implemented in gsAlmostC1< d, T >, gsDPatch< d, T >, and gsSmoothInterfaces< d, T >.

virtual gsMatrix<T> _preCoefficients ( const gsMultiPatch< T > &  patches)
protectedpure virtual

Computes the C1 coefficients for pre-multiplication to make the multipatch.

Takes the coefficients which are tagged as "free" in the modified DoFMapper (m_mapModified) and when a boundary vertex with valence=3 is present, this one is shifted.

Implemented in gsAlmostC1< d, T >, gsDPatch< d, T >, and gsSmoothInterfaces< d, T >.

void _removeLowestCorners ( std::vector< patchCorner > &  pcorners,
index_t  n = 3 
) const
protectedvirtual

From a list of patchCorners pcorners, remove all but the lowest n corners.

Parameters
pcornersThe pcorners
[in]nThe number of corners
void _removeLowestIndices ( std::vector< std::pair< index_t, index_t >> &  indices,
index_t  n = 3 
) const
protectedvirtual

From a list of tuples (patch,index), remove all but the lowest n tuples.

Parameters
pcornersThe pcorners
[in]nThe number of corners
virtual const index_t _sideIndex ( index_t  patch,
boxSide  bside 
) const
inlineprotectedvirtual

Computes global index of the side.

Parameters
[in]patchThe patch number
[in]bsideThe boxSide
Returns
Returns a global index of the side
virtual const index_t _sideIndex ( patchSide  pside) const
inlineprotectedvirtual

Computes global index of the side.

Parameters
[in]psideThe patchSide
Returns
Returns a global index of the side
const std::pair< index_t, bool > _vertexData ( const patchCorner  corner) const
protectedvirtual

Returns the valence and whether a corner is interior or boundary.

Parameters
[in]cornerThe patchCorner
Returns
A pair with .first giving the valence and .second being true if the vertex is interior and false if the vertex is on a boundary
virtual const index_t _vertIndex ( index_t  patch,
boxCorner  corner 
) const
inlineprotectedvirtual

Computes global index of the corner.

Parameters
[in]patchThe patch number
[in]cornerThe boxCorner
Returns
Returns a global index of the corner
virtual const index_t _vertIndex ( patchCorner  pcorner) const
inlineprotectedvirtual

Computes global index of the corner.

Parameters
[in]pcornerThe patchCorner
Returns
Returns a global index of the side
void cornerInfo ( ) const
virtual

Returns information for all the corners in the topology.

Returns for all the patches and for all corners (1 to 4) the valence and if it is an interior vertex or a boundary vertex.

gsGeometry< T > * exportPatch ( index_t  patch,
bool  computeCoefs = true 
)
virtual

Exports a single modified patch with index patch.

The patch is obtained by transforming the coefficients of the D-Patch to the original basis, such that the original basis functions can be used to plot the geometry (and the patch structure will remain intact). To construct the geometry, the coefficients for the C1 basis are multiplied with the transpose of the transformation matrix. The C1 coefficients are obtained with _preCoefficients().

virtual gsMultiPatch<T> exportToPatches ( const gsMultiPatch< T > &  patches)
inlinevirtual

Exports the modified geometry to a gsMultiPatch object.

Returns
A multipatch with the geometry
std::vector< bool > getSharpCorners ( tol = 1e-2) const
protectedvirtual

Checks if corners are sharp or not.

Parameters
[in]tolThe tolerance
Returns
A vector with a boolean true if the corner is C0 (following in-class corner indexing convention)
void mapperInfo ( ) const
virtual

Returns for each basis function if it is free or eliminated.

Returns for each basis function if it is free or eliminated and checks if the internal mapper is defined correctly

virtual const gsSparseMatrix<T>& matrix ( ) const
inlinevirtual

Returns the smoothing matrix.

The number of columns of the matrix corresponds to the number of basis functions in the local basis; this is the sum of all the basis functions over all the patches. The number of rows of the matrix corresponds to the number of global basis functions, i.e. the number of basis functions corresponding to the D-Patch. Multiplying the basis with the local basis function values gives the values of the basis functions in the global basis.

Returns
A matrix result to transfer local to global coefficients
virtual const void matrix_into ( gsSparseMatrix< T > &  matrix) const
inlinevirtual

Returns the smoothing matrix into matrix.

Parameters
matrixThe matrix
void sideInfo ( patchSide  side) const
virtual

Returns information about a vertex.

Parameters
[in]patchThe patchSide
Returns
Prints the patch number, the side index, the valence and if the side is a boundary or an interface
void sideInfo ( ) const
virtual

Returns information for all the sides in the topology.

Returns for all the patches and for all sides (1 to 4) if it is a boundary or an interface.

void vertexInfo ( patchCorner  corner) const
virtual

Returns information about a vertex.

Parameters
[in]cornerThe patchCorner
Returns
Prints the patch number, the corner index, the valence and if the corner is an interior or a boundary vertex