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

LineBasis

parent 7087c224
Branches
Tags
No related merge requests found
...@@ -16,13 +16,15 @@ set(SRC ...@@ -16,13 +16,15 @@ set(SRC
CurlBasis.cpp CurlBasis.cpp
DivBasis.cpp DivBasis.cpp
QuadNodeBasis.cpp
QuadEdgeBasis.cpp
LagrangeGenerator.cpp LagrangeGenerator.cpp
LagrangeBasis.cpp LagrangeBasis.cpp
TriLagrangeBasis.cpp TriLagrangeBasis.cpp
LineNodeBasis.cpp
QuadNodeBasis.cpp
QuadEdgeBasis.cpp
TriNodeBasis.cpp TriNodeBasis.cpp
TriEdgeBasis.cpp TriEdgeBasis.cpp
TriNedelecBasis.cpp TriNedelecBasis.cpp
......
#include "LineNodeBasis.h"
#include "Legendre.h"
using namespace std;
LineNodeBasis::LineNodeBasis(int order){
// Set Basis Type //
this->order = order;
type = 0;
dim = 1;
nVertex = 2;
nEdge = (order - 1);
nFace = 0;
nCell = 0;
nEdgeClosure = 2;
nFaceClosure = 0;
size = nVertex + nEdge + nFace + nCell;
// Legendre Polynomial //
Polynomial* intLegendre = new Polynomial[order];
Legendre::integrated(intLegendre, order);
// Basis //
node = new vector<Polynomial*>(nVertex);
edge = new vector<vector<Polynomial*>*>(nEdgeClosure);
face = new vector<vector<Polynomial*>*>(nFaceClosure);
cell = new vector<Polynomial*>(nCell);
(*edge)[0] = new vector<Polynomial*>(nEdge);
(*edge)[1] = new vector<Polynomial*>(nEdge);
// Vertex Based (Lagrange) //
(*node)[0] =
new Polynomial(Polynomial(1, 0, 0, 0) -
Polynomial(1, 1, 0, 0) *
0.5);
(*node)[1] =
new Polynomial(Polynomial(1, 0, 0, 0) +
Polynomial(1, 1, 0, 0) *
0.5);
// Edge Based //
const int permutation[2] = {0, 1};
const Polynomial x[2] = {
Polynomial(+1, 1, 0, 0),
Polynomial(-1, 1, 0, 0)
};
for(int c = 0; c < 2; c++){
unsigned int i = 0;
for(int l = 1; l < order; l++){
(*(*edge)[c])[i] =
new Polynomial(intLegendre[l].compose(x[permutation[c]]));
i++;
}
}
// Free Temporary Sapce //
delete[] intLegendre;
}
LineNodeBasis::~LineNodeBasis(void){
// Vertex Based //
for(int i = 0; i < nVertex; i++)
delete (*node)[i];
delete node;
// Edge Based //
for(int c = 0; c < 2; c++){
for(int i = 0; i < nEdge; i++)
delete (*(*edge)[c])[i];
delete (*edge)[c];
}
delete edge;
// Face Based //
delete face;
// Cell Based //
delete cell;
}
#ifndef _LINENODEBASIS_H_
#define _LINENODEBASIS_H_
#include "BasisScalar.h"
/**
@class LineNodeBasis
@brief A Node Basis for Lines
This class can instantiate a Node-Based Basis
(high or low order) for Lines.@n
It uses an @em adaptation of
<a href="http://www.hpfem.jku.at/publications/szthesis.pdf">Zaglmayr's</a>
Basis for @em high @em order Polynomial%s generation.@n
This Basis is a restriction of a Quad Basis to @f$y = 0@f$.@n
It also uses the following mapping: @f$x = \frac{u + 1}{2}@f$.
*/
class LineNodeBasis: public BasisScalar{
public:
//! @param order The order of the Basis
//!
//! Returns a new Node-Basis for Lines of the given order
LineNodeBasis(int order);
//! Deletes this Basis
//!
virtual ~LineNodeBasis(void);
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment