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

Go to the source code of this file.

Functions

int main ()

Function Documentation

int main ( )

Definition at line 12 of file arnoldfalkwinther.cpp.

References SyFi::ArnoldFalkWintherWeakSymSigma::compute_basis_functions(), SyFi::ArnoldFalkWintherWeakSymU::compute_basis_functions(), SyFi::ArnoldFalkWintherWeakSymP::compute_basis_functions(), SyFi::div(), SyFi::StandardFE::dof(), SyFi::initSyFi(), SyFi::inner(), SyFi::ReferenceTetrahedron::integrate(), SyFi::istr(), SyFi::StandardFE::N(), SyFi::StandardFE::nbf(), SyFi::StandardFE::set_order(), and SyFi::StandardFE::set_polygon().

           {


    archive ar; 

    initSyFi(3); 
    ReferenceTetrahedron tetrahedron; 
    int order = 2; 

    ArnoldFalkWintherWeakSymSigma sigma_fe; 
    sigma_fe.set_order(order); 
    sigma_fe.set_polygon(tetrahedron); 
    sigma_fe.compute_basis_functions(); 
    for (unsigned int i=0; i<sigma_fe.nbf(); i++) {
        cout <<"sigma_fe.N("<<i<<")="<<sigma_fe.N(i)<<endl; ; 
        cout <<"div(sigma_fe.N("<<i<<"))="<<div(sigma_fe.N(i))<<endl; ; 
        cout <<"sigma_fe.dof("<<i<<"))="<<sigma_fe.dof(i)<<endl; ; 

        ar.archive_ex(sigma_fe.N(i), istr("sN", i).c_str()); 

    }

    map<pair<int,int>,ex> A; 
    pair<int,int> index; 
    for (unsigned int i=0; i<sigma_fe.nbf(); i++) {
        index.first = i; 
        for (unsigned int j=0; j<sigma_fe.nbf(); j++) {
            index.second = j; 
            ex integrand = inner(sigma_fe.N(i), sigma_fe.N(j)); 
            A[index] = tetrahedron.integrate(integrand); 
            cout <<"A["<<i<<","<<j<<"]="<<A[index]<<endl; 

            ar.archive_ex(A[index], istr("A", i,j).c_str()); 
        }
    }




    ArnoldFalkWintherWeakSymU u_fe; 
    u_fe.set_order(order); 
    u_fe.set_polygon(tetrahedron); 
    u_fe.compute_basis_functions(); 
    for (unsigned int i=0; i<u_fe.nbf(); i++) {
        cout <<"u_fe.N("<<i<<")="<<u_fe.N(i)<<endl; ; 
        ar.archive_ex(u_fe.N(i), istr("uN", i).c_str()); 
    }

    map<pair<int,int>,ex> B; 
    for (unsigned int i=0; i<sigma_fe.nbf(); i++) {
        index.first = i; 
        for (unsigned int j=0; j<u_fe.nbf(); j++) {
            index.second = j; 
            ex integrand = inner(div(sigma_fe.N(i)), u_fe.N(j)); 
            B[index] = tetrahedron.integrate(integrand); 
            cout <<"B["<<i<<","<<j<<"]="<<B[index]<<endl; 
        }
    }




    ArnoldFalkWintherWeakSymP p_fe; 
    p_fe.set_order(order); 
    p_fe.set_polygon(tetrahedron); 
    p_fe.compute_basis_functions(); 
    for (unsigned int i=0; i<p_fe.nbf(); i++) {
        cout <<"p_fe.N("<<i<<")="<<p_fe.N(i)<<endl; ; 
        ar.archive_ex(p_fe.N(i), istr("pN", i).c_str()); 
    }


    /*
    ofstream vfile("arnoldfalkwinther.gar.v"); 
    vfile << ar; vfile.close(); 
    if(!compare_archives("arnoldfalkwinther.gar.v", "arnoldfalkwinther.gar.r")) 
    { 
        cerr << "Failure!" << endl;
        return -1;
    }
    */
    return 0; 
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator