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