ug4
ug::SlicingData< TVec, N > Class Template Reference

#include <slicing.h>

Public Types

typedef std::vector< int > slice_desc_set
 
typedef TVec::value_type slice_desc_type
 
typedef TVec slice_desc_type_vector
 

Public Member Functions

template<class VT >
void add_vector_slice (const VT &full_src, slice_desc_type desc, VT &small_dst, double sigma=1.0) const
 Add: slice of vector -> small vector. More...
 
template<class VT >
void add_vector_slice (const VT &small_src, VT &full_dst, slice_desc_type desc, double sigma=1.0) const
 Add: small vector -> slice of a vector. More...
 
SmartPtr< AlgebraLayoutscreate_slice_layouts (ConstSmartPtr< AlgebraLayouts > fullLayouts, slice_desc_type type) const
 Create new slice layouts (as a subset from full layouts). More...
 
template<class MT >
void get_matrix (const MT &A, slice_desc_type row_type, slice_desc_type col_type, MT &Aslice) const
 
size_t get_num_elems (slice_desc_type type) const
 Number of elements for each type. More...
 
template<class VT >
void get_vector_slice (const VT &full_src, slice_desc_type desc, VT &small_dst) const
 Copy: slice of vector -> small vector. More...
 
bool is_valid ()
 
void set_types (const slice_desc_type_vector &types, bool bClear=false)
 Copy types. More...
 
template<class VT >
void set_vector_slice (const VT &small_src, VT &full_dst, slice_desc_type desc) const
 Copy: small vector -> slice of a vector. More...
 
template<class VT >
void setup_slice_like (const VT &full_src, slice_desc_type type, VT &vectorslice) const
 Sets an existing sliced vector up correctly. More...
 
template<class VT >
SmartPtr< VT > slice_clone (const VT &full_src, slice_desc_type type) const
 Create a (partial) clone. More...
 
template<class VT >
SmartPtr< VT > slice_clone_without_values (const VT &full_src, slice_desc_type type) const
 Create a (partial) clone of the vector, without copying values. More...
 
 SlicingData ()
 Constructor. More...
 
 SlicingData (const slice_desc_type_vector &types)
 
template<class VT >
void subtract_vector_slice (const VT &full_src, slice_desc_type desc, VT &small_dst) const
 substract: slice of vector -> small vector More...
 
template<class VT >
void subtract_vector_slice (const VT &small_src, VT &full_dst, slice_desc_type desc) const
 substract: small vector -> slice of a vector More...
 

Protected Member Functions

void clear_set_mappings ()
 Clear all sets. More...
 
void fill_set_mappings ()
 Auto fill for sets. More...
 
bool find_index (slice_desc_type type, int gindex, int &index) const
 returns: local index for a global index (if found) or undefined else. More...
 
slice_desc_type get_type (size_t index)
 returns type for a global index More...
 
void replace_indices_in_layout (slice_desc_type type, IndexLayout &il) const
 
void reset_set_mappings ()
 Clear & auto fill. More...
 
slice_desc_setslice (slice_desc_type type)
 
const slice_desc_setslice (slice_desc_type type) const
 returns the set of global indices for a given type More...
 

Protected Attributes

slice_desc_set m_slice_set [N]
 N mappings: islice(type) -> iglobal. More...
 
slice_desc_type_vector m_slice_types
 global vector with mappings iglobal -> type(iglobal) More...
 
bool m_valid
 

Member Typedef Documentation

◆ slice_desc_set

template<class TVec , size_t N>
typedef std::vector<int> ug::SlicingData< TVec, N >::slice_desc_set

◆ slice_desc_type

template<class TVec , size_t N>
typedef TVec::value_type ug::SlicingData< TVec, N >::slice_desc_type

◆ slice_desc_type_vector

template<class TVec , size_t N>
typedef TVec ug::SlicingData< TVec, N >::slice_desc_type_vector

Constructor & Destructor Documentation

◆ SlicingData() [1/2]

template<class TVec , size_t N>
ug::SlicingData< TVec, N >::SlicingData ( )
inline

Constructor.

◆ SlicingData() [2/2]

template<class TVec , size_t N>
ug::SlicingData< TVec, N >::SlicingData ( const slice_desc_type_vector types)
inline

Builds index mappings based on types

References ug::SlicingData< TVec, N >::reset_set_mappings().

Member Function Documentation

◆ add_vector_slice() [1/2]

template<class TVec , size_t N>
template<class VT >
void ug::SlicingData< TVec, N >::add_vector_slice ( const VT &  full_src,
slice_desc_type  desc,
VT &  small_dst,
double  sigma = 1.0 
) const
inline

Add: slice of vector -> small vector.

References ug::SlicingData< TVec, N >::slice().

Referenced by ug::SlicingData< TVec, N >::subtract_vector_slice().

◆ add_vector_slice() [2/2]

template<class TVec , size_t N>
template<class VT >
void ug::SlicingData< TVec, N >::add_vector_slice ( const VT &  small_src,
VT &  full_dst,
slice_desc_type  desc,
double  sigma = 1.0 
) const
inline

Add: small vector -> slice of a vector.

References ug::SlicingData< TVec, N >::slice().

◆ clear_set_mappings()

template<class TVec , size_t N>
void ug::SlicingData< TVec, N >::clear_set_mappings ( )
inlineprotected

◆ create_slice_layouts()

template<class TVec , size_t N>
SmartPtr<AlgebraLayouts> ug::SlicingData< TVec, N >::create_slice_layouts ( ConstSmartPtr< AlgebraLayouts fullLayouts,
slice_desc_type  type 
) const
inline

◆ fill_set_mappings()

template<class TVec , size_t N>
void ug::SlicingData< TVec, N >::fill_set_mappings ( )
inlineprotected

◆ find_index()

template<class TVec , size_t N>
bool ug::SlicingData< TVec, N >::find_index ( slice_desc_type  type,
int  gindex,
int &  index 
) const
inlineprotected

returns: local index for a global index (if found) or undefined else.

References ug::SlicingData< TVec, N >::slice(), and UG_ASSERT.

Referenced by ug::SlicingData< TVec, N >::get_matrix(), and ug::SlicingData< TVec, N >::replace_indices_in_layout().

◆ get_matrix()

template<class TVec , size_t N>
template<class MT >
void ug::SlicingData< TVec, N >::get_matrix ( const MT &  A,
slice_desc_type  row_type,
slice_desc_type  col_type,
MT &  Aslice 
) const
inline

◆ get_num_elems()

template<class TVec , size_t N>
size_t ug::SlicingData< TVec, N >::get_num_elems ( slice_desc_type  type) const
inline

Number of elements for each type.

References ug::SlicingData< TVec, N >::slice().

Referenced by ug::SchurComplementOperator< TAlgebra >::sub_size().

◆ get_type()

template<class TVec , size_t N>
slice_desc_type ug::SlicingData< TVec, N >::get_type ( size_t  index)
inlineprotected

◆ get_vector_slice()

template<class TVec , size_t N>
template<class VT >
void ug::SlicingData< TVec, N >::get_vector_slice ( const VT &  full_src,
slice_desc_type  desc,
VT &  small_dst 
) const
inline

Copy: slice of vector -> small vector.

References ug::SlicingData< TVec, N >::slice().

Referenced by ug::SlicingData< TVec, N >::slice_clone(), and ug::SchurPrecond< TAlgebra >::step().

◆ is_valid()

template<class TVec , size_t N>
bool ug::SlicingData< TVec, N >::is_valid ( )
inline

◆ replace_indices_in_layout()

◆ reset_set_mappings()

template<class TVec , size_t N>
void ug::SlicingData< TVec, N >::reset_set_mappings ( )
inlineprotected

◆ set_types()

template<class TVec , size_t N>
void ug::SlicingData< TVec, N >::set_types ( const slice_desc_type_vector types,
bool  bClear = false 
)
inline

◆ set_vector_slice()

template<class TVec , size_t N>
template<class VT >
void ug::SlicingData< TVec, N >::set_vector_slice ( const VT &  small_src,
VT &  full_dst,
slice_desc_type  desc 
) const
inline

Copy: small vector -> slice of a vector.

References ug::SlicingData< TVec, N >::slice().

Referenced by ug::SchurPrecond< TAlgebra >::step().

◆ setup_slice_like()

template<class TVec , size_t N>
template<class VT >
void ug::SlicingData< TVec, N >::setup_slice_like ( const VT &  full_src,
slice_desc_type  type,
VT &  vectorslice 
) const
inline

Sets an existing sliced vector up correctly.

References ug::SlicingData< TVec, N >::create_slice_layouts(), and ug::SlicingData< TVec, N >::slice().

◆ slice() [1/2]

template<class TVec , size_t N>
slice_desc_set& ug::SlicingData< TVec, N >::slice ( slice_desc_type  type)
inlineprotected

◆ slice() [2/2]

◆ slice_clone()

template<class TVec , size_t N>
template<class VT >
SmartPtr<VT> ug::SlicingData< TVec, N >::slice_clone ( const VT &  full_src,
slice_desc_type  type 
) const
inline

◆ slice_clone_without_values()

template<class TVec , size_t N>
template<class VT >
SmartPtr<VT> ug::SlicingData< TVec, N >::slice_clone_without_values ( const VT &  full_src,
slice_desc_type  type 
) const
inline

◆ subtract_vector_slice() [1/2]

template<class TVec , size_t N>
template<class VT >
void ug::SlicingData< TVec, N >::subtract_vector_slice ( const VT &  full_src,
slice_desc_type  desc,
VT &  small_dst 
) const
inline

substract: slice of vector -> small vector

References ug::SlicingData< TVec, N >::add_vector_slice().

Referenced by ug::SchurPrecond< TAlgebra >::step().

◆ subtract_vector_slice() [2/2]

template<class TVec , size_t N>
template<class VT >
void ug::SlicingData< TVec, N >::subtract_vector_slice ( const VT &  small_src,
VT &  full_dst,
slice_desc_type  desc 
) const
inline

substract: small vector -> slice of a vector

References ug::SlicingData< TVec, N >::add_vector_slice().

Member Data Documentation

◆ m_slice_set

template<class TVec , size_t N>
slice_desc_set ug::SlicingData< TVec, N >::m_slice_set[N]
protected

N mappings: islice(type) -> iglobal.

Referenced by ug::SlicingData< TVec, N >::fill_set_mappings(), and ug::SlicingData< TVec, N >::slice().

◆ m_slice_types

template<class TVec , size_t N>
slice_desc_type_vector ug::SlicingData< TVec, N >::m_slice_types
protected

◆ m_valid

template<class TVec , size_t N>
bool ug::SlicingData< TVec, N >::m_valid
protected

The documentation for this class was generated from the following file: