Commit f1c44c51 authored by Fabian's avatar Fabian
Browse files

Documenting num_dof_data_set_stuff + inlining all the things

parent ea4e200d
......@@ -131,9 +131,31 @@ int main(int argc, char* argv[]) {
for(auto& e : gridView.template entities<0>()) {
if( e.refElType() == eth::base::RefElType::QUAD)
{
std::cout << "Quad 1\n";
febasis.setMult(e, 13);
std::cout << "Quad 2\n";
}
else
{
std::cout << "Tria 1\n";
febasis.setMult(e, 1);
std::cout << "Tria 2\n";
}
}
for(auto& e : gridView.template entities<0>()) {
if( e.refElType() == eth::base::RefElType::QUAD)
{
std::cout << "Quad 1\n";
std::cout << febasis.multiplicity(e);
std::cout << "Quad 2\n";
}
else
{
std::cout << "Tria 1\n";
std::cout << febasis.multiplicity(e);
std::cout << "Tria 2\n";
}
}
//std::cout << gridTraits_t::dimMesh << '\n' << gridTraits_t::dimWorld << '\n';
......
......@@ -75,6 +75,7 @@ namespace betl2 {
* of all entities using gmsh's phyiscal tags in order to set different number
* of degrees of freedom in different regions of the mesh.
*
* The underlying implementation is done using \ref NumDofDataSetFactory.
*
* @sa \ref DofHandler, \ref FESpace, \ref GridElementsIdentifier
*/
......@@ -122,7 +123,7 @@ namespace betl2 {
* @param mult Number of degrees of freedom to be set (excluding subentites).
*/
template< int CODIM >
void setMult(const eth::grid::Entity<gridTraits_t, CODIM>& ent,
inline void setMult(const eth::grid::Entity<gridTraits_t, CODIM>& ent,
const size_type mult) {
multiplicities_.setData(ent, mult);
}
......@@ -134,7 +135,9 @@ namespace betl2 {
* @param ent Entity.
*/
template< int CODIM >
size_type multiplicity(const eth::grid::Entity<gridTraits_t, CODIM>& ent) const {
inline size_type multiplicity(const eth::grid::Entity<gridTraits_t, CODIM>& ent)
const
{
return multiplicities_.data(ent);
}
......@@ -144,7 +147,7 @@ namespace betl2 {
*
* @note This function is only supported for elements.
*/
size_type numDofs(const eth::grid::Entity<gridTraits_t,0>& elem) const
inline size_type numDofs(const eth::grid::Entity<gridTraits_t,0>& elem) const
{
// Get degrees of freedom for this element (without its subentities)
size_type dofs = multiplicity(elem);
......@@ -172,8 +175,8 @@ namespace betl2 {
struct GetDofs_
{
template< typename ELEMENT_T>
void operator()( const FEBasis& febasis, const ELEMENT_T& elem,
size_type& dofs) const
inline void operator()( const FEBasis& febasis, const ELEMENT_T& elem,
size_type& dofs) const
{
// Get number of subentities of this elment with codimension=CODIM
const size_type numSubEnt = elem.template countSubEntities<CODIM+1>( );
......
......@@ -24,14 +24,26 @@ namespace betl2 {
namespace ex{
/*! WANT: Storage for all reference types (REFS...)' multiplicity
* MEANS: NumDofDataSet will be build like:
* NumDofDatSet<unsigned,GVF_T, POINT, SEGMENT, TRIA, ...>
/*! @brief Provides a container for storing one value to some entities.
*
* UNLIKE DATASET WHICH IS BUILD LIKE
* DataSet<dof, GVT_T, POINT >
* or
* DataSet<dof*, GVT_T, TRIA, QUAD>
* This is heavily inspired by \ref eth::grid::utils::GridDataSet and
* \ref DataSet. But unlike them, provides different member functions.
*
* The main use of this is in \ref FEBasis for storing the multiplicities.
* This has to be done this rather complicated way since the object
* \ref IndexSet is based on the reference element type and not on the
* co-dimension. This means that for example when retrieving the indices
* of QUAD and TRIA elements some of them may be the same since they are
* stored separately.
*
* This object is built using \ref NumDofDataSetFactory.
*
* @tparam DATA_TYPE The data type that is stored (usually
* unsigned int).
* @tparam GRID_VIEW_FACTORY_T Type of the grid view factory.
* @tparam REFS... Reference element types that are stored.
*
* @sa \ref FEBasis, \ref NumDofDataSetFactory
*/
template< typename DATA_TYPE, class GRID_VIEW_FACTORY_T,
enum eth::base::RefElType... REFS >
......@@ -77,11 +89,12 @@ namespace betl2 {
* @param ent Entity.
*/
template<int CODIM>
const dataType_t& data(const entity_t<CODIM>& ent) const
inline const dataType_t& data(const entity_t<CODIM>& ent) const
{
static constexpr int dim = gridTraits_t::dimMesh-CODIM;
return eth::base::ReferenceElements::applyUniversal< DataFunctor,
typename refElList_t::template onlyDim_t<dim>,
return eth::base::ReferenceElements::applyDim<
dim,
DataFunctor,
const NumDofDataSet&,
const entity_t<CODIM>& >( ent.refElType(), *this, ent );
} // end mult()
......@@ -93,12 +106,12 @@ namespace betl2 {
* @param data Data that will be set.
*/
template<int CODIM>
void setData(const entity_t<CODIM>& ent, dataType_t data)
inline void setData(const entity_t<CODIM>& ent, dataType_t data)
{
static constexpr int dim = gridTraits_t::dimMesh-CODIM;
return eth::base::ReferenceElements::applyUniversal<
return eth::base::ReferenceElements::applyDim<
dim,
SetDataFunctor,
typename refElList_t::template onlyDim_t<dim>,
NumDofDataSet&,
const entity_t<CODIM>& >( ent.refElType(), *this, ent, data );
......@@ -124,7 +137,7 @@ namespace betl2 {
* @param nds NumDofDataSet.
* @param ent Entity.
*/
static returnType_t invoke(const NumDofDataSet& nds,
inline static returnType_t invoke(const NumDofDataSet& nds,
const entity_t<gridTraits_t::dimMesh
-eth::base::ReferenceElement<RET>::dimension>& ent)
{
......@@ -150,7 +163,7 @@ namespace betl2 {
* @param ent Entity.
* @param data Data.
*/
static returnType_t invoke(NumDofDataSet& nds,
inline static returnType_t invoke(NumDofDataSet& nds,
const entity_t<gridTraits_t::dimMesh
-eth::base::ReferenceElement<RET>::dimension>& ent,
const dataType_t& data)
......@@ -201,7 +214,7 @@ namespace betl2 {
* @note The pointer to the index set passed is stored. \n
* The new values are initialized with 0.
*/
void resize( const indexSet_t* indexSet )
inline void resize( const indexSet_t* indexSet )
{
indexSet_ = indexSet;
data_.resize( indexSet_->size(RET) );
......@@ -211,7 +224,7 @@ namespace betl2 {
*
* @param ent Entity.
*/
const dataType_t& data( const entity_t<codim>& ent ) const {
inline const dataType_t& data( const entity_t<codim>& ent ) const {
return data_[ indexSet_->index(ent) ];
}
......@@ -220,7 +233,7 @@ namespace betl2 {
* @param ent Entity.
* @param data Data to be stored.
*/
void setData( const entity_t<codim>& ent, const dataType_t& data ) {
inline void setData( const entity_t<codim>& ent, const dataType_t& data ) {
data_[ indexSet_->index(ent) ] = data;
}
......@@ -236,7 +249,7 @@ namespace betl2 {
//! @note Only the number of template arguments matter, not their order.
template< eth::base::RefElType RET_1, eth::base::RefElType RET_2,
eth::base::RefElType... RETS >
void resizeStorageHelper()
inline void resizeStorageHelper()
{
// Get the last reference element type of list and invoke
// the in StorageHelper provided resize function to adjust vector.
......@@ -246,7 +259,7 @@ namespace betl2 {
}
//! @brief Base case of resizeStorageHelper
template< eth::base::RefElType RET >
void resizeStorageHelper() {
inline void resizeStorageHelper() {
std::get<0>( multiplicities_ ).resize(indexSet_);
}
......@@ -265,7 +278,7 @@ namespace betl2 {
*/
template< eth::base::RefElType REF, eth::base::RefElType RET_1,
eth::base::RefElType RET_2, eth::base::RefElType... RETS >
StorageHelperBase* getStorageHelper()
inline StorageHelperBase* getStorageHelper()
{
// First check if the first tuple entry of multiplicities_ matches
// (-2 due to RET_1 and RET_2) if yes, return it!
......@@ -276,16 +289,27 @@ namespace betl2 {
}
//! @brief Base case of getStorageHelper
template< eth::base::RefElType REF, eth::base::RefElType RET >
StorageHelperBase* getStorageHelper()
inline StorageHelperBase* getStorageHelper()
{
return std::get<sizeof...(REFS)-1>( multiplicities_ ).refElType == REF
? &std::get< sizeof...(REFS)-1 >( multiplicities_ )
: throw std::out_of_range("RefElType not in NumDofDataSet.");
}
/*! @return a constant pointer for the StorageHelper object whose reference type
* match the given one.
*
* @note The return type is a pointer of the base class of StorageHelper.
* This is because we need a non-templated return type.
*
* @tparam REF The reference element type that is searched.
* @tparam RET_1 Reference element types to compare against.
* @tparam RET_2 Reference element types to compare against.
* @tparam RETS Reference element types to compare against.
*/
template< eth::base::RefElType REF, eth::base::RefElType RET_1,
eth::base::RefElType RET_2, eth::base::RefElType... RETS >
const StorageHelperBase* getStorageHelper() const
inline const StorageHelperBase* getStorageHelper() const
{
// First check if the first tuple entry of multiplicities_ matches
// (-2 due to RET_1 and RET_2) if yes, return it!
......@@ -296,7 +320,7 @@ namespace betl2 {
}
//! @brief Base case of getStorageHelper
template< eth::base::RefElType REF, eth::base::RefElType RET >
const StorageHelperBase* getStorageHelper() const
inline const StorageHelperBase* getStorageHelper() const
{
return std::get<sizeof...(REFS)-1>( multiplicities_ ).refElType == REF
? &std::get< sizeof...(REFS)-1 >( multiplicities_ )
......
......@@ -21,18 +21,20 @@ namespace betl2 {
namespace fe {
namespace ex {
/*! @brief Provides data structures for the finite element space.
/*! @brief Provides data structures for \ref FEBasis.
*
* This class is implemented as specialisations as is based on
* \ref DataSet. These mostly specialisations are hidden for readability
* \ref NumDofDataSet. These mostly specialisations are hidden for readability
* in the documentation. Their functionality is described for the case
* DIM = 2 and is analogue for DIM = 1 and DIM = 3.
*
* This provides a typedef for a container for how many degrees of
* freedom are associated with an entity.
*
* @tparam DIM Dimension of mesh.
* @tparam FE_BASIS_T Type of finite element basis.
* @tparam GRID_VIEW_FACTORY_T Type of grid view factory.
*
* @sa \ref DataSet
* @sa \ref NumDofDataSet, \ref FEBasis
*/
template< int DIM, typename GRID_VIEW_FACTORY_T >
class NumDofDataSetFactory;
......@@ -52,14 +54,16 @@ namespace betl2 {
class NumDofDataSetFactory< 2, GRID_VIEW_FACTORY_T >
{
private:
//! Type of the data to be stored.
typedef unsigned value_t;
// typedef for storing pointers to data
//! Type for storing the data.
template< eth::base::RefElType... REFS >
using vNumDofDataSet = NumDofDataSet< value_t, GRID_VIEW_FACTORY_T, REFS... >;
public:
//! Type of a data set for elements with pointers to degrees of freedom.
//! Type of a data set for the number of degrees of freedom associated with an
//! entity.
typedef vNumDofDataSet< eth::base::RefElType::POINT,
eth::base::RefElType::SEGMENT,
eth::base::RefElType::TRIA,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment