Skip to content
Snippets Groups Projects
Select Git revision
  • e8ca4fd19e1ed374f8cab6e743258ff26f459dde
  • master default protected
  • hierarchical-basis
  • alphashapes
  • bl
  • relaying
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • fix_overlaps
  • 3115-issue-fix
  • 3023-Fillet2D-Update
  • convert_fdivs
  • tmp_jcjc24
  • fixedMeshIF
  • save_edges
  • gmsh_4_14_0
  • gmsh_4_13_1
  • gmsh_4_13_0
  • gmsh_4_12_2
  • gmsh_4_12_1
  • gmsh_4_12_0
  • gmsh_4_11_1
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
41 results

open.cpp

Blame
  • Cal_Value.cpp 81.96 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>.
    //
    // Contributor(s):
    //   Johan Gyselinck
    //
    
    #include <sstream>
    #include <string.h>
    #include <math.h>
    #include "ProData.h"
    #include "ProDefine.h"
    #include "Cal_Value.h"
    #include "Message.h"
    
    extern struct CurrentData Current ;
    
    #define SQU(a)     ((a)*(a))
    
    /* ------------------------------------------------------------------------ */
    /*  O p e r a t o r s   o n   V a l u e s                                   */
    /* ------------------------------------------------------------------------ */
    /* Warning: the pointers V1 and R or V2 and R can be identical. You must    */
    /*          use temporary variables in your computations: you can only      */
    /*          affect to R at the very last time (when you're sure you will    */
    /*          not use V1 or V2 any more).                                     */
    /* ------------------------------------------------------------------------ */
    
    static double  a0;
    static double  a1     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  a2     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  b1     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  b2     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  b3     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  c1     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  c2     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  c3     [NBR_MAX_HARMONIC * MAX_DIM] ;
    static double  tmp[27][NBR_MAX_HARMONIC * MAX_DIM] ;
    
    static int TENSOR_SYM_MAP[]  = {0,1,2,1,3,4,2,4,5};
    static int TENSOR_DIAG_MAP[] = {0,-1,-1,-1,1,-1,-1,-1,2};
    
    void Cal_ComplexProduct(double V1[], double V2[], double P[])
    {
      P[0]       = V1[0] * V2[0]       - V1[MAX_DIM] * V2[MAX_DIM] ;
      P[MAX_DIM] = V1[0] * V2[MAX_DIM] + V1[MAX_DIM] * V2[0] ;
    }
    
    void Cal_ComplexDivision(double V1[], double V2[], double P[])
    {
      double Mod2 ;
    
      Mod2       = SQU(V2[0]) + SQU(V2[MAX_DIM]) ;
      if(!Mod2){ Message::Error("Division by zero in 'Cal_ComplexDivision'"); return; }
      P[0]       = (  V1[0] * V2[0]       + V1[MAX_DIM] * V2[MAX_DIM]) / Mod2 ;
      P[MAX_DIM] = (- V1[0] * V2[MAX_DIM] + V1[MAX_DIM] * V2[0])       / Mod2 ;
    }
    
    void Cal_ComplexInvert(double V1[], double P[])
    {
      double Mod2 ;
    
      Mod2       = SQU(V1[0]) + SQU(V1[MAX_DIM]) ;
      if(!Mod2){ Message::Error("Division by zero in 'Cal_ComplexInvert'"); return; }
      P[0]       =   V1[0]       / Mod2 ;
      P[MAX_DIM] = - V1[MAX_DIM] / Mod2 ;
    }