Skip to content
Snippets Groups Projects
Commit 410245bd authored by Nicolas Marsic's avatar Nicolas Marsic
Browse files

LineNodeBasis: Convergence Test -- Seems OK

parent d7510e91
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include "GmshDefines.h" #include "GmshDefines.h"
#include "Exception.h" #include "Exception.h"
#include "LineNodeBasis.h"
#include "QuadNodeBasis.h" #include "QuadNodeBasis.h"
#include "QuadEdgeBasis.h" #include "QuadEdgeBasis.h"
...@@ -26,6 +28,7 @@ Basis* BasisGenerator::generate(int elementType, ...@@ -26,6 +28,7 @@ Basis* BasisGenerator::generate(int elementType,
int basisType, int basisType,
int order){ int order){
switch(elementType){ switch(elementType){
case TYPE_LIN: return linGen(basisType, order);
case TYPE_TRI: return triGen(basisType, order); case TYPE_TRI: return triGen(basisType, order);
case TYPE_QUA: return quaGen(basisType, order); case TYPE_QUA: return quaGen(basisType, order);
case TYPE_TET: return tetGen(basisType, order); case TYPE_TET: return tetGen(basisType, order);
...@@ -36,6 +39,18 @@ Basis* BasisGenerator::generate(int elementType, ...@@ -36,6 +39,18 @@ Basis* BasisGenerator::generate(int elementType,
} }
} }
Basis* BasisGenerator::linGen(int basisType,
int order){
switch(basisType){
case 0: return new LineNodeBasis(order);
case 1: throw Exception("1-form not implemented on Lines");
case 2: throw Exception("2-form not implemented on Lines");
case 3: throw Exception("3-form not implemented on Lines");
default: throw Exception("There is no %d-form", basisType);
}
}
Basis* BasisGenerator::triGen(int basisType, Basis* BasisGenerator::triGen(int basisType,
int order){ int order){
switch(basisType){ switch(basisType){
......
...@@ -24,6 +24,7 @@ class BasisGenerator{ ...@@ -24,6 +24,7 @@ class BasisGenerator{
int basisType, int basisType,
int order); int order);
static Basis* linGen(int basisType, int order);
static Basis* triGen(int basisType, int order); static Basis* triGen(int basisType, int order);
static Basis* quaGen(int basisType, int order); static Basis* quaGen(int basisType, int order);
static Basis* tetGen(int basisType, int order); static Basis* tetGen(int basisType, int order);
...@@ -56,6 +57,7 @@ class BasisGenerator{ ...@@ -56,6 +57,7 @@ class BasisGenerator{
@em instantiated Basis @em instantiated Basis
@note Element types are: @note Element types are:
@li @c TYPE_LIN for Lines
@li @c TYPE_TRI for Triangles @li @c TYPE_TRI for Triangles
@li @c TYPE_QUA for Quadrangles @li @c TYPE_QUA for Quadrangles
@li @c TYPE_TET for Tetrahedrons @li @c TYPE_TET for Tetrahedrons
...@@ -68,6 +70,23 @@ class BasisGenerator{ ...@@ -68,6 +70,23 @@ class BasisGenerator{
@li @c 3 for 3-Form @li @c 3 for 3-Form
** **
@fn BasisGenerator::linGen
@param basisType The Basis type
@param order The order or the requested Basis
This method will @em instanciate the requested Basis,
with a @em Line for support
@return Returns a @em pointer to a newly
@em instantiated Basis
@note Basis types are:
@li @c 0 for 0-Form
@li @c 1 for 1-Form
@li @c 2 for 2-Form
@li @c 3 for 3-Form
**
@fn BasisGenerator::triGen @fn BasisGenerator::triGen
@param basisType The Basis type @param basisType The Basis type
@param order The order or the requested Basis @param order The order or the requested Basis
......
...@@ -322,6 +322,8 @@ FunctionSpace::locBasis(const MElement& element, ...@@ -322,6 +322,8 @@ FunctionSpace::locBasis(const MElement& element,
// Number of basis function *per* edge // Number of basis function *per* edge
// --> should always be an integer ! // --> should always be an integer !
const unsigned int nEdge = edgeClosure.size(); const unsigned int nEdge = edgeClosure.size();
if(nEdge){
const unsigned int nFPerEdge = nFEdge / nEdge; const unsigned int nFPerEdge = nFEdge / nEdge;
unsigned int fEdge = 0; unsigned int fEdge = 0;
...@@ -334,11 +336,14 @@ FunctionSpace::locBasis(const MElement& element, ...@@ -334,11 +336,14 @@ FunctionSpace::locBasis(const MElement& element,
i++; i++;
} }
} }
}
// Face Based // Face Based
// Number of basis function *per* face // Number of basis function *per* face
// --> should always be an integer ! // --> should always be an integer !
const unsigned int nFace = faceClosure.size(); const unsigned int nFace = faceClosure.size();
if(nFace){
const unsigned int nFPerFace = nFFace / nFace; const unsigned int nFPerFace = nFFace / nFace;
unsigned int fFace = 0; unsigned int fFace = 0;
...@@ -351,6 +356,7 @@ FunctionSpace::locBasis(const MElement& element, ...@@ -351,6 +356,7 @@ FunctionSpace::locBasis(const MElement& element,
i++; i++;
} }
} }
}
// Cell Based // Cell Based
for(unsigned int j = 0; j < nFCell; j++){ for(unsigned int j = 0; j < nFCell; j++){
...@@ -390,6 +396,8 @@ FunctionSpace::locBasis(const MElement& element, ...@@ -390,6 +396,8 @@ FunctionSpace::locBasis(const MElement& element,
// Number of basis function *per* edge // Number of basis function *per* edge
// --> should always be an integer ! // --> should always be an integer !
const unsigned int nEdge = edgeClosure.size(); const unsigned int nEdge = edgeClosure.size();
if(nEdge){
const unsigned int nFPerEdge = nFEdge / nEdge; const unsigned int nFPerEdge = nFEdge / nEdge;
unsigned int fEdge = 0; unsigned int fEdge = 0;
...@@ -402,11 +410,14 @@ FunctionSpace::locBasis(const MElement& element, ...@@ -402,11 +410,14 @@ FunctionSpace::locBasis(const MElement& element,
i++; i++;
} }
} }
}
// Face Based // Face Based
// Number of basis function *per* face // Number of basis function *per* face
// --> should always be an integer ! // --> should always be an integer !
const unsigned int nFace = faceClosure.size(); const unsigned int nFace = faceClosure.size();
if(nFace){
const unsigned int nFPerFace = nFFace / nFace; const unsigned int nFPerFace = nFFace / nFace;
unsigned int fFace = 0; unsigned int fFace = 0;
...@@ -419,6 +430,7 @@ FunctionSpace::locBasis(const MElement& element, ...@@ -419,6 +430,7 @@ FunctionSpace::locBasis(const MElement& element,
i++; i++;
} }
} }
}
// Cell Based // Cell Based
for(unsigned int j = 0; j < nFCell; j++){ for(unsigned int j = 0; j < nFCell; j++){
......
...@@ -36,14 +36,12 @@ LineNodeBasis::LineNodeBasis(int order){ ...@@ -36,14 +36,12 @@ LineNodeBasis::LineNodeBasis(int order){
// Vertex Based (Lagrange) // // Vertex Based (Lagrange) //
(*node)[0] = (*node)[0] =
new Polynomial((Polynomial(1, 0, 0, 0) - new Polynomial(Polynomial(0.5, 0, 0, 0) -
Polynomial(1, 1, 0, 0)) * Polynomial(0.5, 1, 0, 0));
0.5);
(*node)[1] = (*node)[1] =
new Polynomial((Polynomial(1, 0, 0, 0) + new Polynomial(Polynomial(0.5, 0, 0, 0) +
Polynomial(1, 1, 0, 0)) * Polynomial(0.5, 1, 0, 0));
0.5);
// Edge Based // // Edge Based //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment