SyFi  0.3
dof_ex2.cpp File Reference
#include <SyFi.h>

Go to the source code of this file.

Functions

int main ()

Function Documentation

int main ( )

Definition at line 7 of file dof_ex2.cpp.

References SyFi::Dof::glob2loc(), SyFi::Dof::glob_dof(), SyFi::initSyFi(), SyFi::Dof::insert_dof(), SyFi::Line::integrate(), SyFi::Triangle::line(), SyFi::pol(), and SyFi::Dof::size().

           { 

    initSyFi(2); 

    Dof dof(true, true); 

    // create two triangles
    Triangle t1(lst(0,0), lst(1,0), lst(0,1)); 
    Triangle t2(lst(1,1), lst(1,0), lst(0,1)); 

    // create the polynomial space
    ex Nj = pol(1,2,"a"); 
    cout <<"Nj " <<Nj<<endl; 
    Line line; 
    ex   dofi; 

    // dofs on first triangle
    for (unsigned int i=0; i< 3; i++) {
        line = t1.line(i);         // pick out the i'th line 
        dofi = line.integrate(Nj); // create the dof which is a line integral 
        dof.insert_dof(1,i, dofi); // insert local dof in global set of dofs 
    }

    // dofs on second triangle
    for (unsigned int i=0; i< 3; i++) {
        line = t2.line(i);         // pick out the i'th line
        dofi = line.integrate(Nj); // create the dof which is a line integral 
        dof.insert_dof(2,i, dofi); // insert local dof in global set of dofs 
    }

    // Print out the global degrees of freedom an their 
    // corresponding local degrees of freedom 
    vector<pair<unsigned int,unsigned int> > vec; 
    pair<unsigned int,unsigned int> index; 
    ex exdof; 
    for (unsigned int i=0; i< dof.size(); i++) {
        exdof = dof.glob_dof(i); 
        vec = dof.glob2loc(i);
        cout <<"global dof " <<i<<" dof "<<exdof<<endl; 
        for (unsigned int j=0; j<vec.size(); j++) { 
            index = vec[j]; 
            cout <<"  element "<<index.first<<" local dof "<<index.second<<endl; 
        }
    }


}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator