#include <SyFi.h>
#include <fstream>
Go to the source code of this file.
Functions | |
void | example_of_use (FE &fe) |
int | main () |
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().
00008 { 00009 ex Ni; 00010 ex gradNi; 00011 ex dofi; 00012 for (int i=0; i< fe.nbf() ; i++) { 00013 Ni = fe.N(i); 00014 gradNi = grad(Ni); 00015 dofi = fe.dof(i); 00016 cout <<"The basis function, N("<<i<<")="<<Ni<<endl; 00017 cout <<"The gradient of N("<<i<<")="<<gradNi<<endl; 00018 cout <<"The corresponding dof, L("<<i<<")="<<dofi<<endl; 00019 } 00020 }
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(), demos::crouzeixraviart::fe, SyFi::initSyFi(), SyFi::istr(), SyFi::StandardFE::N(), SyFi::StandardFE::nbf(), SyFi::StandardFE::set_order(), SyFi::StandardFE::set_polygon(), and demos::crouzeixraviart::triangle.
00024 { 00025 00026 initSyFi(2); 00027 00028 int order = 1; 00029 Triangle triangle(lst(0,0), lst(1,0), lst(0,1)); 00030 Lagrange fe; 00031 fe.set_order(order); 00032 fe.set_polygon(triangle); 00033 fe.compute_basis_functions(); 00034 00035 example_of_use(fe); 00036 00037 // regression test 00038 00039 archive ar; 00040 for (int i=0; i< fe.nbf(); i++) { 00041 ar.archive_ex(fe.N(i) , istr("N",i).c_str()); 00042 ar.archive_ex(fe.dof(i) , istr("D",i).c_str()); 00043 } 00044 00045 ofstream vfile("fe_ex1.gar.v"); 00046 vfile << ar; vfile.close(); 00047 if(!compare_archives("fe_ex1.gar.v", "fe_ex1.gar.r")) { 00048 cerr << "Failure!" << endl; 00049 return -1; 00050 } 00051 00052 return 0; 00053 }