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

Basis: add number of Vertex - Edge - Face - Cell based functions

parent 23b815a5
No related branches found
No related tags found
No related merge requests found
......@@ -21,11 +21,29 @@ class Basis{
int nodeNbr;
int dim;
int nVertex;
int nEdge;
int nFace;
int nCell;
public:
//! Deletes this Basis
//!
virtual ~Basis(void);
//! @return Returns:
//! @li @c true, if this is a
//! @em scalar Basis (BasisScalar)
//! @li @c false, if this is a
//! @em vectorial Basis (BasisVector)
//!
//! @note
//! Scalar basis are sets of
//! Polynomial%s@n
//! Vectorial basis are sets of
//! Vector%s of Polynomial%s
bool isScalar(void) const;
//! @return Returns the @em polynomial @em order of the Basis
int getOrder(void) const;
......@@ -49,18 +67,21 @@ class Basis{
//! (1D, 2D or 3D) of the Basis
int getDim(void) const;
//! @return Returns:
//! @li @c true, if this is a
//! @em scalar Basis (BasisScalar)
//! @li @c false, if this is a
//! @em vectorial Basis (BasisVector)
//!
//! @note
//! Scalar basis are sets of
//! Polynomial%s@n
//! Vectorial basis are sets of
//! Vector%s of Polynomial%s
bool isScalar(void) const;
//! @return Returns the number of @em Vertex
//! @em Based functions of this Basis
int getNVertex(void) const;
//! @return Returns the number of @em Edge
//! @em Based functions of this Basis
int getNEdge(void) const;
//! @return Returns the number of @em Face
//! @em Based functions of this Basis
int getNFace(void) const;
//! @return Returns the number of @em Cell
//! @em Based functions of this Basis
int getNCell(void) const;
protected:
//! Instantiate a new Basis
......@@ -72,6 +93,10 @@ class Basis{
// Inline Functions //
//////////////////////
inline bool Basis::isScalar(void) const{
return scalar;
}
inline int Basis::getOrder(void) const{
return order;
}
......@@ -92,8 +117,20 @@ inline int Basis::getDim(void) const{
return dim;
}
inline bool Basis::isScalar(void) const{
return scalar;
inline int Basis::getNVertex(void) const{
return nVertex;
}
inline int Basis::getNEdge(void) const{
return nEdge;
}
inline int Basis::getNFace(void) const{
return nFace;
}
inline int Basis::getNCell(void) const{
return nCell;
}
#endif
......@@ -13,6 +13,10 @@ HexEdgeBasis::HexEdgeBasis(const int order){
nodeNbr = 8;
dim = 3;
nVertex = 0 ;
nEdge = 12 * (order + 1);
nFace = 12 * order * (order + 1);
nCell = 3 * order * order * (order + 1);
// Alloc Temporary Space //
const int orderPlus = order + 1;
......@@ -448,6 +452,11 @@ int main(void){
const char x[3] = {'X', 'Y', 'Z'};
HexEdgeBasis b(P);
printf("%d = %d + %d + %d + %d = %d\n",
b.getSize(),
b.getNVertex(), b.getNEdge(), b.getNFace(), b.getNCell(),
b.getNVertex() + b.getNEdge() + b.getNFace() + b.getNCell());
const std::vector<std::vector<Polynomial> >& basis = b.getBasis();
......@@ -515,3 +524,4 @@ int main(void){
return 0;
}
*/
......@@ -10,6 +10,11 @@ HexNodeBasis::HexNodeBasis(const int order){
nodeNbr = 8;
dim = 3;
nVertex = 8;
nEdge = 12 * (order - 1);
nFace = 6 * (order - 1) * (order - 1);
nCell = (order - 1) * (order - 1) * (order - 1);
// Alloc Temporary Space //
Polynomial* legendre = new Polynomial[order];
Polynomial* lifting = new Polynomial[8];
......@@ -207,11 +212,16 @@ HexNodeBasis::~HexNodeBasis(void){
#include <cstdio>
int main(void){
const int P = 3;
const int P = 8;
const double d = 0.05;
HexNodeBasis b(P);
printf("%d = %d + %d + %d + %d = %d\n",
b.getSize(),
b.getNVertex(), b.getNEdge(), b.getNFace(), b.getNCell(),
b.getNVertex() + b.getNEdge() + b.getNFace() + b.getNCell());
const std::vector<Polynomial>& basis = b.getBasis();
printf("\n");
......
......@@ -10,6 +10,11 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
nodeNbr = 4;
dim = 2;
nVertex = 0 ;
nEdge = 4 * (order + 1) ;
nFace = 0 ;
nCell = 2 * (order + 1) * order;
// Alloc Temporary Space //
const int orderPlus = order + 1;
Polynomial* legendre = new Polynomial[orderPlus];
......@@ -181,11 +186,16 @@ QuadEdgeBasis::~QuadEdgeBasis(void){
/*
#include <cstdio>
int main(void){
const int P = 3;
const int P = 8;
const double d = 0.05;
const char x[2] = {'X', 'Y'};
QuadEdgeBasis b(P);
printf("%d = %d + %d + %d + %d = %d\n",
b.getSize(),
b.getNVertex(), b.getNEdge(), b.getNFace(), b.getNCell(),
b.getNVertex() + b.getNEdge() + b.getNFace() + b.getNCell());
const std::vector<std::vector<Polynomial> >& basis = b.getBasis();
......
......@@ -10,6 +10,11 @@ QuadNodeBasis::QuadNodeBasis(const int order){
nodeNbr = 4;
dim = 2;
nVertex = 4 ;
nEdge = 4 * (order - 1) ;
nFace = 0 ;
nCell = (order - 1) * (order - 1);
// Alloc Temporary Space //
Polynomial* legendre = new Polynomial[order];
Polynomial* lifting = new Polynomial[4];
......@@ -95,10 +100,15 @@ QuadNodeBasis::~QuadNodeBasis(void){
/*
#include <cstdio>
int main(void){
const int P = 4;
const int P = 8;
const double d = 0.05;
QuadNodeBasis b(P);
printf("%d = %d + %d + %d + %d = %d\n",
b.getSize(),
b.getNVertex(), b.getNEdge(), b.getNFace(), b.getNCell(),
b.getNVertex() + b.getNEdge() + b.getNFace() + b.getNCell());
const std::vector<Polynomial>& basis = b.getBasis();
......@@ -137,7 +147,7 @@ int main(void){
printf("\n");
for(int i = 0; i < b.getSize(); i++)
printf("p%d(j, i) = p(%d, x(i), y(j));\n", i + 1, i + 1, i + 1);
printf("p%d(j, i) = p(%d, x(i), y(j));\n", i + 1, i + 1);
printf("end\n");
printf("end\n");
......@@ -148,7 +158,7 @@ int main(void){
printf("\n");
for(int i = b.getSize(); i > 0; i--)
printf("figure;\ncontourf(x, y, p%d);\ncolorbar;\n", i, i);
printf("figure;\ncontourf(x, y, p%d);\ncolorbar;\n", i);
printf("\n");
......
......@@ -10,6 +10,11 @@ TriEdgeBasis::TriEdgeBasis(const int order){
nodeNbr = 3;
dim = 2;
nVertex = 0;
nEdge = 3 * (order + 1);
nFace = 0;
nCell = ((order - 1) * order + order - 1);
// Alloc Temporary Space //
const int orderPlus = order + 1;
const int orderMinus = order - 1;
......@@ -167,11 +172,16 @@ TriEdgeBasis::~TriEdgeBasis(void){
/*
#include <cstdio>
int main(void){
const int P = 6;
const int P = 8;
const double d = 0.05;
const char x[2] = {'X', 'Y'};
TriEdgeBasis b(P);
printf("%d = %d + %d + %d + %d = %d\n",
b.getSize(),
b.getNVertex(), b.getNEdge(), b.getNFace(), b.getNCell(),
b.getNVertex() + b.getNEdge() + b.getNFace() + b.getNCell());
const std::vector<std::vector<Polynomial> >& basis = b.getBasis();
......
......@@ -8,6 +8,11 @@ TriNedelecBasis::TriNedelecBasis(void){
nodeNbr = 3;
dim = 2;
nVertex = 0;
nEdge = 3;
nFace = 0;
nCell = 0;
// Lagrange //
Polynomial* lagrange = new Polynomial[3];
......@@ -54,11 +59,15 @@ TriNedelecBasis::~TriNedelecBasis(void){
/*
#include <cstdio>
int main(void){
const int P = 1;
const double d = 0.05;
const char x[2] = {'X', 'Y'};
TriNedelecBasis b;
printf("%d = %d + %d + %d + %d = %d\n",
b.getSize(),
b.getNVertex(), b.getNEdge(), b.getNFace(), b.getNCell(),
b.getNVertex() + b.getNEdge() + b.getNFace() + b.getNCell());
const std::vector<std::vector<Polynomial> >& basis = b.getBasis();
......
......@@ -10,6 +10,11 @@ TriNodeBasis::TriNodeBasis(const int order){
nodeNbr = 3;
dim = 2;
nVertex = 3;
nEdge = 3 * (order - 1);
nFace = 0;
nCell = (order - 1) * (order - 2) / 2;
// Alloc Temporary Space //
Polynomial* legendre = new Polynomial[order];
Polynomial* intLegendre = new Polynomial[order];
......@@ -86,10 +91,15 @@ TriNodeBasis::~TriNodeBasis(void){
/*
#include <cstdio>
int main(void){
const int P = 5;
const int P = 8;
const double d = 0.01;
TriNodeBasis b(P);
printf("%d = %d + %d + %d + %d = %d\n",
b.getSize(),
b.getNVertex(), b.getNEdge(), b.getNFace(), b.getNCell(),
b.getNVertex() + b.getNEdge() + b.getNFace() + b.getNCell());
const std::vector<Polynomial>& basis = b.getBasis();
......@@ -128,7 +138,7 @@ int main(void){
printf("\n");
for(int i = 0; i < b.getSize(); i++)
printf("p%d(j, i) = p(%d, x(i), y(j));\n", i + 1, i + 1, i + 1);
printf("p%d(j, i) = p(%d, x(i), y(j));\n", i + 1, i + 1);
printf("end\n");
printf("end\n");
......@@ -139,7 +149,7 @@ int main(void){
printf("\n");
for(int i = 0; i < b.getSize(); i++)
printf("figure;\ncontourf(x, y, p%d);\ncolorbar;\n", i + 1, i + 1);
printf("figure;\ncontourf(x, y, p%d);\ncolorbar;\n", i + 1);
printf("\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment