SyFi  0.3
DofT< D, C > Class Template Reference

#include <DofT.h>

List of all members.

Public Member Functions

 DofT (bool create_index2dof_=false, bool create_dof2loc_=false)
 ~DofT ()
int insert_dof (int e, int i, D Li)
int glob_dof (int e, int i)
int glob_dof (D Lj)
glob_dof (int j)
int size () const
int num_elements () const
int num_basis_functions () const
std::vector< std::pair< int,
int > > 
glob2loc (int j)
void clear ()

Protected Attributes

bool create_index2dof
bool create_dof2loc
int counter
int emax
int imax
std::map< std::pair< int, int >
, int > 
loc2dof
std::map< D, int, C > dof2index
std::map< D, int, C >::iterator iter
std::map< int, D > index2dof
std::map< int, std::vector
< std::pair< int, int > > > 
dof2loc

Detailed Description

template<class D, class C>
class DofT< D, C >

Definition at line 27 of file DofT.h.


Constructor & Destructor Documentation

template<class D , class C >
DofT< D, C >::DofT ( bool  create_index2dof_ = false,
bool  create_dof2loc_ = false 
) [inline]

Definition at line 49 of file DofT.h.

References DofT< D, C >::counter, DofT< D, C >::create_dof2loc, DofT< D, C >::create_index2dof, DofT< D, C >::emax, and DofT< D, C >::imax.

                {
                        counter = -1;
                        emax = -1;
                        imax = -1;
                        create_index2dof = create_index2dof_;
                        create_dof2loc   = create_dof2loc_;
                }
template<class D , class C >
DofT< D, C >::~DofT ( ) [inline]

Definition at line 57 of file DofT.h.

{}

Member Function Documentation

template<class D , class C >
void DofT< D, C >::clear ( )

Definition at line 213 of file DofT.h.

{
        counter = -1;
        emax = -1;
        imax = -1;

        loc2dof.clear();
        dof2index.clear();
        index2dof.clear();
        dof2loc.clear();
}
template<class D , class C >
std::vector< std::pair< int, int > > DofT< D, C >::glob2loc ( int  j)

Definition at line 195 of file DofT.h.

{
        if ( create_dof2loc )
        {
                return dof2loc[j];
        }
        else
        {
                std::cout <<"This structure has not been created "<<std::endl;
                std::cout <<"You must turn on the create_dof2loc flag before initialization!"<<std::endl;
                return std::vector<std::pair<int,int> >();
        }

}
template<class D , class C >
int DofT< D, C >::glob_dof ( int  e,
int  i 
)

Definition at line 137 of file DofT.h.

Referenced by main().

{
        std::pair<int,int> index;
        index.first = e;
        index.second = i;
        if ( loc2dof.find(index) != loc2dof.end())
        {
                return (*(loc2dof.find(index))).second;
        }
        else
        {
                return -1;
        }
}
template<class D , class C >
int DofT< D, C >::glob_dof ( Lj)

Definition at line 155 of file DofT.h.

{
        if ( dof2index.find(Lj) != dof2index.end())
        {
                return (*(dof2index.find(Lj))).second;
        }
        else
        {
                return -1;
        }
}
template<class D , class C >
D DofT< D, C >::glob_dof ( int  j)

Definition at line 170 of file DofT.h.

{
        if ( create_index2dof)
        {
                if ( index2dof.find(j) != index2dof.end() )
                {
                        return (*(index2dof.find(j))).second;
                }
                else
                {
                        std::cout <<"not found "<<std::endl;
                        return D();
                }
        }
        else
        {
                std::cout <<"This structure has not been created "<<std::endl;
                std::cout <<"You must turn on the create_index2dof flag before initialization!"<<std::endl;
                return D();
        }
}
template<class D , class C >
int DofT< D, C >::insert_dof ( int  e,
int  i,
Li 
)

Definition at line 83 of file DofT.h.

References SyFi::p, and test_syfi::debug::v.

Referenced by main().

{

        if (e > emax) emax = e;
        if (i > imax) imax = i;

        // first we update loc2dof, which always should be updated
        std::pair<int,int> index;
        index.first = e;
        index.second = i;
        int return_dof;

        // check if the dof is new, if so
        // update counter, dof2index and create
        // a new vector in dof2loc
        iter = dof2index.find(Li);
                                                                 //dof is new
        if ( iter == dof2index.end() )
        {
                counter++;
                return_dof = counter;
                dof2index[Li]  = counter;
                loc2dof[index] = counter;
                if ( create_index2dof)
                {
                        std::pair<int, D> p(counter, Li);
                        index2dof.insert(p);
                        //      index2dof[counter] = Li;
                        //
                }
                if ( create_dof2loc )
                {
                        std::vector<std::pair<int,int> > v;
                        dof2loc[counter] = v;
                }
        }                                                        // dof is not new
        else
        {
                loc2dof[index] = (*iter).second;
                return_dof = (*iter).second;
        }

        // insert (e,i) in dof2loc[Li]
        if (create_dof2loc)
        {
                dof2loc[return_dof].push_back(index);
        }

        return return_dof;
}
template<class D , class C >
int DofT< D, C >::num_basis_functions ( ) const [inline]

Definition at line 68 of file DofT.h.

References DofT< D, C >::imax.

{ return imax+1; }
template<class D , class C >
int DofT< D, C >::num_elements ( ) const [inline]

Definition at line 67 of file DofT.h.

References DofT< D, C >::emax.

{ return emax+1; }
template<class D , class C >
int DofT< D, C >::size ( ) const

Definition at line 75 of file DofT.h.

Referenced by main().

{
        return counter+1;
}

Member Data Documentation

template<class D , class C >
int DofT< D, C >::counter [protected]

Definition at line 31 of file DofT.h.

Referenced by DofT< D, C >::DofT().

template<class D , class C >
bool DofT< D, C >::create_dof2loc [protected]

Definition at line 30 of file DofT.h.

Referenced by DofT< D, C >::DofT().

template<class D , class C >
bool DofT< D, C >::create_index2dof [protected]

Definition at line 30 of file DofT.h.

Referenced by DofT< D, C >::DofT().

template<class D , class C >
std::map<D,int,C> DofT< D, C >::dof2index [protected]

Definition at line 40 of file DofT.h.

template<class D , class C >
std::map<int, std::vector<std::pair<int,int> > > DofT< D, C >::dof2loc [protected]

Definition at line 46 of file DofT.h.

template<class D , class C >
int DofT< D, C >::emax [protected]

Definition at line 32 of file DofT.h.

Referenced by DofT< D, C >::DofT(), and DofT< D, C >::num_elements().

template<class D , class C >
int DofT< D, C >::imax [protected]

Definition at line 33 of file DofT.h.

Referenced by DofT< D, C >::DofT(), and DofT< D, C >::num_basis_functions().

template<class D , class C >
std::map<int,D> DofT< D, C >::index2dof [protected]

Definition at line 44 of file DofT.h.

template<class D , class C >
std::map<D,int,C>:: iterator DofT< D, C >::iter [protected]

Definition at line 41 of file DofT.h.

template<class D , class C >
std::map< std::pair<int,int>, int> DofT< D, C >::loc2dof [protected]

Definition at line 38 of file DofT.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator