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

Detailed Description

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

Purely abstract class gsMappedBasis, which gives means of combining basis functions to new, global ones.

This is done by having a set of basis functions (as a collection of basis patches) plus a topology, which specifies the relation of these patches. A mapping is then created, which combines basis functions with certain weights, to achieve a (predefined) increased smoothness degree over the interfaces.

The function getMappedSingleBasis() then provides a class implementing gsBasis, which can be used also as a basis for a geometry.

To split the gsMappedBasis into Patches again, the function exportToPatches() can be used.

The notion of a localIndex is used for the accumulated indizes of the basis functions of the patches, whereas the globalIndex is used for the new, combined 'global' basis functions. PatchIndex is the index of a local basis function in its patch, so: localIndex = patchIndex + _firstLocalIndex(patch).

Template Parameters
ddimension of the parameter domains
Tcoefficient type
+ Inheritance diagram for gsMPBESBasis< d, T >:

Classes

struct  distances
 Private stract that has the purpose of storing distance information of c^0 parts around special vertices. More...
 

Public Types

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

Public Member Functions

gsMatrix< index_tactive (const gsMatrix< T > &u) const
 Returns the indices of active (nonzero) functions at points u, as a list of indices. More...
 
void active_into (const index_t patch, const gsMatrix< T > &u, gsMatrix< index_t > &result) const
 Returns the indices of active (non-zero) basis functions of patch at points u, as a list of indices, in result. More...
 
const gsBasis< T > & basis (const index_t k) const
 Helper which casts and returns the k-th piece of this function set as a gsBasis.
 
virtual unsigned basisFunctionsOnSide (const patchSide &ps) const =0
 Returns the amount of basis functions on a given side of a given patch.
 
void boundary (std::vector< index_t > &indices, index_t offset=0) const
 
uPtr clone ()
 Clone methode. Produceds a deep copy inside a uPtr.
 
virtual void compute (const gsMatrix< T > &in, gsFuncData< T > &out) const
 Computes function data. More...
 
short_t degree (const index_t patch, const short_t i) const
 Returns the polynomial degree of direction i of patch.
 
void degreeElevate (index_t amount=1, bool updateBasis=true)
 
void degreeIncrease (index_t amount=1, index_t dir=-1, bool updateBasis=true)
 
gsMatrix< T > deriv (const gsMatrix< T > &u) const
 Evaluate the derivatives,. More...
 
gsMatrix< T > deriv2 (const gsMatrix< T > &u) const
 Evaluates the second derivatives of active (i.e., non-zero) basis at points u. More...
 
std::string detail () const
 Clone function. Used to make a copy of a derived basis. More...
 
short_t dim () const
 Returns the dimension d of the parameter space.
 
short_t domainDim () const
 Clone function. Used to make a copy of a derived basis.
 
gsMatrix< T > eval (const gsMatrix< T > &u) const
 Evaluate the function,. More...
 
std::vector< gsMatrix< T > > evalAllDers (const gsMatrix< T > &u, int n) const
 Evaluate all derivatives upto order n,. More...
 
gsGeometry< T > * exportPatch (const index_t i, gsMatrix< T > const &localCoef) const
 
gsMultiPatch< T > exportToPatches (gsMatrix< T > const &localCoef) const
 
const gsFunction< T > & function (const index_t k) const
 Helper which casts and returns the k-th piece of this function set as a gsFunction.
 
BasisType const & getBase (index_t i) const
 getter for (const) m_bases[i]
 
BasisTypegetBase (index_t i)
 getter for m_bases[i]
 
const std::vector< BasisType * > getBases () const
 getter for m_bases
 
std::vector< BasisType * > getBasesCopy () const
 getter for m_bases
 
index_t getIncrSmoothnessDegree () const
 getter for m_incrSmoothnessDegree
 
gsMappedSingleBasis< d, T > & getMappedSingleBasis (const index_t i) const
 
gsWeightMapper< T > const & getMapper () const
 getter for m_mapper
 
gsWeightMapper< T > * getMapPointer () const
 getter for m_mapper
 
getParametricDistanceOfVertex (const patchCorner &pc, const patchSide &ps) const
 gives back the parametric c^0 distance of the edge ps starting from corner pc
 
index_t getPatch (index_t const localIndex)
 See gsMappedBasis::_getPatchIndex.
 
gsBoxTopology const & getTopol () const
 getter for m_topol
 
getWeight (const patchSide &ps) const
 
void global_coef_to_local_coef (gsMatrix< T > const &globalCoefs, gsMatrix< T > &localCoefs) const
 
 gsMPBESBasis ()
 Default empty constructor.
 
void innerBoundaries (std::vector< index_t > &indices, index_t offset=0) const
 
bool isSpecialVertex (const patchCorner &pc) const
 gives back true, if the given patchCorner is a special vertex
 
void local_coef_to_global_coef (gsMatrix< T > const &localCoefs, gsMatrix< T > &globalCoefs) const
 
index_t localSize () const
 Returns the number of local basis functions in the basis.
 
index_t localSize (const index_t index) const
 Returns the number of local basis functions of the patch with given index in the basis.
 
domainIter makeDomainIterator (const index_t patch, const boxSide &s) const
 gives back the domain iterator of the boundary side s of a given patch
 
short_t maxDegree () const
 Returns the maximal polynomial degree of the patches.
 
size_t nPatches () const
 returns the amount of patches of the multi patch
 
virtual void numActive_into (const index_t patch, const gsMatrix< T > &u, gsVector< index_t > &result) const
 Returns the number of active (nonzero) basis functions at points u in result.
 
std::ostream & print (std::ostream &os) const
 Prints the object to the stream.
 
virtual void refine (const index_t patch, gsMatrix< T > const &boxes, bool updateBasis=true)=0
 
virtual void refine_withCoefs (gsMatrix< T > &localCoefs, const index_t patch, gsMatrix< T > const &boxes, bool updateBasis=true)=0
 
virtual void refineElements (const index_t patch, std::vector< index_t > const &boxes, bool updateBasis=true)=0
 
virtual void refineElements_withCoefs (gsMatrix< T > &localCoefs, const index_t patch, std::vector< index_t > const &boxes, bool updateBasis=true)=0
 
virtual void repairPatches (std::vector< gsMatrix< T > * > &coefs, index_t startFromPatch=-1)=0
 
void repairPatches (index_t startFromPatch=-1)
 
void setC0 (patchCorner pc)
 
bool setWeight (const patchSide &ps, const T weight)
 
index_t size (const index_t index) const
 
void smoothCornerEdge (const patchCorner &pc, const patchSide &ps, bool updateBasis=true)
 
void smoothEverything ()
 
virtual short_t targetDim () const
 Dimension of the target space. More...
 
void uniformRefine (index_t numKnots=1, index_t mul=1, bool updateBasis=true)
 
void uniformRefine_withCoefs (gsMatrix< T > &localCoefs, index_t numKnots=1, index_t mul=1, bool updateBasis=true)
 
void updateTopol ()
 updates the mapping of this basis (f.e. after a knot insertion)
 
virtual ~gsMPBESBasis ()
 constructor, deletes all the bases and the mapper
 
Evaluation functions
void eval_into (const index_t patch, const gsMatrix< T > &u, gsMatrix< T > &result) const
 Evaluates nonzero basis functions of patch at point u into result. More...
 
void deriv_into (const index_t patch, const gsMatrix< T > &u, gsMatrix< T > &result) const
 
void deriv2_into (const index_t patch, const gsMatrix< T > &u, gsMatrix< T > &result) const
 
void evalAllDers_into (const index_t patch, const gsMatrix< T > &u, const index_t n, std::vector< gsMatrix< T > > &result) const
 Evaluate the nonzero basis functions of patch and their derivatives up to order n at points u into result.
 
gsPiecewiseFunction< T > basisFunction (index_t global_BF)
 
void evalSingle_into (const index_t patch, const index_t global_BF, const gsMatrix< T > &u, gsMatrix< T > &result) const
 Evaluate the global_BF-th basis function on patch at points u into result.
 
void derivSingle_into (const index_t patch, const index_t global_BF, const gsMatrix< T > &u, gsMatrix< T > &result) const
 
void deriv2Single_into (const index_t patch, const index_t global_BF, const gsMatrix< T > &u, gsMatrix< T > &result) const
 
gsMatrix< T > evalSingle (const index_t patch, const index_t global_BF, const gsMatrix< T > &u) const
 Evaluate a single basis function i at points u.
 
gsMatrix< T > derivSingle (const index_t patch, const index_t global_BF, const gsMatrix< T > &u) const
 Evaluate a single basis function i derivative at points u.
 
gsMatrix< T > deriv2Single (const index_t patch, const index_t global_BF, const gsMatrix< T > &u) const
 Evaluate the second derivative of a single basis function i at points u.
 
void evalAllDersSingle_into (const index_t patch, const index_t global_BF, const gsMatrix< T > &u, const index_t n, gsMatrix< T > &result) const
 Evaluate the basis function global_BF at patch and its derivatives up to order n at points u into result.
 

Protected Member Functions

bool _check () const
 Checks the gsMappedBasis for consistency.
 
virtual bool _checkTopologyWithBases () const =0
 Checks the gsMappedBasis for consistency.
 
index_t _getFirstLocalIndex (index_t const patch) const
 
index_t _getLastLocalIndex (index_t const patch) const
 
index_t _getLocalIndex (index_t const patch, index_t const patchIndex) const
 
index_t _getPatch (index_t const localIndex) const
 
index_t _getPatchIndex (const index_t localIndex) const
 
void _initVertices ()
 initializes the m_vertices field
 
void _setDistanceOfAllVertices ()
 initializes the m_distances field
 
virtual void _setMapping ()=0
 create a new mapping of the local basisfunctions
 
virtual T findParameter (patchSide const &ps, patchCorner const &pc, unsigned nrBasisFuncs) const =0
 
BasisTypegetBasePointer (index_t i)
 getter for m_bases[i]
 

Protected Attributes

std::vector< BasisType * > m_bases
 Vector of local bases.
 
std::vector< distancesm_distances
 vector of distances objects, that store C^0 distances from special vertices on the edges
 
short_t m_incrSmoothnessDegree
 smoothness degree that is tried to achive over patch interfaces
 
gsWeightMapper< T > * m_mapper
 Map between the local basis functions and the newly created ones.
 
unsigned m_minDist
 minimal C^0 distance from special (extraordinary) vertices, specified in basisfunctions
 
std::vector< std::pair
< patchSide, T > > 
m_patchSideWeights
 vector storing the weights for interfaces
 
std::vector
< gsMappedSingleBasis< d, T > > 
m_sb
 Underlying bases per patch.
 
gsBoxTopology m_topol
 Topology, specifying the relation (connections) between the patches.
 
std::vector< std::pair
< patchCorner, bool > > 
m_vertices
 vector storing all the inner vertices, with a flag if it is an Extraordinary vertex or an ordinary vertex.
 

Static Private Attributes

static const short_t Dim
 Dimension of the parameter domains.
 

Member Function Documentation

index_t _getFirstLocalIndex ( index_t const  patch) const
protectedinherited

gets the local index of the first basis function of the patch with the given number.

Parameters
[in]patch: the number of the patch
index_t _getLastLocalIndex ( index_t const  patch) const
inlineprotectedinherited

gets the local index of the last basis function of the patch with the given number.

Parameters
[in]patch: the number of the patch
index_t _getLocalIndex ( index_t const  patch,
index_t const  patchIndex 
) const
inlineprotectedinherited

gets the local index of the basis function of the patch with the given number.

Parameters
[in]patch: the number of the patch
[in]patchIndex: the index of the basis function on the patch
index_t _getPatch ( index_t const  localIndex) const
protectedinherited

gets the number of the patch, where the local basis function with the given index is on.

Parameters
[in]localIndex: the accumulated index of the basis function
index_t _getPatchIndex ( const index_t  localIndex) const
protectedinherited

gets the patchIndex of the basis function specified by its localIndex. This is the index of this basis function in the basis of this patch.

Parameters
[in]localIndex: the accumulated index of the basis function
gsMatrix<index_t> active ( const gsMatrix< T > &  u) const
inlineinherited

Returns the indices of active (nonzero) functions at points u, as a list of indices.

See Also
active_into()
void active_into ( const index_t  patch,
const gsMatrix< T > &  u,
gsMatrix< index_t > &  result 
) const
inherited

Returns the indices of active (non-zero) basis functions of patch at points u, as a list of indices, in result.

Parameters
[in]ugsMatrix containing evaluation points. Each column represents one evaluation point.
[out]resultFor every column i of u, a column containing the indices of the active basis functions at evaluation point u.col(i).
void boundary ( std::vector< index_t > &  indices,
index_t  offset = 0 
) const
inherited

gets all indices of global basis functions on the boundary upto a given offset

void compute ( const gsMatrix< T > &  in,
gsFuncData< T > &  out 
) const
virtualinherited

Computes function data.

This function evaluates the functions and their derivatives at the points in and writes them in the corresponding fields of out. Which field to write (and what to compute) is controlled by the out.flags (see also gsFuncData).

The input points in are expected to be compatible with the implementation/representation of the function, i.e. they should be points inside the domain of definitition of the function

Parameters
[in]in
[out]out

Reimplemented in gsGeometry< T >, and gsConstantFunction< T >.

void degreeElevate ( index_t  amount = 1,
bool  updateBasis = true 
)

degree elevates all the bases preserving smoothness

Parameters
[in]amount: the amount of elevation the bases will go through
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to apply more changes to the bases before calculating a new mapping
void degreeIncrease ( index_t  amount = 1,
index_t  dir = -1,
bool  updateBasis = true 
)

degree elevates all the bases preserving multiplicity

Parameters
[in]amount: the amount of elevation the bases will go through
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to apply more changes to the bases before calculating a new mapping
gsMatrix< T > deriv ( const gsMatrix< T > &  u) const
inherited

Evaluate the derivatives,.

See Also
deriv_into()
gsMatrix< T > deriv2 ( const gsMatrix< T > &  u) const
inherited

Evaluates the second derivatives of active (i.e., non-zero) basis at points u.

See documentation for deriv2_into() (the one without input parameter coefs) for details.

See Also
deriv2_into()
Parameters
[in]uEvaluation points in columns.
Returns
For every column of u, a column containing the second derivatives. See documentation for deriv2_into() (the one without input parameter coefs) for details.
std::string detail ( ) const
inline

Clone function. Used to make a copy of a derived basis.

Prints the object as a string with extended details.

gsMatrix< T > eval ( const gsMatrix< T > &  u) const
inherited

Evaluate the function,.

See Also
eval_into()
void eval_into ( const index_t  patch,
const gsMatrix< T > &  u,
gsMatrix< T > &  result 
) const
inherited

Evaluates nonzero basis functions of patch at point u into result.

Let...
d denote the dimension of the parameter domain.
k denote the number of active (i.e., non-zero) basis functions (see active_into()). n denote the number of evaluation points.
The n evaluation points u are given in a gsMatrix of size d x n. Each column of u represents one evaluation point.

The gsMatrix result contains the computed function values in the following form:
Column j of result corresponds to one evaluation point (specified by the j-th column of u). The column contains the values of all active functions "above" each other.
For example, for scalar basis functions Bi : (x,y,z)-> R, a colum represents
(B1, B2, ... , Bn)^T,
where the order the basis functions Bi is as returned by active() and active_into().

Parameters
[in]uEvaluation points given as gsMatrix of size d x n. See above for details.
[in,out]resultgsMatrix of size k x n. See above for details.
std::vector< gsMatrix< T > > evalAllDers ( const gsMatrix< T > &  u,
int  n 
) const
inherited

Evaluate all derivatives upto order n,.

See Also
evalAllDers_into
gsGeometry< T > * exportPatch ( const index_t  i,
gsMatrix< T > const &  localCoef 
) const
inherited

exports the patch i of this geometry (with coefs) to a Geometry object of the underlying basis. The ownership of this Geometry will go to the caller of this function.

Parameters
[in]localCoef: the coefficients to the local basis functions
gsMultiPatch< T > exportToPatches ( gsMatrix< T > const &  localCoef) const
inherited

exports this geometry (with coefs) to a gsMultiPatch object.

Parameters
[in]localCoef: the coefficients to the local basis functions
virtual T findParameter ( patchSide const &  ps,
patchCorner const &  pc,
unsigned  nrBasisFuncs 
) const
protectedpure virtual

finds the parametric c^0 distance of the edge ps starting from corner pc if the number of c^0 basis functions is given in nrBasisFuncs

Implemented in gsMPBESBSplineBasis< d, T >, and gsMPBESHSplineBasis< d, T >.

gsMappedSingleBasis<d,T>& getMappedSingleBasis ( const index_t  i) const
inlineinherited

gives back the gsMappedSingleBasis object set to the patch i, which ressembles the composite basis on one patch

T getWeight ( const patchSide ps) const

gets the weight at the given patchSide.

Parameters
[in]ps: patchSide
void global_coef_to_local_coef ( gsMatrix< T > const &  globalCoefs,
gsMatrix< T > &  localCoefs 
) const
inlineinherited

converts the global coefficients to the local ones

Parameters
[in]globalCoefs: the coefficients to the global basis functions
[out]localCoefs: the coefficients to the local basis functions
void innerBoundaries ( std::vector< index_t > &  indices,
index_t  offset = 0 
) const
inherited

gets all indices of global basis functions on the inner boundary upto a given offset

void local_coef_to_global_coef ( gsMatrix< T > const &  localCoefs,
gsMatrix< T > &  globalCoefs 
) const
inlineinherited

converts the local coefficients to the global ones

Parameters
[in]localCoefs: the coefficients to the local basis functions
[out]globalCoefs: the coefficients to the global basis functions
virtual void refine ( const index_t  patch,
gsMatrix< T > const &  boxes,
bool  updateBasis = true 
)
pure virtual

inserts the given boxes in the specified patch. The concrete implementation is left to the implementing classes of this abstract parent class.

Parameters
[in]patch: the patch number we look at
[in]boxes: the boxes to be inserted
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to insert more boxes

Implemented in gsMPBESBSplineBasis< d, T >, and gsMPBESHSplineBasis< d, T >.

virtual void refine_withCoefs ( gsMatrix< T > &  localCoefs,
const index_t  patch,
gsMatrix< T > const &  boxes,
bool  updateBasis = true 
)
pure virtual

inserts the given boxes in the specified patch, while also updating the given coefficients. The concrete implementation is left to the implementing classes of this abstract parent class.

Parameters
[in,out]localCoefs: the coefficients to the local basis functions
[in]patch: the patch number we look at
[in]boxes: the boxes to be inserted
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to insert more boxes

Implemented in gsMPBESBSplineBasis< d, T >, and gsMPBESHSplineBasis< d, T >.

virtual void refineElements ( const index_t  patch,
std::vector< index_t > const &  boxes,
bool  updateBasis = true 
)
pure virtual

inserts the given boxes in the specified patch. The concrete implementation is left to the implementing classes of this abstract parent class.

Parameters
[in]patch: the patch number we look at
[in]boxes: the boxes to be inserted
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to insert more boxes

Implemented in gsMPBESBSplineBasis< d, T >, and gsMPBESHSplineBasis< d, T >.

virtual void refineElements_withCoefs ( gsMatrix< T > &  localCoefs,
const index_t  patch,
std::vector< index_t > const &  boxes,
bool  updateBasis = true 
)
pure virtual

inserts the given boxes in the specified patch, while also updating the given coefficients. The concrete implementation is left to the implementing classes of this abstract parent class.

Parameters
[in,out]localCoefs: the coefficients to the local basis functions
[in]patch: the patch number we look at
[in]boxes: the boxes to be inserted
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to insert more boxes

Implemented in gsMPBESBSplineBasis< d, T >, and gsMPBESHSplineBasis< d, T >.

virtual void repairPatches ( std::vector< gsMatrix< T > * > &  coefs,
index_t  startFromPatch = -1 
)
pure virtual

Adjusts the patches to match each other at the interfaces by knot insertion (will be called automatically by refinement functions)

Implemented in gsMPBESBSplineBasis< d, T >, and gsMPBESHSplineBasis< d, T >.

void repairPatches ( index_t  startFromPatch = -1)

Adjusts the patches to match each other at the interfaces by knot insertion (will be called automatically by refinement functions)

void setC0 ( patchCorner  pc)

sets a patchCorner to be a special vertex, which means edges connected to this corner will have a c^0 continuity

bool setWeight ( const patchSide ps,
const T  weight 
)

sets the weight at the given patchSide to value weight

Parameters
[in]ps: patchSide
[in]weight: T
index_t size ( const index_t  index) const
inherited

Returns the approximate number of (global) basis functions in the patch with given index all the sizes summed up should give the total number of (global) basis functions the default argument -1 will give the total number of basis functions for all patches

void smoothCornerEdge ( const patchCorner pc,
const patchSide ps,
bool  updateBasis = true 
)

smooths a given edge connected to the corner back to the the minimal amount of C^0 continuity, specified by m_minDist.

Parameters
[in]pc: patchCorner, specifying the corner which should be smoothed
[in]ps: patchSide, specifying the edge, connected to the corner, which should be smoothed along
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to insert more boxes
void smoothEverything ( )

smooths all edges back to the the minimal amount of C^0 continuity, specified by m_minDist.

void uniformRefine ( index_t  numKnots = 1,
index_t  mul = 1,
bool  updateBasis = true 
)

makes a uniform refinement of all the bases, with a defined number of new knots inserted in every knot span.

Parameters
[in]numKnots: the amount of knots which are inserted in every knot span
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to insert more boxes
void uniformRefine_withCoefs ( gsMatrix< T > &  localCoefs,
index_t  numKnots = 1,
index_t  mul = 1,
bool  updateBasis = true 
)

makes a uniform refinement of all the bases, with a defined number of new knots inserted in every knot span.

Parameters
[in,out]localCoefs: the coefficients to the local basis functions
[in]numKnots: the amount of knots which are inserted in every knot span
[in]updateBasis: if true, a new mapping will be constructed for the new basis functions, only set to false if one wants to insert more boxes