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

Prism and Pyramid ReferenceSpace: seems to work \o/ -- Correcting Polynomial doc

parent 77bd3bd8
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,8 @@ set(SRC
QuadReferenceSpace.cpp
TetReferenceSpace.cpp
HexReferenceSpace.cpp
PyrReferenceSpace.cpp
PriReferenceSpace.cpp
Basis.cpp
BasisLocal.cpp
......
......@@ -54,52 +54,14 @@ HexReferenceSpace::~HexReferenceSpace(void){
}
string HexReferenceSpace::toLatex(void) const{
//const size_t nRefSpace = refSpaceNodeId.size();
stringstream stream;
/*
stream << "\\documentclass{article}" << endl << endl
<< "\\usepackage{longtable}" << endl
<< "\\usepackage{tikz}" << endl
<< "\\usetikzlibrary{arrows}" << endl << endl
<< "\\begin{document}" << endl
<< "\\tikzstyle{vertex} = [circle, fill = black!25]" << endl
<< "\\tikzstyle{line} = [draw, thick, black, -latex']" << endl
<< endl
<< "\\begin{longtable}{ccc}" << endl << endl;
for(size_t s = 0; s < nRefSpace; s++){
stream << "\\begin{tikzpicture}" << endl
<< "\\node[vertex] (n0) at(0, 0) {$" << refSpaceNodeId[s][0] << "$};"
<< endl
<< "\\node[vertex] (n1) at(3, 0) {$" << refSpaceNodeId[s][1] << "$};"
<< endl
<< "\\node[vertex] (n2) at(0, 3) {$" << refSpaceNodeId[s][2] << "$};"
<< endl
<< "\\node[vertex] (n3) at(1, 1) {$" << refSpaceNodeId[s][3] << "$};"
<< endl
<< endl;
for(size_t e = 0; e < 6; e++)
stream << "\\path[line]"
<< " (n" << orderedEdgeNodeIdx[s][e][0] << ")"
<< " -- "
<< " (n" << orderedEdgeNodeIdx[s][e][1] << ");"
<< endl;
if((s + 1) % 3)
stream << "\\end{tikzpicture} & " << endl << endl;
else
stream << "\\end{tikzpicture} \\\\ \\\\" << endl << endl;
}
stream << "\\end{longtable}" << endl
<< "\\end{document}" << endl;
*/
stream << "Not Implemented" << endl;
stream << "\\documentclass{article}" << endl << endl
<< "\\begin{document}" << endl
<< "\texttt{toLatex} not implemented" << endl
<< "\\end{document}" << endl;
return stream.str();
}
......@@ -156,7 +156,7 @@ double Polynomial::at
return val;
}
fullVector<double> Polynomial::at(const vector<Polynomial>& P,
fullVector<double> Polynomial::at(const std::vector<Polynomial>& P,
double x,
double y,
double z){
......@@ -572,9 +572,9 @@ void Polynomial::distribute(monomial_t* src, int size, const monomial_t* m){
}
}
void Polynomial::compose(const Polynomial::monomial_t* src,
void Polynomial::compose(const monomial_t* src,
Polynomial comp,
stack<Polynomial::monomial_t>* stk){
std::stack<monomial_t>* stk){
comp.power(src->power[0]);
comp.mul(src->coef);
......@@ -592,9 +592,9 @@ void Polynomial::compose(const Polynomial::monomial_t* src,
}
}
void Polynomial::compose(const Polynomial::monomial_t* src,
void Polynomial::compose(const monomial_t* src,
Polynomial compA, Polynomial compB,
stack<Polynomial::monomial_t>* stk){
std::stack<monomial_t>* stk){
compA.power(src->power[0]);
compB.power(src->power[1]);
......@@ -614,9 +614,9 @@ void Polynomial::compose(const Polynomial::monomial_t* src,
}
}
void Polynomial::compose(const Polynomial::monomial_t* src,
void Polynomial::compose(const monomial_t* src,
Polynomial compA, Polynomial compB, Polynomial compC,
stack<Polynomial::monomial_t>* stk){
std::stack<monomial_t>* stk){
compA.power(src->power[0]);
compB.power(src->power[1]);
......
......@@ -8,10 +8,10 @@
/**
@class Polynomial
@brief Represents @c 3D polynomials
@brief Represents 3D polynomials
This class represents @c 3D polynomials.@n
A @c 3D polynomials uses monomials of '@c xyz' type.
This class represents 3D polynomials.
A 3D polynomials uses monomials of 'xyz' type.
*/
// We suppose 3D Polynomial
......@@ -122,34 +122,24 @@ class Polynomial{
/**
@fn Polynomial::Polynomial(double, int, int, int)
@param coef The coeficient of the futur monomial
@param powerX The power of the '@c x' coordinate
of the futur monomial
@param powerY The power of the '@c y' coordinate
of the futur monomial
@param powerZ The power of the '@c z' coordinate
of the futur monomial
@return Returns a new Monomial with the given
parameters
@note
Note that Monomials are special case of Polynomial%s
@param powerX The power of the 'x' coordinate of the futur monomial
@param powerY The power of the 'y' coordinate of the futur monomial
@param powerZ The power of the 'z' coordinate of the futur monomial
@return Returns a new Monomial with the given parameters
(note that Monomials are special case of Polynomial%s)
**
@fn Polynomial::Polynomial(const Polynomial&)
@param other A Polynomial
@return Returns a new Polynomial, which is
the @em copy of the given one
@return Returns a new Polynomial, which is the copy of the given one
**
@fn Polynomial::Polynomial(void)
@return Returns a new Polynomial, which is
@em empty
@warning
An @em empty Polynomial means: @em A @em Polynomial
@em with @em no @em monomials.@n
In particular, the empty Polynomial is @em not
the @em zero @em Polynomial.@n
Indeed, the @em zero @em Polynomial has one monomial,
@em @c 0.
@return Returns a new Polynomial, which is empty
An empty Polynomial means: a Polynomial with no monomials.
In particular, the empty Polynomial is not the zero Polynomial.
Indeed, the zero Polynomial has one monomial, 0.
**
@fn Polynomial::~Polynomial
......@@ -157,48 +147,41 @@ class Polynomial{
**
@fn Polynomial::derivative
@param dim The dimention to use for the
derivation
@returns Derivates this Polynomial with
respect to the given dimention
@note
Dimention:
@li @c 0 is for the @c x coordinate
@li @c 1 is for the @c y coordinate
@li @c 2 is for the @c z coordinate
@param dim The dimention to use for the derivation
@returns Derivates this Polynomial with respect to the given dimention
Note that dimention:
@li 0 is for the x coordinate
@li 1 is for the y coordinate
@li 2 is for the z coordinate
**
@fn Polynomial::gradient
@return Returns a Vector with the gradient
of this Polynomial
@return Returns the gradient of this Polynomial
**
@fn Polynomial::curl
@param p A vector of Polynomial%s
@return Returns the @em curl of the given
vector of Polynomial%s
@return Returns the curl of the given vector of Polynomial%s
**
@fn Polynomial::divergence
@param p A vector of Polynomial%s
@return Returns the @em divergence of the given
vector of Polynomial%s
@return Returns the divergence of the given vector of Polynomial%s
**
@fn double Polynomial::operator()(double, double, double)
@param x A value
@param y A value
@param z A value
@return Returns the @em evaluation of this
Polynomial at (@c x, @c y, @c z)
@return Returns the evaluation of this Polynomial at (x, y, z)
**
@fn double Polynomial::at(double, double, double) const
@param x A value
@param y A value
@param z A value
@return Returns the @em evaluation of this
Polynomial at (@c x, @c y, @c z)
@return Returns the evaluation of this Polynomial at (x, y, z)
**
@fn fullVector<double> Polynomial::at(const std::vector<Polynomial>&, double, double, double)
......@@ -206,99 +189,94 @@ class Polynomial{
@param x A value
@param y A value
@param z A value
@return Returns a fullVector with the @em evaluation of
the given vector of Polynomial%s at (@c x, @c y, @c z)
@return Returns a fullVector with the evaluation of
the given vector of Polynomial%s at (x, y, z)
**
@fn Polynomial Polynomial::operator+(const Polynomial&) const
@param other An other Polynomial
@return Returns a @em new Polynomial, which is the
@em sum of this Polynomial and the given one
@return Returns a new Polynomial,
which is the sum of this Polynomial and the given one
**
@fn Polynomial Polynomial::operator-(const Polynomial&) const
@param other An other Polynomial
@return Returns a @em new Polynomial, which is the
@em difference of this Polynomial and the given one
@return Returns a new Polynomial,
which is the difference of this Polynomial and the given one
**
@fn Polynomial Polynomial::operator*(const Polynomial&) const
@param other An other Polynomial
@return Returns a @em new Polynomial, which is the
@em product of this Polynomial and the given one
@return Returns a new Polynomial,
which is the product of this Polynomial and the given one
**
@fn Polynomial Polynomial::operator*(double) const
@param alpha A value
@return Returns a @em new Polynomial,
which is this Polynomial @em multiplied by @c alpha
@return Returns a new Polynomial,
which is this Polynomial multiplied by alpha
**
@fn Polynomial::add
@param other An other Polynomial
@return The given Polynomial is
@em added to this Polynomial
@note
The result of this operation is stored in
this Polynomial
@return The given Polynomial is added to this Polynomial
Note that the result of this operation is stored in this Polynomial
**
@fn Polynomial::sub
@param other An other Polynomial
@return The given Polynomial is
@em substracted to this Polynomial
@note
The result of this operation is stored in
this Polynomial
@return The given Polynomial is substracted to this Polynomial
Note that the result of this operation is stored in this Polynomial
**
@fn void Polynomial::mul(const Polynomial&)
@param other An other Polynomial
@return The given Polynomial is
@em multiplied with this Polynomial
@note
The result of this operation is stored in
this Polynomial
@return The given Polynomial is multiplied with this Polynomial
Note that the result of this operation is stored in this Polynomial
**
@fn void Polynomial::mul(double)
@param alpha A value
@return This Polynomial is @em multiplied
by the given value
@note
The result of this operation is stored in
this Polynomial
@return This Polynomial is multiplied by the given value
Note that the result of this operation is stored in this Polynomial
**
@fn Polynomial::power
@param n A @em natural number
@return Takes this Polynomial to the power @c n
@param n A natural number
@return Takes this Polynomial to the power n
**
@fn Polynomial Polynomial::compose(const Polynomial&) const
@param other An other Polynomial,
called @c Q(x, @c y, @c z)
@param other An other Polynomial, called Q(x, y, z)
@return
Let this Polynomial be @c P(x, @c y, @c z).@n
This method returns a @em new Polynomial,
representing @c P(Q(x, @c y, @c z), @c y, @c z)
Let this Polynomial be P(x, y, z). This method returns a new Polynomial,
representing P(Q(x, y, z), y, z)
**
@fn Polynomial Polynomial::compose(const Polynomial&, const Polynomial&) const
@param otherA An other Polynomial,
called @c Q(x, @c y, @c z)
@param otherB An other Polynomial,
called @c R(x, @c y, @c z)
@param otherA An other Polynomial, called Q(x, y, z)
@param otherB An other Polynomial, called R(x, y, z)
@return
Let this Polynomial be P(x, y, z). This method returns a new Polynomial,
representing P(Q(x, y, z), R(x, y, z), z)
**
@fn Polynomial Polynomial::compose(const Polynomial&, const Polynomial&, const Polynomial&) const
@param otherA An other Polynomial, called Q(x, y, z)
@param otherB An other Polynomial, called R(x, y, z)
@param otherC An other Polynomial, called S(x, y, z)
@return
Let this Polynomial be @c P(x, @c y, @c z).@n
This method returns a @em new Polynomial, representing
@c P(Q(x, @c y, @c z), @c R(x, @c y, @c z), @c z)
Let this Polynomial be P(x, y, z). This method returns a new Polynomial,
representing P(Q(x, y, z), R(x, y, z), S(x, y, z))
**
@fn void Polynomial::operator=(const Polynomial&)
@param other A Polynomial
@return Sets this Polynomial to a @em copy
of the given one
@return Sets this Polynomial to a copy of the given one
**
@fn Polynomial::toString
......
#include <sstream>
#include "PriReferenceSpace.h"
#include "MPrism.h"
using namespace std;
PriReferenceSpace::PriReferenceSpace(void){
// Vertex Definition //
nVertex = 6;
// Edge Definition //
const size_t nEdge = 9;
refEdgeNodeIdx.resize(nEdge);
for(size_t i = 0; i < nEdge; i++){
refEdgeNodeIdx[i].resize(2); // Two Nodes per Edge
refEdgeNodeIdx[i][0] = MPrism::edges_prism(i, 0);
refEdgeNodeIdx[i][1] = MPrism::edges_prism(i, 1);
}
// Face Definition //
size_t nFace = 5;
refFaceNodeIdx.resize(nFace);
for(size_t i = 0; i < nFace; i++){
int fourthNodeIdx = MPrism::faces_prism(i, 3);
if(fourthNodeIdx != -1)
refFaceNodeIdx[i].resize(4); // Four Nodes in this face
else
refFaceNodeIdx[i].resize(3); // Three Nodes in this face
refFaceNodeIdx[i][0] = MPrism::faces_prism(i, 0);
refFaceNodeIdx[i][1] = MPrism::faces_prism(i, 1);
refFaceNodeIdx[i][2] = MPrism::faces_prism(i, 2);
if(fourthNodeIdx != -1)
refFaceNodeIdx[i][3] = fourthNodeIdx;
}
// Init All //
init();
}
PriReferenceSpace::~PriReferenceSpace(void){
}
string PriReferenceSpace::toLatex(void) const{
stringstream stream;
stream << "\\documentclass{article}" << endl << endl
<< "\\begin{document}" << endl
<< "\texttt{toLatex} not implemented" << endl
<< "\\end{document}" << endl;
return stream.str();
}
#ifndef _PRIREFERENCESPACE_H_
#define _PRIREFERENCESPACE_H_
#include <string>
#include "ReferenceSpace.h"
/**
@class PriReferenceSpace
@brief ReferenceSpace for Prisms
This class implements a ReferenceSpace for a Prism.
*/
class PriReferenceSpace: public ReferenceSpace{
public:
PriReferenceSpace(void);
virtual ~PriReferenceSpace(void);
virtual std::string toLatex(void) const;
};
/**
@fn PriReferenceSpace::PriReferenceSpace
Instatiate a new ReferenceSpace for a Prism
**
@fn PriReferenceSpace::~PriReferenceSpace
Deletes this PriReferenceSpace
*/
#endif
#include <sstream>
#include "PyrReferenceSpace.h"
#include "MPyramid.h"
using namespace std;
PyrReferenceSpace::PyrReferenceSpace(void){
// Vertex Definition //
nVertex = 5;
// Edge Definition //
const size_t nEdge = 8;
refEdgeNodeIdx.resize(nEdge);
for(size_t i = 0; i < nEdge; i++){
refEdgeNodeIdx[i].resize(2); // Two Nodes per Edge
refEdgeNodeIdx[i][0] = MPyramid::edges_pyramid(i, 0);
refEdgeNodeIdx[i][1] = MPyramid::edges_pyramid(i, 1);
}
// Face Definition //
size_t nFace = 5;
refFaceNodeIdx.resize(nFace);
for(size_t i = 0; i < nFace; i++){
int fourthNodeIdx = MPyramid::faces_pyramid(i, 3);
if(fourthNodeIdx != -1)
refFaceNodeIdx[i].resize(4); // Four Nodes in this face
else
refFaceNodeIdx[i].resize(3); // Three Nodes in this face
refFaceNodeIdx[i][0] = MPyramid::faces_pyramid(i, 0);
refFaceNodeIdx[i][1] = MPyramid::faces_pyramid(i, 1);
refFaceNodeIdx[i][2] = MPyramid::faces_pyramid(i, 2);
if(fourthNodeIdx != -1)
refFaceNodeIdx[i][3] = fourthNodeIdx;
}
// Init All //
init();
}
PyrReferenceSpace::~PyrReferenceSpace(void){
}
string PyrReferenceSpace::toLatex(void) const{
stringstream stream;
stream << "\\documentclass{article}" << endl << endl
<< "\\begin{document}" << endl
<< "\texttt{toLatex} not implemented" << endl
<< "\\end{document}" << endl;
return stream.str();
}
#ifndef _PYRREFERENCESPACE_H_
#define _PYRREFERENCESPACE_H_
#include <string>
#include "ReferenceSpace.h"
/**
@class PyrReferenceSpace
@brief ReferenceSpace for Pyramids
This class implements a ReferenceSpace for a Pyramid.
*/
class PyrReferenceSpace: public ReferenceSpace{
public:
PyrReferenceSpace(void);
virtual ~PyrReferenceSpace(void);
virtual std::string toLatex(void) const;
};
/**
@fn PyrReferenceSpace::PyrReferenceSpace
Instatiate a new ReferenceSpace for a Pyramid
**
@fn PyrReferenceSpace::~PyrReferenceSpace
Deletes this PyrReferenceSpace
*/
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment