SyFi  0.3
fe_ex1.cpp File Reference
#include <SyFi.h>
#include <fstream>

Go to the source code of this file.

Functions

void example_of_use (FE &fe)
int main ()

Function Documentation

void example_of_use ( FE fe)

Definition at line 8 of file fe_ex1.cpp.

References SyFi::FE::dof(), SyFi::grad(), SyFi::FE::N(), and SyFi::FE::nbf().

Referenced by main().

                            { 
    ex Ni; 
    ex gradNi; 
    ex dofi; 
    for (unsigned int i=0; i< fe.nbf() ; i++) { 
        Ni = fe.N(i); 
        gradNi = grad(Ni); 
        dofi = fe.dof(i); 
        cout <<"The basis function, N("<<i<<")="<<Ni<<endl; 
        cout <<"The gradient of N("<<i<<")="<<gradNi<<endl; 
        cout <<"The corresponding dof, L("<<i<<")="<<dofi<<endl; 
    }
}
int main ( )

Definition at line 24 of file fe_ex1.cpp.

References SyFi::compare_archives(), SyFi::Lagrange::compute_basis_functions(), SyFi::StandardFE::dof(), example_of_use(), SyFi::initSyFi(), SyFi::istr(), SyFi::StandardFE::N(), SyFi::StandardFE::nbf(), SyFi::StandardFE::set_order(), and SyFi::StandardFE::set_polygon().

          { 
   
    initSyFi(2); 

    int order = 1; 
    Triangle triangle(lst(0,0), lst(1,0), lst(0,1));   
    Lagrange fe; 
    fe.set_order(order); 
    fe.set_polygon(triangle); 
    fe.compute_basis_functions(); 

    example_of_use(fe); 

    // regression test

    archive ar; 
    for (unsigned int i=0; i< fe.nbf(); i++) {
            ar.archive_ex(fe.N(i) , istr("N",i).c_str()); 
            ar.archive_ex(fe.dof(i) , istr("D",i).c_str()); 
    }

    ofstream vfile("fe_ex1.gar.v"); 
    vfile << ar; vfile.close(); 
    if(!compare_archives("fe_ex1.gar.v", "fe_ex1.gar.r")) { 
            cerr << "Failure!" << endl;
            return -1;
    }

    return 0; 
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator