Skip to content
Snippets Groups Projects
Select Git revision
  • e4c8f816819076455bd2c854fca272550b3e6e04
  • master default protected
  • dof-renumbering
  • test-dof-hash
  • gdemesy-master-patch-30528
  • eval-space-time
  • oscillating_multiharm
  • MH_movement
  • axisqu
  • write_vtu_and_ensight_formats
  • movingband
  • CP_1972_add_vtu_file_writing
  • mortar
  • fast_freq_sweep_Resolution
  • applyresolvent_again
  • marteaua-master-patch-54323
  • patch-1
  • binde-master-patch-08072
  • binde-master-patch-52461
  • BCGSL
  • resolvent
  • getdp_3_5_0
  • getdp_3_4_0
  • getdp_3_3_0
  • getdp_3_2_0
  • getdp_3_1_0
  • getdp_3_0_4
  • getdp_3_0_3
  • getdp_3_0_2
  • getdp_3_0_1
  • getdp_3_0_0
  • onelab_mobile_2.1.0
  • getdp_2_11_3 protected
  • getdp_2_11_2 protected
  • getdp_2_11_1 protected
  • getdp_2_11_0 protected
  • getdp_2_10_0 protected
  • getdp_2_9_2 protected
  • getdp_2_9_1 protected
  • getdp_2_9_0 protected
  • getdp_2_8_0 protected
41 results

Cal_AnalyticIntegration.cpp

Blame
  • Cal_AnalyticIntegration.cpp 2.87 KiB
    // GetDP - Copyright (C) 1997-2018 P. Dular and C. Geuzaine, University of Liege
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <getdp@onelab.info>.
    
    #include <math.h>
    #include "ProData.h"
    #include "BF.h"
    #include "Message.h"
    
    /* ------------------------------------------------------------------------ */
    /*  C a l _ A n a l y t i c I n t e g r a t i o n                           */
    /* ------------------------------------------------------------------------ */
    
    double Cal_AnalyticIntegration(struct Element * E,
    			       void (*BFEqu)(), void (*BFDof)(),
    			       int i, int j, double (*Cal_Productx)())
    {
      double DetJ ;
    
      if ((E->Type != TRIANGLE) ||
          (BFEqu != (void (*)())BF_GradNode) || (BFDof != (void (*)())BF_GradNode) ) {
    
        Message::Error("Unknown analytic method for integration") ;
        return 0.;
      }
    
      DetJ = (E->x[2] - E->x[0]) * (E->y[1] - E->y[0]) -
             (E->x[1] - E->x[0]) * (E->y[2] - E->y[0]) ;
    
      switch (i) {
    
      case 0 :
        switch (j) {
        case 0 :
          return( ((E->y[2]-E->y[1])*(E->y[2]-E->y[1]) +
    	       (E->x[1]-E->x[2])*(E->x[1]-E->x[2])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        case 1 :
          return( ((E->y[2]-E->y[1])*(E->y[0]-E->y[2]) +
    	       (E->x[1]-E->x[2])*(E->x[2]-E->x[0])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        case 2 :
          return( ((E->y[2]-E->y[1])*(E->y[1]-E->y[0]) +
    	       (E->x[1]-E->x[2])*(E->x[0]-E->x[1])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        default :
          Message::Error("Something wrong in Cal_AnalyticIntegration");
          return 0. ;
        }
    
      case 1 :
        switch (j) {
        case 0 :
          return( ((E->y[2]-E->y[1])*(E->y[0]-E->y[2]) +
    	       (E->x[1]-E->x[2])*(E->x[2]-E->x[0])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        case 1 :
          return( ((E->y[0]-E->y[2])*(E->y[0]-E->y[2]) +
    	       (E->x[2]-E->x[0])*(E->x[2]-E->x[0])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        case 2 :
          return( ((E->y[0]-E->y[2])*(E->y[1]-E->y[0]) +
    	       (E->x[2]-E->x[0])*(E->x[0]-E->x[1])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        default :
          Message::Error("Something wrong in Cal_AnalyticIntegration");
          return 0. ;
        }
    
      case 2 :
        switch (j) {
        case 0 :
          return( ((E->y[2]-E->y[1])*(E->y[1]-E->y[0]) +
    	       (E->x[1]-E->x[2])*(E->x[0]-E->x[1])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        case 1 :
          return( ((E->y[0]-E->y[2])*(E->y[1]-E->y[0]) +
    	       (E->x[2]-E->x[0])*(E->x[0]-E->x[1])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        case 2 :
          return( ((E->y[1]-E->y[0])*(E->y[1]-E->y[0]) +
    	       (E->x[0]-E->x[1])*(E->x[0]-E->x[1])) * fabs(DetJ)
    	      / (2. * DetJ * DetJ) ) ;
        default :
          Message::Error("Something wrong in Cal_AnalyticIntegration");
          return 0.;
        }
    
      default :
        Message::Error("Something wrong in Cal_AnalyticIntegration");
        return 0. ;
      }
    
    }