Skip to content
Snippets Groups Projects
Select Git revision
  • 07070da8458b307f08234cdc4843ef7a0c4aaa74
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

TriNedelecBasis.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    • Nicolas Marsic's avatar
      1aec02c9
      ** ReferenceSpace: · 1aec02c9
      Nicolas Marsic authored
          -- Add Point Mapping from ABC space to XYZ space
          -- Handle Elements with no Face
      
      ** LineBasis:
          -- Works again
      
      ** Jacobian and GroupOfJacobian:
          -- Computes Good Jacobian from Basis ReferenceSpace
      
      ** Formulation:
          -- Addapted for good Jacobian
      
      ** TermProjection:
          -- Addapted to compute function to project at good point (see ReferenceSpace ABCtoXYZ mapping)
      
      ** Laplace, Poisson, SteadyWave:
          -- Passed with all basis
      
      ** WARNING:
          -- Tet Basis NOT Retested (but seems to work)
          -- FunctionSpace::getDof doesn't work if wrong element type (because of basis implication)
          -- SystemAbstract::fixCoef doesn't work anymore (see above)
          -- Problem with cureved Element (getTypeForMSH gives HO element for FunctionSpace::getDof)
      1aec02c9
      History
      ** ReferenceSpace:
      Nicolas Marsic authored
          -- Add Point Mapping from ABC space to XYZ space
          -- Handle Elements with no Face
      
      ** LineBasis:
          -- Works again
      
      ** Jacobian and GroupOfJacobian:
          -- Computes Good Jacobian from Basis ReferenceSpace
      
      ** Formulation:
          -- Addapted for good Jacobian
      
      ** TermProjection:
          -- Addapted to compute function to project at good point (see ReferenceSpace ABCtoXYZ mapping)
      
      ** Laplace, Poisson, SteadyWave:
          -- Passed with all basis
      
      ** WARNING:
          -- Tet Basis NOT Retested (but seems to work)
          -- FunctionSpace::getDof doesn't work if wrong element type (because of basis implication)
          -- SystemAbstract::fixCoef doesn't work anymore (see above)
          -- Problem with cureved Element (getTypeForMSH gives HO element for FunctionSpace::getDof)
    TriNedelecBasis.cpp 1.80 KiB
    #include "TriNedelecBasis.h"
    #include "TriReferenceSpace.h"
    
    using namespace std;
    
    TriNedelecBasis::TriNedelecBasis(void){
      // Reference Space //
      refSpace  = new TriReferenceSpace;
      nRefSpace = getReferenceSpace().getNReferenceSpace();
    
      const vector<vector<vector<size_t> > >&
        edgeIdx = refSpace->getEdgeNodeIndex();
    
      // Set Basis Type //
      order = 0;
    
      type = 1;
      dim  = 2;
    
      nVertex   = 0;
      nEdge     = 3;
      nFace     = 0;
      nCell     = 0;
      nFunction = 3;
    
      // Lagrange //
      const Polynomial lagrange[3] =
        {
          Polynomial(Polynomial(1, 0, 0, 0) -
                     Polynomial(1, 1, 0, 0) -
                     Polynomial(1, 0, 1, 0)),
    
          Polynomial(Polynomial(1, 1, 0, 0)),
    
          Polynomial(Polynomial(1, 0, 1, 0))
        };
    
      // Basis //
      basis = new vector<Polynomial>**[nRefSpace];
    
      for(size_t s = 0; s < nRefSpace; s++)
        basis[s] = new vector<Polynomial>*[nFunction];
    
      // Edge Based (Nedelec) //
      for(size_t s = 0; s < nRefSpace; s++){
        for(size_t e = 0; e < 3; e++){
          vector<Polynomial> tmp1 = lagrange[edgeIdx[s][e][1]].gradient();
          vector<Polynomial> tmp2 = lagrange[edgeIdx[s][e][0]].gradient();
    
          tmp1[0].mul(lagrange[edgeIdx[s][e][0]]);
          tmp1[1].mul(lagrange[edgeIdx[s][e][0]]);
          tmp1[2].mul(lagrange[edgeIdx[s][e][0]]);
    
          tmp2[0].mul(lagrange[edgeIdx[s][e][1]]);
          tmp2[1].mul(lagrange[edgeIdx[s][e][1]]);
          tmp2[2].mul(lagrange[edgeIdx[s][e][1]]);
    
          tmp2[0].sub(tmp1[0]);
          tmp2[1].sub(tmp1[1]);
          tmp2[2].sub(tmp1[2]);
    
          basis[s][e] = new vector<Polynomial>(tmp2);
        }
      }
    }
    
    TriNedelecBasis::~TriNedelecBasis(void){
      // ReferenceSpace //
      delete refSpace;
    
      // Basis //
      for(size_t i = 0; i < nRefSpace; i++){
        for(size_t j = 0; j < nFunction; j++)
          delete basis[i][j];
    
        delete[] basis[i];
      }
    
      delete[] basis;
    }